gose/algorithm

Cryptographic algorithm definitions for signing and encryption.

Types

AES key sizes.

pub type AesKeySize {
  Aes128
  Aes192
  Aes256
}

Constructors

  • Aes128

    128-bit AES key

  • Aes192

    192-bit AES key

  • Aes256

    256-bit AES key

AES key wrapping modes.

pub type AesKwMode {
  AesKw
  AesGcmKw
}

Constructors

  • AesKw

    AES Key Wrap (RFC 3394)

  • AesGcmKw

    AES-GCM Key Wrap

ChaCha20-Poly1305 key wrapping variants.

pub type ChaCha20Kw {
  C20PKw
  XC20PKw
}

Constructors

  • C20PKw

    ChaCha20-Poly1305 Key Wrap (12-byte nonce)

  • XC20PKw

    XChaCha20-Poly1305 Key Wrap (24-byte nonce)

Content encryption algorithms.

pub type ContentAlg {
  AesGcm(AesKeySize)
  AesCbcHmac(AesKeySize)
  ChaCha20Poly1305
  XChaCha20Poly1305
}

Constructors

  • AesGcm(AesKeySize)

    AES-GCM content encryption

  • AesCbcHmac(AesKeySize)

    AES-CBC with HMAC composite AEAD (CEK is double the AES key size)

  • ChaCha20Poly1305

    ChaCha20-Poly1305

  • XChaCha20Poly1305

    XChaCha20-Poly1305

Asymmetric signature algorithms.

pub type DigitalSignatureAlg {
  RsaPkcs1(RsaPkcs1Alg)
  RsaPss(RsaPssAlg)
  Ecdsa(EcdsaAlg)
  Eddsa
}

Constructors

  • RsaPkcs1(RsaPkcs1Alg)

    RSA PKCS#1 v1.5 signing

  • RsaPss(RsaPssAlg)

    RSA-PSS signing

  • Ecdsa(EcdsaAlg)

    ECDSA signing

  • Eddsa

    EdDSA (Ed25519 or Ed448, curve determined by key)

ECDH-ES key agreement algorithm variants.

pub type EcdhEsAlg {
  EcdhEsDirect
  EcdhEsAesKw(AesKeySize)
  EcdhEsChaCha20Kw(ChaCha20Kw)
}

Constructors

  • EcdhEsDirect

    ECDH-ES direct key agreement

  • EcdhEsAesKw(AesKeySize)

    ECDH-ES with AES Key Wrap

  • EcdhEsChaCha20Kw(ChaCha20Kw)

    ECDH-ES with ChaCha20-Poly1305 Key Wrap

ECDSA signing algorithm variants.

pub type EcdsaAlg {
  EcdsaP256
  EcdsaP384
  EcdsaP521
  EcdsaSecp256k1
}

Constructors

  • EcdsaP256

    ECDSA using P-256 and SHA-256

  • EcdsaP384

    ECDSA using P-384 and SHA-384

  • EcdsaP521

    ECDSA using P-521 and SHA-512

  • EcdsaSecp256k1

    ECDSA using secp256k1 and SHA-256 (RFC 8812)

HMAC signing algorithm variants.

pub type HmacAlg {
  HmacSha256
  HmacSha384
  HmacSha512
}

Constructors

  • HmacSha256

    HMAC using SHA-256

  • HmacSha384

    HMAC using SHA-384

  • HmacSha512

    HMAC using SHA-512

Key encryption algorithms.

pub type KeyEncryptionAlg {
  Direct
  AesKeyWrap(AesKwMode, AesKeySize)
  ChaCha20KeyWrap(ChaCha20Kw)
  RsaEncryption(RsaEncryptionAlg)
  EcdhEs(EcdhEsAlg)
  Pbes2(Pbes2Alg)
}

Constructors

MAC algorithms.

pub type MacAlg {
  Hmac(HmacAlg)
}

Constructors

PBES2 key encryption algorithm variants.

pub type Pbes2Alg {
  Pbes2Sha256Aes128Kw
  Pbes2Sha384Aes192Kw
  Pbes2Sha512Aes256Kw
}

Constructors

  • Pbes2Sha256Aes128Kw

    PBES2 with HMAC-SHA-256 and A128KW wrapping

  • Pbes2Sha384Aes192Kw

    PBES2 with HMAC-SHA-384 and A192KW wrapping

  • Pbes2Sha512Aes256Kw

    PBES2 with HMAC-SHA-512 and A256KW wrapping

RSA key encryption algorithm variants.

pub type RsaEncryptionAlg {
  RsaPkcs1v15
  RsaOaepSha1
  RsaOaepSha256
}

Constructors

  • RsaPkcs1v15

    RSAES PKCS1 v1.5 key encryption.

    Security Warning: Vulnerable to padding oracle attacks (Bleichenbacher). Use only for interoperability with legacy systems that require RSA1_5. Prefer RsaOaepSha256 for new applications.

    Note: Decryption may fail on Node.js 20.x (CVE-2023-46809).

  • RsaOaepSha1

    RSAES OAEP using default parameters

  • RsaOaepSha256

    RSAES OAEP using SHA-256 and MGF1 with SHA-256

RSA PKCS#1 v1.5 signing algorithm variants.

pub type RsaPkcs1Alg {
  RsaPkcs1Sha256
  RsaPkcs1Sha384
  RsaPkcs1Sha512
}

Constructors

  • RsaPkcs1Sha256

    RSA PKCSv1.5 using SHA-256

  • RsaPkcs1Sha384

    RSA PKCSv1.5 using SHA-384

  • RsaPkcs1Sha512

    RSA PKCSv1.5 using SHA-512

RSA-PSS signing algorithm variants.

pub type RsaPssAlg {
  RsaPssSha256
  RsaPssSha384
  RsaPssSha512
}

Constructors

  • RsaPssSha256

    RSA-PSS using SHA-256 (RSASSA-PSS)

  • RsaPssSha384

    RSA-PSS using SHA-384 (RSASSA-PSS)

  • RsaPssSha512

    RSA-PSS using SHA-512 (RSASSA-PSS)

Signing and MAC algorithms (union of asymmetric signatures and MACs).

pub type SigningAlg {
  DigitalSignature(DigitalSignatureAlg)
  Mac(MacAlg)
}

Constructors

Search Document