Enum Algorithm

Source
pub enum Algorithm {
Show 21 variants HS256, HS384, HS512, RS256, RS384, RS512, PS256, PS384, PS512, EdDSA, EdBlake2b, ES256, ES384, ES256K, ES256KR, ESKeccakK, ESKeccakKR, ESBlake2b, ESBlake2bK, Bbs, None, // some variants omitted
}
Expand description

Signature algorithm.

Variants§

§

HS256

§

HS384

§

HS512

§

RS256

RSASSA-PKCS1-v1_5 using SHA-256.

See: https://www.rfc-editor.org/rfc/rfc7518.txt

§

RS384

RSASSA-PKCS1-v1_5 using SHA-384.

See: https://www.rfc-editor.org/rfc/rfc7518.txt

§

RS512

RSASSA-PKCS1-v1_5 using SHA-512.

See: https://www.rfc-editor.org/rfc/rfc7518.txt

§

PS256

RSASSA-PSS using SHA-256 and MGF1 with SHA-256.

See: https://www.rfc-editor.org/rfc/rfc7518.txt

§

PS384

RSASSA-PSS using SHA-384 and MGF1 with SHA-384.

See: https://www.rfc-editor.org/rfc/rfc7518.txt

§

PS512

RSASSA-PSS using SHA-512 and MGF1 with SHA-512.

See: https://www.rfc-editor.org/rfc/rfc7518.txt

§

EdDSA

Edwards-curve Digital Signature Algorithm (EdDSA) using SHA-256.

The following curves are defined for use with EdDSA:

  • Ed25519
  • Ed448

See: https://www.rfc-editor.org/rfc/rfc8037

§

EdBlake2b

EdDSA using SHA-256 and Blake2b as pre-hash function.

§

ES256

ECDSA using P-256 and SHA-256.

See: https://www.rfc-editor.org/rfc/rfc7518.txt

§

ES384

ECDSA using P-384 and SHA-384.

See: https://www.rfc-editor.org/rfc/rfc7518.txt

§

ES256K

ECDSA using secp256k1 (K-256) and SHA-256.

See: https://datatracker.ietf.org/doc/html/rfc8812

§

ES256KR

ECDSA using secp256k1 (K-256) and SHA-256 with a recovery bit.

ES256K-R is similar to ES256K with the recovery bit appended, making the signature 65 bytes instead of 64. The recovery bit is used to extract the public key from the signature.

See: https://github.com/decentralized-identity/EcdsaSecp256k1RecoverySignature2020#es256k-r

§

ESKeccakK

ECDSA using secp256k1 (K-256) and Keccak-256.

Like ES256K but using Keccak-256 instead of SHA-256.

§

ESKeccakKR

ECDSA using secp256k1 (K-256) and Keccak-256 with a recovery bit.

Like ES256K-R but using Keccak-256 instead of SHA-256.

§

ESBlake2b

ECDSA using P-256 and Blake2b.

§

ESBlake2bK

ECDSA using secp256k1 (K-256) and Blake2b.

§

Bbs

BBS scheme.

§

None

No signature.

Per the specs it should only be none but None is kept for backwards compatibility.

Implementations§

Source§

impl Algorithm

Source

pub fn as_str(&self) -> &'static str

Source

pub fn into_str(self) -> &'static str

Source§

impl Algorithm

Source

pub fn is_compatible_with(&self, other: Self) -> bool

Checks if this algorithm is compatible with the other algorithm.

An algorithm A is compatible with B if A can be used to verify a signature created from B.

Trait Implementations§

Source§

impl AsRef<str> for Algorithm

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Algorithm

Source§

fn clone(&self) -> Algorithm

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Algorithm

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Algorithm

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Algorithm

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Algorithm

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<AleoTestnet1Signature> for Algorithm

Source§

fn from(_a: AleoTestnet1Signature) -> Self

Converts to this type from the input type.
Source§

impl From<AnyBlake2b> for Algorithm

Source§

fn from(value: AnyBlake2b) -> Self

Converts to this type from the input type.
Source§

impl From<AnyES> for Algorithm

Source§

fn from(value: AnyES) -> Self

Converts to this type from the input type.
Source§

