docs

您正在閱讀 v0.1.0 的文件。Nabi 0.1.0 已停止支援。 最新版本:v0.1.3 →

core::crypto::ed25519

本頁內容

API 參考只有英文版,由標準函式庫原始碼中的英文文件註解產生。

Ed25519 (RFC 8032 5.1): pure EdDSA over edwards25519 with SHA-512.

Structs

SigningKeySource

pub struct SigningKey

A signing key: the 32-byte seed and its expansion, in secret storage. It has one owner (let b = a moves it); wipe and its release clear it.

  • pub fn from_seed<B: AsBytes>(seed: B) throws (ValueError) -> SigningKey§

    Source

    The key of a 32-byte seed.

  • pub fn seed(self) -> Secret§

    Source

    A copy of the seed.

  • pub const fn verifying_key(self) -> VerifyingKey§

    Source

    The public key that checks this key's signatures.

  • pub fn sign<B: AsBytes>(self, msg: B) -> List<u8>§

    Source

    The 64-byte signature R || S of msg (deterministic).

  • pub fn wipe(self)§

    Source

    Overwrite the key material with zeros now (every copy shares it); sign is meaningless afterwards.

Trait implementations 3
  • impl !Sync for SigningKey
  • impl Drop for SigningKey
  • impl Debug for SigningKey

VerifyingKeySource

pub struct VerifyingKey

A public key: a 32-byte encoded point.

  • pub fn from_bytes<B: AsBytes>(bytes: B) throws (ValueError) -> VerifyingKey§

    Source

    A 32-byte encoded point; a non-canonical encoding or one that is not on the curve is an error.

  • pub const fn to_bytes(self) -> [u8; 32]§

    Source

    The key's 32 bytes.

  • pub fn verify<M: AsBytes, S: AsBytes>(self, msg: M, sig: S) -> bool§

    Source

    Whether sig is a valid signature of msg: S < L and the encoding of [S]B - [k]A equal to R byte for byte (cofactorless, RFC 8032 5.1.7).