ecPrivateKeyFromPem static method

ECPrivateKey ecPrivateKeyFromPem(
  1. String pem
)

Decode a ECPrivateKey from the given pem String.

Throws an ArgumentError if the given string pem is null or empty.

Implementation

static ECPrivateKey ecPrivateKeyFromPem(String pem) {
  if (pem.isEmpty) {
    throw ArgumentError('Argument must not be null.');
  }
  var bytes = RsaUtil.getBytesFromPEMString(pem);
  return ecPrivateKeyFromDerBytes(
    bytes,
    pkcs8: pem.startsWith(BEGIN_PRIVATE_KEY),
  );
}