[][src]Module nettle::rsa

The Rivest, Shamir, Adelman (RSA) cryptosystem.

Structs

PrivateKey

A private RSA key.

PublicKey

A public RSA key.

Constants

ASN1_OID_MD2

ASN.1 OID for MD2

ASN1_OID_MD5

ASN.1 OID for MD5

ASN1_OID_RIPEMD160

ASN.1 OID for RipeMD160

ASN1_OID_SHA1

ASN.1 OID for SHA1

ASN1_OID_SHA224

ASN.1 OID for SHA224

ASN1_OID_SHA256

ASN.1 OID for SHA256

ASN1_OID_SHA384

ASN.1 OID for SHA384

ASN1_OID_SHA512

ASN.1 OID for SHA512

Traits

Pkcs1Hash

Marker trait for hash algorithms usable for PKCS#1 signatures.

PssHash

A hash function usable for PSS.

Functions

decrypt_pkcs1

Decrypts ciphertext using public/private. Returns the resulting plaintext.

decrypt_pkcs1_insecure

Decrypts ciphertext using public/private. Returns the resulting plaintext.

encrypt_pkcs1

Encrypts plaintext using public, producing ciphertext. ciphertext must have the same size as the modulo of public.

generate_keypair

Generates a fresh RSA key pair usable for signing and encryption. The public modulo n will be modulo_size bits large. The public exponent is fixed to 0x10001.

sign_digest_pkcs1

Creates a PKCS#1.5 padded RSA signature for digest_info || digest.

sign_pkcs1

Signs the message hashed with hash using public/private, producing signature. The signature buffer is expected to be of the size of the modulo of public.

sign_pss

Signs the message hashed by hash using salt and the key pair public/private, producing signature. Expects signature to be the size of the modulo of public.

verify_digest_pkcs1

Verifies a PKCS#1.5 padded RSA signature for digest_info || digest.

verify_pkcs1

Verifies signature of the data hashed by hash using public. Returns true if the signature is valid.

verify_pss

Verifies signature of the data hashed by hash using a salt of salt_len bytes and the key public. Returns true if the signature is valid.