[][src]Trait push::crypto::Cryptography

pub trait Cryptography {
    fn generate_key() -> Result<Key>;
fn test_key(priv_key: &str, pub_key: &str, auth: &str) -> Key;
fn decrypt(
        key: &Key,
        body: &str,
        encoding: &str,
        salt: Option<&str>,
        dh: Option<&str>
    ) -> Result<Decrypted>;
fn decrypt_aesgcm(
        key: &Key,
        content: &[u8],
        salt: Option<Vec<u8>>,
        crypto_key: Option<Vec<u8>>
    ) -> Result<Decrypted>;
fn decrypt_aes128gcm(key: &Key, content: &[u8]) -> Result<Decrypted>; }

Required methods

fn generate_key() -> Result<Key>

generate a new local EC p256 key

fn test_key(priv_key: &str, pub_key: &str, auth: &str) -> Key

create a test key for testing

fn decrypt(
    key: &Key,
    body: &str,
    encoding: &str,
    salt: Option<&str>,
    dh: Option<&str>
) -> Result<Decrypted>

General decrypt function. Calls to decrypt_aesgcm or decrypt_aes128gcm as needed.

fn decrypt_aesgcm(
    key: &Key,
    content: &[u8],
    salt: Option<Vec<u8>>,
    crypto_key: Option<Vec<u8>>
) -> Result<Decrypted>

Decrypt the obsolete "aesgcm" format (which is still used by a number of providers)

fn decrypt_aes128gcm(key: &Key, content: &[u8]) -> Result<Decrypted>

Decrypt the RFC 8188 format.

Loading content...

Implementors

impl Cryptography for Crypto[src]

fn generate_key() -> Result<Key>[src]

Generate a new cryptographic Key

fn decrypt(
    key: &Key,
    body: &str,
    encoding: &str,
    salt: Option<&str>,
    dh: Option<&str>
) -> Result<Decrypted>
[src]

Decrypt the incoming webpush message based on the content-encoding

Loading content...