Expand description
§RustCrypto: Ed448 signatures
Edwards Digital Signature Algorithm (EdDSA) over Curve448 as specified in RFC 7748.
§About
This crate doesn’t contain an implementation of Ed448, but instead
contains an ed448::Signature type which other crates can use in
conjunction with the signature::Signer and signature::Verifier
traits.
These traits allow crates which produce and consume Ed448 signatures to be written abstractly in such a way that different signer/verifier providers can be plugged in, enabling support for using different Ed448 implementations, including HSMs or Cloud KMS services.
§SemVer Policy
- All on-by-default features of this library are covered by
SemVer - MSRV is considered exempt from SemVer as noted above
- The
pkcs8module is exempted as it uses a pre-1.0 dependency, however, breaking changes to this module will be accompanied by a minor version bump.
§License
All crates licensed under either of
at your option.
§Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
§Using Ed448 generically over algorithm implementations/providers
By using the ed448 crate, you can write code which signs and verifies
messages using the Ed448 signature algorithm generically over any
supported Ed448 implementation (see the next section for available
providers).
This allows consumers of your code to plug in whatever implementation they want to use without having to add all potential Ed448 libraries you’d like to support as optional dependencies.
§Example
use ed448::signature::{Signer, Verifier};
pub struct HelloSigner<S>
where
S: Signer<ed448::Signature>
{
pub signing_key: S
}
impl<S> HelloSigner<S>
where
S: Signer<ed448::Signature>
{
pub fn sign(&self, person: &str) -> ed448::Signature {
// NOTE: use `try_sign` if you'd like to be able to handle
// errors from external signing services/devices (e.g. HSM/KMS)
// <https://docs.rs/signature/latest/signature/trait.Signer.html#tymethod.try_sign>
self.signing_key.sign(format_message(person).as_bytes())
}
}
pub struct HelloVerifier<V> {
pub verifying_key: V
}
impl<V> HelloVerifier<V>
where
V: Verifier<ed448::Signature>
{
pub fn verify(
&self,
person: &str,
signature: &ed448::Signature
) -> Result<(), ed448::Error> {
self.verifying_key.verify(format_message(person).as_bytes(), signature)
}
}
fn format_message(person: &str) -> String {
format!("Hello, {}!", person)
}Re-exports§
pub use crate::pkcs8::KeypairBytes;pkcs8pub use crate::pkcs8::PublicKeyBytes;pkcs8pub use signature;
Modules§
- pkcs8
pkcs8 - PKCS#8 private key support.
Structs§
- AnyRef
pkcs8 - ASN.1
ANY: represents any explicitly tagged ASN.1 value. - Error
- Signature errors.
- Object
Identifier pkcs8 - Object identifier (OID).
- Signature
- Ed448 signature.
Constants§
- COMPONENT_
SIZE - Size of a single component of an Ed448 signature.
Traits§
- Associated
Algorithm Identifier pkcs8 - Returns
AlgorithmIdentifierassociated with the structure. - Signature
Encoding - Support for decoding/encoding signatures as bytes.
Type Aliases§
- Algorithm
Identifier Ref pkcs8 AlgorithmIdentifierreference which hasAnyRefparameters.- Component
Bytes - Size of an
Rorscomponent of an Ed448 signature when serialized as bytes. - Signature
Bytes - Ed448 signature serialized as a byte array.