const SHA1
pub const SHA1 = 3Purpose
Constant SHA1, defining protocol or algorithm parameters.
#crypto/rsaPKCS#1 v1.5 encrypt and sign. No OAEP/PSS.
const SHA1pub const SHA1 = 3Constant SHA1, defining protocol or algorithm parameters.
const SHA256pub const SHA256 = 5Constant SHA256, defining protocol or algorithm parameters.
const SHA384pub const SHA384 = 6Constant SHA384, defining protocol or algorithm parameters.
const SHA512pub const SHA512 = 7Constant SHA512, defining protocol or algorithm parameters.
struct PublicKeypub struct PublicKey {
pub n big.Int
pub e int
}Structure encapsulating n, e.
n big.Inte intstruct PrivateKeypub struct PrivateKey {
pub public PublicKey
pub d big.Int
pub p big.Int
pub q big.Int
}Structure encapsulating public, d, p, q.
public PublicKeyd big.Intp big.Intq big.Int(&PublicKey) sizepub fn (pk &PublicKey) size() intOperation on &PublicKey: return the size.
pk &PublicKeyPublicKey instance used by this call (borrow).int — a value of this type
rsa_priv_oppub fn rsa_priv_op(priv &PrivateKey, c &big.Int) big.IntRsa priv op. Throws on failure; handle the error or propagate it to the caller.
priv &PrivateKeyc &big.Intbig.Int — a value of this type
encrypt_pkcs1v15pub fn encrypt_pkcs1v15(pk &PublicKey, msg &string) stringEncrypt pkcs1v15. Throws on failure; handle the error or propagate it to the caller.
pk &PublicKeymsg &stringstring — result string
decrypt_pkcs1v15pub fn decrypt_pkcs1v15(priv &PrivateKey, ciphertext &string) stringDecrypt pkcs1v15. Throws on failure; handle the error or propagate it to the caller.
priv &PrivateKeyciphertext &stringstring — result string
decrypt_pkcs1v15_session_keypub fn decrypt_pkcs1v15_session_key(priv &PrivateKey, ciphertext &string, key_len int) stringdecrypt_pkcs1v15_session_key decrypts a fixed-length PKCS#1 v1.5 session key (such as a 48-byte TLS pre-master secret) in constant time without leaking padding validity, substituting a random key on invalid padding. Throws on failure; handle the error or propagate it to the caller.
priv &PrivateKeyciphertext &stringkey_len intstring — result string
sign_pkcs1v15pub fn sign_pkcs1v15(priv &PrivateKey, hash int, hashed &string) stringSign pkcs1v15. Throws on failure; handle the error or propagate it to the caller.
priv &PrivateKeyhash inthashed &stringstring — result string
verify_pkcs1v15pub fn verify_pkcs1v15(pk &PublicKey, hash int, hashed &string, sig &string) intVerify pkcs1v15. Throws on failure; handle the error or propagate it to the caller.
pk &PublicKeyhash inthashed &stringsig &stringint — a value of this type
generate_keypub fn generate_key(bits int) PrivateKeyGenerate key. Throws on failure; handle the error or propagate it to the caller.
bits intPrivateKey — a value of this type