[][src]Struct jsonwebtoken::EncodingKey

pub struct EncodingKey { /* fields omitted */ }

A key to encode a JWT with. Can be a secret, a PEM-encoded key or a DER-encoded key. This key can be re-used so make sure you only initialize it once if you can for better performance

Methods

impl EncodingKey[src]

pub fn from_secret(secret: &[u8]) -> Self[src]

If you're using a HMAC secret that is not base64, use that.

pub fn from_base64_secret(secret: &str) -> Result<Self>[src]

If you have a base64 HMAC secret, use that.

pub fn from_rsa_pem(key: &[u8]) -> Result<Self>[src]

If you are loading a RSA key from a .pem file. This errors if the key is not a valid RSA key.

pub fn from_ec_pem(key: &[u8]) -> Result<Self>[src]

If you are loading a ECDSA key from a .pem file This errors if the key is not a valid private EC key

pub fn from_rsa_der(der: &[u8]) -> Self[src]

If you know what you're doing and have the DER-encoded key, for RSA only

pub fn from_ec_der(der: &[u8]) -> Self[src]

If you know what you're doing and have the DER-encoded key, for ECDSA

Trait Implementations

impl Clone for EncodingKey[src]

impl Debug for EncodingKey[src]

impl PartialEq<EncodingKey> for EncodingKey[src]

impl StructuralPartialEq for EncodingKey[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.