- Index
- »
- fan.crypto
- »
- PrivKey
PrivKey
const mixin PrivKey : AsymKey
A private key in an asymmetric key pair. A private key can be used to sign and decrypt data.
Sign the contents of the data buffer after applying the given digest algorithm and return the signature
Decrypt the contents of the data buffer and return the result
abstract Buf decrypt(Buf data, Str padding)
Decrypt the contents of the data buffer and return the result. Throws Err if the decryption fails for any reason.
msg := privKey.decrypt(encrypted)
abstract Buf sign(Buf data, Str digest)
Sign the contents of the data buffer after applying the given digest algorithm and return the signature. Throws Err if the digest algorithm is not supported.
signature := privKey.sign("Message".toBuf, "SHA512")