ECPrivateKey constructor

ECPrivateKey(
  1. String pem
)

Implementation

ECPrivateKey(String pem) {
  final _key = KeyParser.ecPrivateKeyFromPEM(
    pem,
    pkcs1: pem.startsWith(KeyParser.BEGIN_EC_PRIVATE_KEY),
  );
  final _params = _key.parameters;

  if (_params == null) {
    throw JWTParseException('ECPrivateKey parameters are invalid');
  }

  key = _key;
  size = (_params.curve.fieldSize / 8).ceil();
}