Skip to main content

CertAddPrivate

Uploads your organization's private certificate (with its private key) to a communication channel, enabling your mailbox to decrypt inbound EDI and sign outbound EDI.

:::caution Established API The SOAP API is in maintenance mode. For new integrations use the REST equivalent. :::

Method Signature

as2CommInfo CertAddPrivate(string SessionID, int CommID, CertificateType CertType,
string KeyId, string UserId, datetime BeginUsage, CertificateUsage Usage,
string PartnerAS2ID, base64Binary Cert, string Password)

Parameters

ParameterTypeRequiredDescription
SessionIDstringYesActive session token from Login()
CommIDintYesIdentifier of the communication channel to associate the certificate with
CertTypeCertificateTypeYesType of certificate being uploaded (typically X509 for AS2)
KeyIdstringYesKey identifier or thumbprint of the certificate
UserIdstringYesUser or entity identifier embedded in the certificate
BeginUsagedatetimeYesDate and time from which the certificate becomes valid for use
UsageCertificateUsageYesIntended cryptographic use (Encryption, Signature, EncryptionAndSignature)
PartnerAS2IDstringNoAS2 ID of the trading partner this private certificate will communicate with
Certbase64BinaryYesRaw certificate bytes (including the private key, typically PKCS#12 / .pfx) encoded as Base64
PasswordstringNoPassword protecting the private key within the certificate file; empty string if none

Response Object — as2CommInfo

FieldTypeDescription
CommIDintCommunication channel the certificate was attached to
NetworkIDintNetwork owning the channel
MailboxIDintMailbox owning the channel
AS2IDstringAS2 ID configured for the channel
PartnerAS2IDstringTrading partner AS2 ID
StatusstringCurrent status of the channel
CertKeyIDintIdentifier assigned to the newly uploaded private certificate key
CertExpirationdatetimeExpiration date of the uploaded certificate
<!-- Example response XML -->
<as2CommInfoResult>
<CommID>5001</CommID>
<NetworkID>1</NetworkID>
<MailboxID>100</MailboxID>
<AS2ID>MY-AS2-ID</AS2ID>
<PartnerAS2ID>PARTNER-AS2-ID</PartnerAS2ID>
<Status>Active</Status>
<CertKeyID>78</CertKeyID>
<CertExpiration>2027-05-07T00:00:00</CertExpiration>
</as2CommInfoResult>

ENUMs

CertificateType

ValueDescription
X509X.509 standard digital certificate (PKCS#12 for private keys)
PGPPGP certificate
SSHSSH key certificate

CertificateUsage

ValueDescription
SSLTLS/SSL transport layer
EncryptionEncrypt inbound EDI payloads
SignatureSign outbound EDI payloads
EncryptionAndSignatureBoth encryption and signing

See Appendix — ENUMs for the complete enumeration definitions.

Code Examples

// .NET 10 — dotnet-svcutil generated proxy
// Upload a PKCS#12 private certificate for AS2 encryption and signing
byte[] pfxBytes = await File.ReadAllBytesAsync("/secure/my-private.pfx");

// Certificate password loaded from secure configuration — never hardcode
string certPassword = config["Certificates:PfxPassword"];

var as2Info = await client.CertAddPrivateAsync(
sessionID,
commID: 5001,
certType: CertificateType.X509,
keyId: "MY-CERT-001",
userId: "MY-AS2-ID",
beginUsage: DateTime.UtcNow,
usage: CertificateUsage.EncryptionAndSignature,
partnerAS2ID: "PARTNER-AS2-ID",
cert: pfxBytes,
password: certPassword);

Console.WriteLine($"Private certificate uploaded. CertKeyID: {as2Info.CertKeyID}");
Console.WriteLine($"Expires: {as2Info.CertExpiration:yyyy-MM-dd}");

REST Equivalent

See Add Private CertificatePOST /v2/certificates/add-private.