impl From<AnyES256K> for Algorithm

Source§

fn from(value: AnyES256K) -> Self

Converts to this type from the input type.
Source§

impl From<AnyESKeccakK> for Algorithm

Source§

fn from(value: AnyESKeccakK) -> Self

Converts to this type from the input type.
Source§

impl From<Bbs> for Algorithm

Source§

fn from(_a: Bbs) -> Self

Converts to this type from the input type.
Source§

impl From<ES256> for Algorithm

Source§

fn from(_a: ES256) -> Self

Converts to this type from the input type.
Source§

impl From<ES256K> for Algorithm

Source§

fn from(_a: ES256K) -> Self

Converts to this type from the input type.
Source§

impl From<ES256KR> for Algorithm

Source§

fn from(_a: ES256KR) -> Self

Converts to this type from the input type.
Source§

impl From<ES256OrES384> for Algorithm

Source§

fn from(value: ES256OrES384) -> Self

Converts to this type from the input type.
Source§

impl From<ES384> for Algorithm

Source§

fn from(_a: ES384) -> Self

Converts to this type from the input type.
Source§

impl From<ESBlake2b> for Algorithm

Source§

fn from(_a: ESBlake2b) -> Self

Converts to this type from the input type.
Source§

impl From<ESBlake2bK> for Algorithm

Source§

fn from(_a: ESBlake2bK) -> Self

Converts to this type from the input type.
Source§

impl From<ESKeccakK> for Algorithm

Source§

fn from(_a: ESKeccakK) -> Self

Converts to this type from the input type.
Source§

impl From<ESKeccakKR> for Algorithm

Source§

fn from(_a: ESKeccakKR) -> Self

Converts to this type from the input type.
Source§

impl From<EdBlake2b> for Algorithm

Source§

fn from(_a: EdBlake2b) -> Self

Converts to this type from the input type.
Source§

impl From<EdDSA> for Algorithm

Source§

fn from(_a: EdDSA) -> Self

Converts to this type from the input type.
Source§

impl From<HS256> for Algorithm

Source§

fn from(_a: HS256) -> Self

Converts to this type from the input type.
Source§

impl From<HS384> for Algorithm

Source§

fn from(_a: HS384) -> Self

Converts to this type from the input type.
Source§

impl From<HS512> for Algorithm

Source§

fn from(_a: HS512) -> Self

Converts to this type from the input type.
Source§

impl From<PS256> for Algorithm

Source§

fn from(_a: PS256) -> Self

Converts to this type from the input type.
Source§

impl From<PS384> for Algorithm

Source§

fn from(_a: PS384) -> Self

Converts to this type from the input type.
Source§

impl From<PS512> for Algorithm

Source§

fn from(_a: PS512) -> Self

Converts to this type from the input type.
Source§

impl From<RS256> for Algorithm

Source§

fn from(_a: RS256) -> Self

Converts to this type from the input type.
Source§

impl From<RS384> for Algorithm

Source§

fn from(_a: RS384) -> Self

Converts to this type from the input type.
Source§

impl From<RS512> for Algorithm

Source§

fn from(_a: RS512) -> Self

Converts to this type from the input type.
Source§

impl Hash for Algorithm

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Algorithm

Source§

fn eq(&self, other: &Algorithm) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Algorithm

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl SignatureAlgorithmType for Algorithm

Source§

impl TryFrom<Algorithm> for AleoTestnet1Signature

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for AnyBlake2b

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(value: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for AnyES

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(value: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for AnyES256K

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(value: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for AnyESKeccakK

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(value: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for Bbs

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for ES256

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for ES256K

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for ES256KR

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for ES384

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for ESBlake2b

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for ESBlake2bK

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for ESKeccakK

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for ESKeccakKR

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for EdBlake2b

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for EdDSA

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for HS256

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for HS384

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for HS512

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for PS256

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for PS384

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for PS512

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for RS256

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for RS384

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Algorithm> for RS512

Source§

type Error = UnsupportedAlgorithm

The type returned in the event of a conversion error.
Source§

fn try_from(a: Algorithm) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for Algorithm

Source§

impl Eq for Algorithm

Source§

impl StructuralPartialEq for Algorithm

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,