generateSelfSignedCertificatePem static method

String generateSelfSignedCertificatePem(
  1. AsymmetricKeyPair<RSAPublicKey, RSAPrivateKey> keyPair
)

Generates a self-signed X.509 v3 certificate in PEM format.

Implementation

static String generateSelfSignedCertificatePem(
  AsymmetricKeyPair<RSAPublicKey, RSAPrivateKey> keyPair,
) {
  final certDer = _buildSelfSignedCertificate(
    keyPair,
    subject: const <_X509NameAttribute>[
      _X509NameAttribute([2, 5, 4, 3], 'adb'),
    ],
    issuer: const <_X509NameAttribute>[
      _X509NameAttribute([2, 5, 4, 3], 'adb'),
    ],
  );
  return _derToPem(certDer, 'CERTIFICATE');
}