Module openssl::bn[][src]

Expand description

BigNum implementation

Large numbers are important for a cryptographic library. OpenSSL implementation of BigNum uses dynamically assigned memory to store an array of bit chunks. This allows numbers of any size to be compared and mathematical functions performed.

OpenSSL wiki describes the BIGNUM data structure.


use openssl::bn::BigNum;
use openssl::error::ErrorStack;

fn main() -> Result<(), ErrorStack> {
  let a = BigNum::new()?; // a = 0
  let b = BigNum::from_dec_str("1234567890123456789012345")?;
  let c = &a * &b;
  assert_eq!(a, c);


Dynamically sized large number implementation

Temporary storage for BigNums on the secure heap

Reference to a BigNum

Options for the most significant bits of a randomly generated BigNum.