pingora_boringssl::ssl

Trait AsyncPrivateKeyMethod

Source
pub trait AsyncPrivateKeyMethod:
    Send
    + Sync
    + 'static {
    // Required methods
    fn sign(
        &self,
        ssl: &mut SslRef,
        input: &[u8],
        signature_algorithm: SslSignatureAlgorithm,
        output: &mut [u8],
    ) -> Result<Pin<Box<dyn Future<Output = Result<Box<dyn FnOnce(&mut SslRef, &mut [u8]) -> Result<usize, AsyncPrivateKeyMethodError>>, AsyncPrivateKeyMethodError>> + Send>>, AsyncPrivateKeyMethodError>;
    fn decrypt(
        &self,
        ssl: &mut SslRef,
        input: &[u8],
        output: &mut [u8],
    ) -> Result<Pin<Box<dyn Future<Output = Result<Box<dyn FnOnce(&mut SslRef, &mut [u8]) -> Result<usize, AsyncPrivateKeyMethodError>>, AsyncPrivateKeyMethodError>> + Send>>, AsyncPrivateKeyMethodError>;
}
Expand description

Describes async private key hooks. This is used to off-load signing operations to a custom, potentially asynchronous, backend. Metadata about the key such as the type and size are parsed out of the certificate.

See PrivateKeyMethod for the sync version of those hooks.

Required Methods§

Source

fn sign( &self, ssl: &mut SslRef, input: &[u8], signature_algorithm: SslSignatureAlgorithm, output: &mut [u8], ) -> Result<Pin<Box<dyn Future<Output = Result<Box<dyn FnOnce(&mut SslRef, &mut [u8]) -> Result<usize, AsyncPrivateKeyMethodError>>, AsyncPrivateKeyMethodError>> + Send>>, AsyncPrivateKeyMethodError>

Signs the message input using the specified signature algorithm.

This method uses a function that returns a future whose output is itself a closure that will be passed ssl and output to finish writing the signature.

See PrivateKeyMethod::sign for the sync version of this method.

Source

fn decrypt( &self, ssl: &mut SslRef, input: &[u8], output: &mut [u8], ) -> Result<Pin<Box<dyn Future<Output = Result<Box<dyn FnOnce(&mut SslRef, &mut [u8]) -> Result<usize, AsyncPrivateKeyMethodError>>, AsyncPrivateKeyMethodError>> + Send>>, AsyncPrivateKeyMethodError>

Decrypts input.

This method uses a function that returns a future whose output is itself a closure that will be passed ssl and output to finish decrypting the input.

See PrivateKeyMethod::decrypt for the sync version of this method.

Implementors§