Trait sui_crypto::Signer

pub trait Signer<S> {
    // Required method
    fn try_sign(&self, msg: &[u8]) -> Result<S, Error>;

    // Provided method
    fn sign(&self, msg: &[u8]) -> S { ... }
}
Expand description

Sign the provided message bytestring using Self (e.g. a cryptographic key or connection to an HSM), returning a digital signature.

Required Methods§

fn try_sign(&self, msg: &[u8]) -> Result<S, Error>

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong.

The main intended use case for signing errors is when communicating with external signers, e.g. cloud KMS, HSMs, or other hardware tokens.

Provided Methods§

fn sign(&self, msg: &[u8]) -> S

Sign the given message and return a digital signature

Implementations on Foreign Types§

§

impl Signer<Signature> for SigningKey

§

fn try_sign(&self, message: &[u8]) -> Result<Signature, Error>

Sign a message with this signing key’s secret key.

§

impl<C> Signer<(Signature<C>, RecoveryId)> for SigningKey<C>
where C: PrimeCurve + CurveArithmetic + DigestPrimitive, <C as CurveArithmetic>::Scalar: Invert<Output = CtOption<<C as CurveArithmetic>::Scalar>> + SignPrimitive<C>, <<C as Curve>::FieldBytesSize as Add>::Output: ArrayLength<u8>,

§

fn try_sign(&self, msg: &[u8]) -> Result<(Signature<C>, RecoveryId), Error>

§

impl<C> Signer<Signature<C>> for SigningKey<C>
where C: PrimeCurve + CurveArithmetic + DigestPrimitive, <C as CurveArithmetic>::Scalar: Invert<Output = CtOption<<C as CurveArithmetic>::Scalar>> + SignPrimitive<C>, <<C as Curve>::FieldBytesSize as Add>::Output: ArrayLength<u8> + Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>, <<<C as Curve>::FieldBytesSize as Add>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output: ArrayLength<u8>,

§

fn try_sign(&self, msg: &[u8]) -> Result<Signature<C>, Error>

§

impl<C> Signer<Signature<C>> for SigningKey<C>
where C: PrimeCurve + CurveArithmetic + DigestPrimitive, <C as CurveArithmetic>::Scalar: Invert<Output = CtOption<<C as CurveArithmetic>::Scalar>> + SignPrimitive<C>, <<C as Curve>::FieldBytesSize as Add>::Output: ArrayLength<u8>,

Sign message using a deterministic ephemeral scalar (k) computed using the algorithm described in RFC6979 § 3.2.

§

fn try_sign(&self, msg: &[u8]) -> Result<Signature<C>, Error>

§

impl<C> Signer<SignatureWithOid<C>> for SigningKey<C>
where C: PrimeCurve + CurveArithmetic + DigestPrimitive, <C as DigestPrimitive>::Digest: AssociatedOid, <C as CurveArithmetic>::Scalar: Invert<Output = CtOption<<C as CurveArithmetic>::Scalar>> + SignPrimitive<C>, <<C as Curve>::FieldBytesSize as Add>::Output: ArrayLength<u8>,

§

fn try_sign(&self, msg: &[u8]) -> Result<SignatureWithOid<C>, Error>

Implementors§

source§

impl Signer<SimpleSignature> for Ed25519PrivateKey

Available on crate feature ed25519 only.
source§

impl Signer<SimpleSignature> for Secp256k1PrivateKey

Available on crate feature secp256k1 only.
source§

impl Signer<SimpleSignature> for Secp256r1PrivateKey

Available on crate feature secp256r1 only.
source§

impl Signer<SimpleSignature> for SimpleKeypair

Available on (crate features ed25519 or secp256r1 or secp256k1) and (crate features ed25519 or secp256r1 or secp256k1 or zklogin) only.
source§

impl Signer<UserSignature> for Ed25519PrivateKey

Available on crate feature ed25519 only.
source§

impl Signer<UserSignature> for Secp256k1PrivateKey

Available on crate feature secp256k1 only.
source§

impl Signer<UserSignature> for Secp256r1PrivateKey

Available on crate feature secp256r1 only.
source§

impl Signer<UserSignature> for SimpleKeypair

Available on (crate features ed25519 or secp256r1 or secp256k1) and (crate features ed25519 or secp256r1 or secp256k1 or zklogin) only.
source§

impl Signer<Ed25519Signature> for Ed25519PrivateKey

Available on crate feature ed25519 only.
source§

impl Signer<Secp256k1Signature> for Secp256k1PrivateKey

Available on crate feature secp256k1 only.
source§

impl Signer<Secp256r1Signature> for Secp256r1PrivateKey

Available on crate feature secp256r1 only.