upload_signing_certificate ( $certificate_body, $opt )

Uploads an X.509 signing certificate and associates it with the specified user. Some AWS services use X.509 signing certificates to validate requests that are signed with a corresponding private key. When you upload the certificate, its default status is Active.

If the UserName field is not specified, the user name is determined implicitly based on the AWS Access Key ID used to sign the request. Because this action works for access keys under the AWS account, this API can be used to manage root credentials even if the AWS account has no associated users.

Because the body of a X.509 certificate can be large, you should use POST rather than GET when calling UploadSigningCertificate. For information about setting up signatures and authorization through the API, go to Signing AWS API Requests in the AWS General Reference. For general information about using the Query API with IAM, go to Making Query Requests in Using IAM.

Access

public

Parameters

Parameter

Type

Required

Description

$certificate_body

string

Required

The contents of the signing certificate. [Constraints: The value must be between 1 and 16384 characters, and must match the following regular expression pattern: [\u0009\u000A\u000D\u0020-\u00FF]+]

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • UserName - string - Optional - Name of the user the signing certificate is for. [Constraints: The value must be between 1 and 128 characters, and must match the following regular expression pattern: [\w+=,.@-]*]
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Upload an X.509 signing certificate.

$x509_certificate = <<<CERT
-----BEGIN EXAMPLE CERTIFICATE-----
EXAMPLECAeGgAwIBAgIGAIBHCmYxMA0GCSqGSIb3DQEBBQUAMFMxCzAJBgNVBAYT
AlVTMRMEXAMPLEQKEwpBbWF6b24uY29tMQwwCgYDVQQLEwNBV1MxITAfBgNVBAMT
GEFXUyBMaW1pdGEXAMPLE3VyYW5jZSBDQTAeFw0xMDA5MDEwMzE0NDRaFw0xMTA5
MDEwMzE0NDRaMFMxCzAJBEXAMPLEAlVTMRMwEQYDVQQKEwpBbWF6b24uY29tMRcw
FQYDVQQLEw5BV1MtRGV2ZWxvcGVyEXAMPLEGA1UEAxMNMTM1ZDUzaHpjOWppajCB
nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEEXAMPLEkQAQQQJYx1ZSo2hHkruELw
l8xQVIMwWkyL4COOKAKFPjnM8AbpXT98DcwnvMTPodEXAMPLERBwZUlXhvsXCIZ/
PyBC18ef7suZbITHhSCOyqiR0iZOyTsK7h9xF5pGptgrCGrMIEXAMPLEGOb7Tl+5
P6hE+TGzD/c9aK8CAwEAAaNXMFUwDgYDVR0PAQH/BAQDAgWgMBYGA1UdEXAMPLEM
EXAMPLEGAQUFBwMCMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFLxafWX3qRESqFU1
4/A4QW+EXAMPLE0GCSqGSIb3DQEBBQUAA4GBADCWnRMuwpCzlHtAOQTAszq6LPBB
UDVslkapUlDKjQEXAMPLE1A3+PCmZXWVW0zkmzZn1komB4/3GofnKWxjot5y+dnU
tPdpG8PdAOPTTYqLEOnIqEXAMPLEsvswV5CbNPIZzsAmOVtw1D3u+qUAW8yXidH6
jl5XFaJpamQ0vpIy
-----END EXAMPLE CERTIFICATE-----
CERT;

// Instantiate the class
$iam = new AmazonIAM();

$response = $iam->upload_signing_certificate($x509_certificate, array(
	'UserName' => 'johndoe2'
));

// Success?
var_dump($response->isOK());
Result:
bool(true)

Related Methods

Source

Method defined in services/iam.class.php | Toggle source view (7 lines) | View on GitHub

public function upload_signing_certificate($certificate_body, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['CertificateBody'] = $certificate_body;
    
    return $this->authenticate('UploadSigningCertificate', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback