Loading openssl/src/envelope.rs +9 −11 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ //! use openssl::pkey::PKey; //! use openssl::symm::Cipher; //! //! fn main() { //! let rsa = Rsa::generate(2048).unwrap(); //! let key = PKey::from_rsa(rsa).unwrap(); //! Loading @@ -21,7 +20,6 @@ //! let mut enc_len = seal.update(secret, &mut encrypted).unwrap(); //! enc_len += seal.finalize(&mut encrypted[enc_len..]).unwrap(); //! encrypted.truncate(enc_len); //! } //! ``` use crate::error::ErrorStack; use crate::pkey::{HasPrivate, HasPublic, PKey, PKeyRef}; Loading openssl/src/pkey.rs +4 −6 Original line number Diff line number Diff line Loading @@ -33,13 +33,11 @@ //! use openssl::pkey::PKey; //! use std::str; //! //! fn main() { //! let rsa = Rsa::generate(2048).unwrap(); //! let pkey = PKey::from_rsa(rsa).unwrap(); //! //! let pub_key: Vec<u8> = pkey.public_key_to_pem().unwrap(); //! println!("{:?}", str::from_utf8(pub_key.as_slice()).unwrap()); //! } //! ``` use foreign_types::{ForeignType, ForeignTypeRef}; Loading openssl/src/rsa.rs +4 −6 Original line number Diff line number Diff line Loading @@ -18,12 +18,10 @@ //! ```rust //! 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(); //! } //! ``` use foreign_types::{ForeignType, ForeignTypeRef}; use libc::c_int; Loading openssl/src/sha.rs +7 −11 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ //! ```rust //! use openssl::sha; //! //! fn main() { //! let mut hasher = sha::Sha256::new(); //! //! hasher.update(b"Hello, "); Loading @@ -24,7 +23,6 @@ //! //! let hash = hasher.finish(); //! println!("Hashed \"Hello, world\" to {}", hex::encode(hash)); //! } //! ``` //! //! On the other hand, if you already have access to all of the data you woud like to hash, you Loading @@ -34,10 +32,8 @@ //! ```rust //! use openssl::sha::sha256; //! //! fn main() { //! let hash = sha256(b"your data or message"); //! println!("Hash = {}", hex::encode(hash)); //! } //! ``` use libc::c_void; use std::mem; Loading openssl/src/x509/extension.rs +3 −5 Original line number Diff line number Diff line Loading @@ -11,12 +11,10 @@ //! use openssl::x509::extension::BasicConstraints; //! use openssl::x509::X509Extension; //! //! fn main() { //! let mut bc = BasicConstraints::new(); //! let bc = bc.critical().ca().pathlen(1); //! //! let extension: X509Extension = bc.build().unwrap(); //! } //! ``` use std::fmt::Write; Loading Loading
openssl/src/envelope.rs +9 −11 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ //! use openssl::pkey::PKey; //! use openssl::symm::Cipher; //! //! fn main() { //! let rsa = Rsa::generate(2048).unwrap(); //! let key = PKey::from_rsa(rsa).unwrap(); //! Loading @@ -21,7 +20,6 @@ //! let mut enc_len = seal.update(secret, &mut encrypted).unwrap(); //! enc_len += seal.finalize(&mut encrypted[enc_len..]).unwrap(); //! encrypted.truncate(enc_len); //! } //! ``` use crate::error::ErrorStack; use crate::pkey::{HasPrivate, HasPublic, PKey, PKeyRef}; Loading
openssl/src/pkey.rs +4 −6 Original line number Diff line number Diff line Loading @@ -33,13 +33,11 @@ //! use openssl::pkey::PKey; //! use std::str; //! //! fn main() { //! let rsa = Rsa::generate(2048).unwrap(); //! let pkey = PKey::from_rsa(rsa).unwrap(); //! //! let pub_key: Vec<u8> = pkey.public_key_to_pem().unwrap(); //! println!("{:?}", str::from_utf8(pub_key.as_slice()).unwrap()); //! } //! ``` use foreign_types::{ForeignType, ForeignTypeRef}; Loading
openssl/src/rsa.rs +4 −6 Original line number Diff line number Diff line Loading @@ -18,12 +18,10 @@ //! ```rust //! 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(); //! } //! ``` use foreign_types::{ForeignType, ForeignTypeRef}; use libc::c_int; Loading
openssl/src/sha.rs +7 −11 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ //! ```rust //! use openssl::sha; //! //! fn main() { //! let mut hasher = sha::Sha256::new(); //! //! hasher.update(b"Hello, "); Loading @@ -24,7 +23,6 @@ //! //! let hash = hasher.finish(); //! println!("Hashed \"Hello, world\" to {}", hex::encode(hash)); //! } //! ``` //! //! On the other hand, if you already have access to all of the data you woud like to hash, you Loading @@ -34,10 +32,8 @@ //! ```rust //! use openssl::sha::sha256; //! //! fn main() { //! let hash = sha256(b"your data or message"); //! println!("Hash = {}", hex::encode(hash)); //! } //! ``` use libc::c_void; use std::mem; Loading
openssl/src/x509/extension.rs +3 −5 Original line number Diff line number Diff line Loading @@ -11,12 +11,10 @@ //! use openssl::x509::extension::BasicConstraints; //! use openssl::x509::X509Extension; //! //! fn main() { //! let mut bc = BasicConstraints::new(); //! let bc = bc.critical().ca().pathlen(1); //! //! let extension: X509Extension = bc.build().unwrap(); //! } //! ``` use std::fmt::Write; Loading