const mixin crypto::PrivKey

crypto::PrivKey : crypto::AsymKey

Source

A private key in an asymmetric key pair. A private key can be used to sign and decrypt data.

decrypt

abstract Buf decrypt(Buf data, Str padding := "PKCS1Padding")

Source

Decrypt the contents of the data buffer and return the result. Throws Err if the decryption fails for any reason.

msg := privKey.decrypt(encrypted)
sign

abstract Buf sign(Buf data, Str digest)

Source

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")