ImportCertificateCommand

Imports the signing and encryption certificates that you need to create local (AS2) profiles and partner profiles.

You can import both the certificate and its chain in the Certificate parameter.

If you use the Certificate parameter to upload both the certificate and its chain, don't use the CertificateChain parameter.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { TransferClient, ImportCertificateCommand } from "@aws-sdk/client-transfer"; // ES Modules import
// const { TransferClient, ImportCertificateCommand } = require("@aws-sdk/client-transfer"); // CommonJS import
const client = new TransferClient(config);
const input = { // ImportCertificateRequest
  Usage: "SIGNING" || "ENCRYPTION" || "TLS", // required
  Certificate: "STRING_VALUE", // required
  CertificateChain: "STRING_VALUE",
  PrivateKey: "STRING_VALUE",
  ActiveDate: new Date("TIMESTAMP"),
  InactiveDate: new Date("TIMESTAMP"),
  Description: "STRING_VALUE",
  Tags: [ // Tags
    { // Tag
      Key: "STRING_VALUE", // required
      Value: "STRING_VALUE", // required
    },
  ],
};
const command = new ImportCertificateCommand(input);
const response = await client.send(command);
// { // ImportCertificateResponse
//   CertificateId: "STRING_VALUE", // required
// };

ImportCertificateCommand Input

See ImportCertificateCommandInput for more details

Parameter
Type
Description
Certificate
Required
string | undefined
  • For the CLI, provide a file path for a certificate in URI format. For example, --certificate file://encryption-cert.pem. Alternatively, you can provide the raw content.

  • For the SDK, specify the raw content of a certificate file. For example, --certificate "cat encryption-cert.pem".

You can provide both the certificate and its chain in this parameter, without needing to use the CertificateChain parameter. If you use this parameter for both the certificate and its chain, do not use the CertificateChain parameter.

Usage
Required
CertificateUsageType | undefined

Specifies how this certificate is used. It can be used in the following ways:

  • SIGNING: For signing AS2 messages

  • ENCRYPTION: For encrypting AS2 messages

  • TLS: For securing AS2 communications sent over HTTPS

ActiveDate
Date | undefined

An optional date that specifies when the certificate becomes active. If you do not specify a value, ActiveDate takes the same value as NotBeforeDate, which is specified by the CA.

CertificateChain
string | undefined

An optional list of certificates that make up the chain for the certificate that's being imported.

Description
string | undefined

A short description that helps identify the certificate.

InactiveDate
Date | undefined

An optional date that specifies when the certificate becomes inactive. If you do not specify a value, InactiveDate takes the same value as NotAfterDate, which is specified by the CA.

PrivateKey
string | undefined
  • For the CLI, provide a file path for a private key in URI format. For example, --private-key file://encryption-key.pem. Alternatively, you can provide the raw content of the private key file.

  • For the SDK, specify the raw content of a private key file. For example, --private-key "cat encryption-key.pem"

Tags
Tag[] | undefined

Key-value pairs that can be used to group and search for certificates.

ImportCertificateCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
CertificateId
Required
string | undefined

An array of identifiers for the imported certificates. You use this identifier for working with profiles and partner profiles.

Throws

Name
Fault
Details
InternalServiceError
server

This exception is thrown when an error occurs in the Transfer Family service.

InvalidRequestException
client

This exception is thrown when the client submits a malformed request.

ResourceNotFoundException
client

This exception is thrown when a resource is not found by the Amazon Web ServicesTransfer Family service.

ServiceUnavailableException
server

The request has failed because the Amazon Web ServicesTransfer Family service is not available.

TransferServiceException
Base exception class for all service exceptions from Transfer service.