[][src]Trait sgxs::crypto::SgxRsaOps

pub trait SgxRsaOps {
    type Error: Error;
    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>; }

Associated Types

type Error: Error

Loading content...

Required methods

fn len(&self) -> usize

Return the number of bits in the RSA key

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.

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.

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

Retrieve the public key in little-endian format

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

Retrieve the modulus in little-endian format

Loading content...

Implementors

Loading content...