RsaUtil class

Constructors

RsaUtil()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

ecPrivateKeyFromDerBytes(Uint8List bytes, {bool pkcs8 = false}) → ECPrivateKey
Decode the given bytes into an ECPrivateKey.
ecPrivateKeyFromPem(String pem) → ECPrivateKey
Decode a ECPrivateKey from the given pem String.
ecPublicKeyFromDerBytes(Uint8List bytes) → ECPublicKey
Decode the given bytes into an ECPublicKey.
ecPublicKeyFromPem(String pem) → ECPublicKey
Decode a ECPublicKey from the given pem String.
ecSign(ECPrivateKey privateKey, Uint8List dataToSign, {String algorithmName = 'SHA-1/ECDSA'}) → ECSignature
Signing the given dataToSign with the given privateKey.
ecVerify(ECPublicKey publicKey, Uint8List signedData, ECSignature signature, {String algorithm = 'SHA-1/ECDSA'}) bool
Verifying the given signedData with the given publicKey and the given signature. Will return true if the given signature matches the signedData.
encodeEcPrivateKeyToPem(ECPrivateKey ecPrivateKey) String
Enode the given elliptic curve publicKey to PEM format.
encodeEcPublicKeyToPem(ECPublicKey publicKey) String
Enode the given elliptic curve publicKey to PEM format.
encodeRSAPrivateKeyToPem(RSAPrivateKey rsaPrivateKey) String
Enode the given rsaPrivateKey to PEM format using the PKCS#8 standard.
encodeRSAPrivateKeyToPemPkcs1(RSAPrivateKey rsaPrivateKey) String
Enode the given rsaPrivateKey to PEM format using the PKCS#1 standard.
encodeRSAPublicKeyToPem(RSAPublicKey publicKey) String
Enode the given publicKey to PEM format using the PKCS#8 standard.
encodeRSAPublicKeyToPemPkcs1(RSAPublicKey rsaPublicKey) String
Enode the given rsaPublicKey to PEM format using the PKCS#1 standard.
generateEcKeyPair({String curve = 'prime256v1'}) → AsymmetricKeyPair<PublicKey, PrivateKey>
Generates a elliptic curve AsymmetricKeyPair.
generateRSAKeyPair({int keySize = 2048}) → AsymmetricKeyPair<PublicKey, PrivateKey>
Generates a RSA AsymmetricKeyPair with the given keySize. The default value for the keySize is 2048 bits.
getBytesFromPEMString(String pem) Uint8List
Helper function for decoding the base64 in pem.
getHash(Uint8List bytes, {String algorithmName = 'SHA-256'}) String
Get a hash for the given bytes using the given algorithm
getHashPlain(Uint8List bytes, {String algorithmName = 'SHA-256'}) Uint8List
Get a hash for the given bytes using the given algorithm
getMd5ThumbprintFromBytes(Uint8List bytes) String
Get a MD5 Thumbprint for the given bytes.
getModulusFromRSAPrivateKeyPem(String pem) BigInt
Returns the modulus of the given pem that represents an RSA private key.
getSha1ThumbprintFromBytes(Uint8List bytes) String
Get a SHA1 Thumbprint for the given bytes.
getSha256ThumbprintFromBytes(Uint8List bytes) String
Get a SHA256 Thumbprint for the given bytes.
rsaDecrypt(String cipherMessage, RSAPrivateKey privateKey) String
Decrypt the given cipherMessage using the given RSA privateKey.
rsaEncrypt(String message, RSAPublicKey publicKey) String
Encrypt the given message using the given RSA publicKey.
rsaPrivateKeyExponentToBytes(RSAPrivateKey privateKey) Uint8List
Converts the RSAPrivateKey.exponent from the given privateKey to a Uint8List.
rsaPrivateKeyFromDERBytes(Uint8List bytes) → RSAPrivateKey
Decode the given bytes into an RSAPrivateKey.
rsaPrivateKeyFromDERBytesPkcs1(Uint8List bytes) → RSAPrivateKey
Decode the given bytes into an RSAPrivateKey.
rsaPrivateKeyFromPem(String pem) → RSAPrivateKey
Decode a RSAPrivateKey from the given pem String.
rsaPrivateKeyFromPemPkcs1(String pem) → RSAPrivateKey
Decode a RSAPrivateKey from the given pem string formated in the pkcs1 standard.
rsaPrivateKeyModulusToBytes(RSAPrivateKey privateKey) Uint8List
Converts the RSAPrivateKey.modulus from the given privateKey to a Uint8List.
rsaPublicKeyExponentToBytes(RSAPublicKey publicKey) Uint8List
Converts the RSAPublicKey.exponent from the given publicKey to a Uint8List.
rsaPublicKeyFromDERBytes(Uint8List bytes) → RSAPublicKey
Decode the given bytes into an RSAPublicKey.
rsaPublicKeyFromDERBytesPkcs1(Uint8List bytes) → RSAPublicKey
Decode the given bytes into an RSAPublicKey.
rsaPublicKeyFromPem(String pem) → RSAPublicKey
Decode a RSAPublicKey from the given pem String.
rsaPublicKeyFromPemPkcs1(String pem) → RSAPublicKey
Decode a RSAPublicKey from the given pem string formated in the pkcs1 standard.
rsaPublicKeyModulusToBytes(RSAPublicKey publicKey) Uint8List
Converts the RSAPublicKey.modulus from the given publicKey to a Uint8List.
rsaSign(RSAPrivateKey privateKey, Uint8List dataToSign, {String algorithmName = 'SHA-256/RSA'}) Uint8List
Signing the given dataToSign with the given privateKey.
rsaVerify(RSAPublicKey publicKey, Uint8List signedData, Uint8List signature, {String algorithm = 'SHA-256/RSA'}) bool
Verifying the given signedData with the given publicKey and the given signature. Will return true if the given signature matches the signedData.