kvarn_auth

Enum CryptoAlgo

source
pub enum CryptoAlgo {
    HmacSha256 {
        secret: Vec<u8>,
    },
    RSASha256 {
        private_key: RsaPrivateKey,
    },
    EcdsaP256 {
        secret: Vec<u8>,
    },
}
Expand description

The cryptographic algorithm to use to ensure the authenticity of the data.

I recommend ecdsa, as it’s the fastest and has support for validation mode. hmac is the most common algorithm used on the web right now, so it could be useful for compatibility.

Variants§

§

HmacSha256

Available on crate feature hmac only.

Sign using Hmac.

Fields

§secret: Vec<u8>

The Hmac secret to sign with.

§

RSASha256

Available on crate feature rsa only.

Sign using RSA.

Fields

§private_key: RsaPrivateKey

The RSA public key to sign with.

§

EcdsaP256

Available on crate feature ecdsa only.

Sign using Ecdsa.

This is the recommended algo, as it allows verification without the secret (see ecdsa_sk for more details on how to share the verification key) (RSA can also do this), is 1000x faster than RSA, a