Skip to main content

SgxRsaOps

Trait 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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§