rsaPublicKeyFromPEM function

RSAPublicKey rsaPublicKeyFromPEM(
  1. String pemString
)

Implementation

RSAPublicKey rsaPublicKeyFromPEM(String pemString) {
  final rows = pemString.split(RegExp(r'\r\n?|\n'));
  final privateKeyString = rows
      .skipWhile((row) => row.startsWith('-----BEGIN'))
      .takeWhile((row) => !row.startsWith('-----END'))
      .map((row) => row.trim())
      .join('');
  return rsaPublicKeyFromString(privateKeyString);
}