Pular para o conteúdo principal

Issue a PKCS #12 file

When your system has no key of its own to send, Amplia can make the key pair, issue the certificate and return both in a password-protected PKCS #12 (.pfx) file. This API exists since Amplia 4.1.0.

Flow​

  1. Create the order.
  2. Call POST /api/certificates/pkcs12 with the order's id, the password for the file and the key size.
  3. Store the file from the response's pfxContent (Base64); the response's model describes the issued certificate.

The only sample is in Node.js. It asks for a 2048-bit key, with the password the user typed:

let order = await client.createOrder(request);
let cert = await client.issuePkcs12Certificate(order.getId(), req.body.senha, 2048);
let certId = cert.getModel().id;
StorageMock.storeSync(cert.getPfxContent(), certId, '.pfx');
FieldMeaning
orderIdId of the order to fulfill.
passwordPassword that protects the PKCS #12 file.
keySizeSize of the key pair, in bits; the sample uses 2048.
  • Only the Node.js client has this call. Its getPfxContent() returns pfxContent as the API sends it, in Base64, and getModel() returns the certificate's JSON as is.
  • TODO(docs): which key sizes are accepted, and whether Amplia keeps a copy of the private key after returning the file.
  • The private key reaches your server inside the file: protect the file and its password as you would the key itself.

Key and certificate in other formats​

Since Amplia 4.7.0, POST /api/certificates/software takes the same request and returns the key and the certificate in several formats: pkcs12Der, certificateDer and certificatePem, publicKeyDer and publicKeyPem, privateKeyPkcs8Der and privateKeyPkcs8Pem, privateKeyPkcs1Der and privateKeyPkcs1Pem, plus the certificate's model. The Node.js client's issueSoftwareCertificate(orderId, password, keySize) calls it, with a 2048-bit key by default.

See also​

View as Markdown