Module rsa

Expand description

Rivest–Shamir–Adleman cryptosystem

RSA is one of the earliest asymmetric public key encryption schemes. Like many other cryptosystems, RSA relies on the presumed difficulty of a hard mathematical problem, namely factorization of the product of two large prime numbers. At the moment there does not exist an algorithm that can factor such large numbers in reasonable time. RSA is used in a wide variety of applications including digital signatures and key exchanges such as establishing a TLS/SSL connection.

The RSA acronym is derived from the first letters of the surnames of the algorithm’s founding trio.

§Example

Generate a 2048-bit RSA key pair and use the public key to encrypt some data.

use rama_boring::rsa::{Rsa, Padding};

let rsa = Rsa::generate(2048).unwrap();
let data = b"foobar";
let mut buf = vec![0; rsa.size() as usize];
let encrypted_len = rsa.public_encrypt(data, &mut buf, Padding::PKCS1).unwrap();

Structs§

Padding
Type of encryption padding to use.
Rsa
An RSA key.
RsaPrivateKeyBuilder
RsaRef
Reference to RSA

Constants§

EVP_PKEY_OP_DECRYPT
EVP_PKEY_OP_ENCRYPT
EVP_PKEY_OP_SIGN
EVP_PKEY_OP_SIGNCTX
EVP_PKEY_OP_TYPE_CRYPT
EVP_PKEY_OP_TYPE_SIG
EVP_PKEY_OP_VERIFY
EVP_PKEY_OP_VERIFYCTX
EVP_PKEY_OP_VERIFYRECOVER