Trait sgxs::crypto::SgxRsaOps

source ·
pub trait SgxRsaOps {
    type Error: Error;

    // Required methods
    fn len(&self) -> usize;
    fn sign_sha256_pkcs1v1_5_with_q1_q2<H: AsRef<[u8]>>(
        &self,
        hash: H
    ) -> Result<(Vec<u8>, Vec<u8>, Vec<u8>), Self::Error>;
    fn verify_sha256_pkcs1v1_5<S: AsRef<[u8]>, H: AsRef<[u8]>>(
        &self,
        sig: S,
        hash: H
    ) -> Result<(), Self::Error>;
    fn e(&self) -> Vec<u8>;
    fn n(&self) -> Vec<u8>;
}

Required Associated Types§

Required Methods§

source

fn len(&self) -> usize

Return the number of bits in the RSA key

source

fn sign_sha256_pkcs1v1_5_with_q1_q2<H: AsRef<[u8]>>( &self, hash: H ) -> Result<(Vec<u8>, Vec<u8>, Vec<u8>), Self::Error>

Generate an RSASSA-PKCS1-v1_5 signature over a SHA256 hash. Also compute

  • q1 = s^2 / n
  • q2 = (s^3 - q1*s*n) / n where / is integer division.

Returns (s, q1, q2) in little-endian format.

§Panics

May panic if the input length is not 32, or if the key does not contain the private component.

source

fn verify_sha256_pkcs1v1_5<S: AsRef<[u8]>, H: AsRef<[u8]>>( &self, sig: S, hash: H ) -> Result<(), Self::Error>

Verify an RSASSA-PKCS1-v1_5 signature s over a SHA256 hash.

Supply s in little-endian format.

§Panics

May panic if the hash input length is not 32.

source

fn e(&self) -> Vec<u8>

Retrieve the public key exponent in little-endian format

source

fn n(&self) -> Vec<u8>

Retrieve the modulus in little-endian format

Object Safety§

This trait is not object safe.

Implementors§