[][src]Trait sgx_crypto_helper::RsaKeyPair

pub trait RsaKeyPair {
    fn new() -> SgxResult<Self>
    where
        Self: Sized
;
fn new_with_e(e: u32) -> SgxResult<Self>
    where
        Self: Sized
;
fn to_privkey(self) -> SgxResult<SgxRsaPrivKey>;
fn to_pubkey(self) -> SgxResult<SgxRsaPubKey>;
fn encrypt_buffer(
        self,
        plaintext: &[u8],
        ciphertext: &mut Vec<u8>
    ) -> SgxResult<usize>;
fn decrypt_buffer(
        self,
        ciphertext: &[u8],
        plaintext: &mut Vec<u8>
    ) -> SgxResult<usize>; }

A trait to express the ability to create a RSA keypair with default e (65537) or customized e, and to_privkey/to_pubkey, encryption/decryption API.

Required methods

fn new() -> SgxResult<Self> where
    Self: Sized

Create a new RSA keypair with default e = 65537.

fn new_with_e(e: u32) -> SgxResult<Self> where
    Self: Sized

Create a new RSA keypair with customized e

fn to_privkey(self) -> SgxResult<SgxRsaPrivKey>

Get a private key instance typed SgxRsaPrivKey which is defined in sgx_tcrypto/sgx_ucrypto.

fn to_pubkey(self) -> SgxResult<SgxRsaPubKey>

get a public key instance typed SgxPubPrivKey which is defined in sgx_tcrypto/sgx_ucrypto.

fn encrypt_buffer(
    self,
    plaintext: &[u8],
    ciphertext: &mut Vec<u8>
) -> SgxResult<usize>

Encrypt a u8 slice to a Vec. Returns the length of ciphertext if OK.

fn decrypt_buffer(
    self,
    ciphertext: &[u8],
    plaintext: &mut Vec<u8>
) -> SgxResult<usize>

Decrypt a u8 slice to a Vec. Returns the length of plaintext if OK.

Loading content...

Implementors

impl RsaKeyPair for Rsa2048KeyPair[src]

impl RsaKeyPair for Rsa3072KeyPair[src]

Loading content...