[][src]Module openssl::rsa

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.


extern crate openssl;

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

fn main() {
    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