Enum kvarn_auth::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.
RSASha256
Fields
§
private_key: RsaPrivateKey
The RSA public key to sign with.
Available on crate feature
rsa
only.Sign using RSA.
EcdsaP256
Fields
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, and takes up 70% less space than RSA. It’s also takes any byte array as a secret.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for CryptoAlgo
impl Send for CryptoAlgo
impl Sync for CryptoAlgo
impl Unpin for CryptoAlgo
impl UnwindSafe for CryptoAlgo
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more