Certificate represents an org-managed certificate used for digital signatures so that other systems can verify that requests originate from Salesforce. Uses include authenticated single sign-on with external websites and Salesforce acting as an identity provider, the system that authenticates users for another service.
This is a metadata component with file content. Its inherited fullName identifies the component, while its .crt content can contain a certificate signing request (CSR) or a certificate chain, depending on its lifecycle state. Retrieving and deploying a Certificate does not transfer its private key or clone the source org's signing identity.
Key Elements
| Element | What the Element Controls |
|---|---|
fullName |
The inherited metadata component identifier. It is separate from the user-facing masterLabel. |
content |
The inherited file content represented by the .crt file. For a certificate authority (CA)-signed certificate, it contains the CSR before signing is completed and the signed certificate chain after upload. |
caSigned |
Required boolean distinguishing the CA-signed workflow, true, from a self-signed certificate, false. A value of true does not prove that the signed chain has already been uploaded. |
keySize |
Key size in bits: 2048 or 4096. Defaults to 2048 when omitted during creation. It also determines the automatically assigned lifetime of a self-signed certificate. |
expirationDate |
The date the certificate expires and becomes unusable. Salesforce assigns it for self-signed certificates and updates it from the signed certificate when a CA-signed chain is uploaded. |
masterLabel |
Required user-friendly name shown in Certificate and Key Management. Maximum length: 64 characters. |
privateKeyExportable |
Whether the private key is exportable. Defaults to true when omitted during creation, but does not permit private-key import or export through the Metadata API. |
encryptedWithPlatformEncryption |
Whether the certificate is encrypted with Platform Encryption. This is separate from private-key exportability. |
Behavior and Constraints
The Metadata API can create both self-signed and CA-signed certificates. A CA-signed certificate passes through a signing process: Salesforce creates a CSR, a certificate authority signs it, and the signed certificate chain is uploaded to the existing component. Setting caSigned to true identifies that workflow; it is not confirmation that signing is complete.
For self-signed certificates, Salesforce automatically sets expirationDate to one year after creation for a 2048-bit key or two years after creation for a 4096-bit key. For CA-signed certificates, uploading the signed chain updates expirationDate to the signed certificate's expiration date. Do not infer a CA-signed certificate's lifetime from keySize. At expiration, the certificate is no longer usable.
Uploading an existing certificate to create a new certificate copies its X.509 parameter data, the descriptive certificate data, but Salesforce generates a new private/public key pair. This procedure can also be used for renewal. It is different from updating the signed chain on an existing CA-signed certificate: preserving certificate parameters does not preserve the original signing identity.
privateKeyExportable and encryptedWithPlatformEncryption describe separate properties. Neither an exportable private key nor an encrypted certificate changes the Metadata API restriction on private-key transfer.
Deployment and Retrieval
Certificate components use the .crt suffix and are stored in the certs directory. The type supports * as a member selection in a package.xml manifest.
The Metadata API cannot import or export private keys. A retrieved certificate is therefore not a portable copy of the source org's cryptographic identity. Setting privateKeyExportable to true does not remove this restriction.
For a CA-signed certificate, the retrieved content changes during signing:
- Create the CA-signed certificate. Until a signed chain is uploaded, downloading its
.crtcontent returns the CSR. - Have the certificate authority sign the request.
- Save the signed certificate chain as the
.crtcontent and update the existing component through the Metadata API. - Subsequent API retrieval returns the signed certificate chain, not the CSR. The CSR remains downloadable through the Salesforce UI.
The chain content can later be updated for renewal or changes to the intermediate certificate chain. Keep this operation distinct from creating a new certificate from an existing certificate's parameters, which generates a new key pair.
Replacement scope depends on the actual consumers and their settings in the destination org. A possible metadata relationship does not prove that a particular certificate is assigned or used at runtime. A community-reported keystore migration workflow is described under Reported Issues; it uses Certificate and Key Management rather than private-key transfer through metadata deployment.
Relationships
Certificate consumers include authentication, credential, external data, and site configurations. Replacement impact depends on the values in those configurations, not simply on which types can reference a certificate.
Certificate roles also matter. A Connected App's uploaded digital-signature certificate for inbound OAuth JWT bearer authentication, where an external client presents a signed token to Salesforce, is not necessarily a reference to an org-managed Certificate. That upload is a different setting from ConnectedApp.encryptionCertificate.
In Security Assertion Markup Language (SAML) single sign-on, the org's request-signing certificate signs requests sent to an external identity provider when Salesforce acts as the service provider in a service provider-initiated login. It must not be confused with the external identity provider's certificate used to validate incoming assertions, the messages containing authentication information.
Referenced By
-
ConnectedApp:encryptionCertificate -
CustomSite:certificate -
ExternalCredential:certificate -
ExternalDataSource:certificate -
ExtlClntAppSamlConfigurablePolicies:encryptionCertificate -
NamedCredential:certificate,jwtSigningCertificate -
SamlSsoConfig:decryptionCertificate,requestSigningCertId
Reported Issues
-
Existing certificates were reportedly moved between sandboxes through a keystore. In 2016, an administrator reported using "Export to Keystore" in Certificate and Key Management, supplying a password, and then using "Import from a Keystore" in the target sandbox with the downloaded
.jksfile and password. This was a UI workflow, not private-key transfer through the Metadata API. Sandbox keystore migration report. -
A Connected App's JWT digital-signature upload may not identify an expiring org-managed certificate's consumer. A 2021 community explanation distinguished that uploaded certificate from certificates referenced through Certificate and Key Management. This distinction applies to the inbound OAuth JWT bearer digital-signature setting, not the separate
encryptionCertificaterelationship. Connected App certificate distinction. - Replacing the wrong SAML certificate can misdirect expiration troubleshooting. A 2020 community explanation distinguished the request-signing certificate used for requests sent to an identity provider from the external identity provider's certificate. An expiring org certificate should not automatically be treated as the certificate used to validate incoming assertions. SAML certificate role explanation.
- A third-party API's failure to trust a client certificate was treated as a possible chain-content problem. In a discussion involving a CA-signed client certificate and a DigiCert intermediate, a 2016 answer recommended placing the signed certificate and intermediate certificate together in one file. This was proposed troubleshooting for that integration, not a general Metadata API deployment requirement. Client certificate chain discussion.
Common Questions
Does deploying a Certificate also deploy its private key?
No. Salesforce does not allow private-key import or export through the Metadata API. privateKeyExportable=true does not override that restriction, and metadata deployment must not be treated as cloning the source org's signing identity.
Why does my retrieved .crt file contain a CSR?
For a newly created CA-signed certificate, the .crt content remains the CSR until the signed certificate chain is uploaded. After upload, API retrieval returns the chain. The CSR remains available through the UI.
How do I renew a CA-signed certificate through metadata?
Place the renewed signed certificate chain in the existing component's .crt content and update it through the Metadata API. Creating a new certificate from an existing certificate's parameters is a different operation and generates a new key pair.
How long does a Salesforce self-signed certificate last?
A self-signed certificate expires one year after creation with a 2048-bit key or two years after creation with a 4096-bit key. The creation default is 2048 bits. For a CA-signed certificate, the uploaded signed certificate determines the expiration date.
Which configurations can use an expiring certificate?
Possible consumers include the types listed under Referenced By. Their actual reference values determine replacement scope. Keep a Connected App's inbound JWT digital-signature upload and an external SAML identity provider's certificate separate from org-managed certificate references.