hypersig/key
Types
pub type KeyError {
UnexpectedKeyFormat
ExpectedPublicKey
ExpectedPrivateKey
RuntimeError(String)
}
Constructors
-
UnexpectedKeyFormat -
ExpectedPublicKey -
ExpectedPrivateKey -
RuntimeError(String)
pub type PrivateKey
Values
pub fn decode_private(
pem: String,
) -> Result(PrivateKey, KeyError)
Decode a PEM encoded RSA private key
pub fn decode_public(pem: String) -> Result(PublicKey, KeyError)
Decode a PEM encoded RSA public key
pub fn encode_private(key: PrivateKey) -> String
Encode a private key to a PEM string
pub fn encode_public(key: PublicKey) -> String
Encode a public key to a PEM string
pub fn generate_key_pair() -> Result(
#(PublicKey, PrivateKey),
KeyError,
)
Generate a new pair of RSA keys
pub fn sign(
message msg: String,
with key: PrivateKey,
) -> Result(String, KeyError)
Signs a message and returns the signature in a base64 encoded string