gose/algorithm
Cryptographic algorithm definitions for signing and encryption.
Types
AES key sizes.
pub type AesKeySize {
Aes128
Aes192
Aes256
}
Constructors
-
Aes128128-bit AES key
-
Aes192192-bit AES key
-
Aes256256-bit AES key
AES key wrapping modes.
pub type AesKwMode {
AesKw
AesGcmKw
}
Constructors
-
AesKwAES Key Wrap (RFC 3394)
-
AesGcmKwAES-GCM Key Wrap
ChaCha20-Poly1305 key wrapping variants.
pub type ChaCha20Kw {
C20PKw
XC20PKw
}
Constructors
-
C20PKwChaCha20-Poly1305 Key Wrap (12-byte nonce)
-
XC20PKwXChaCha20-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)
-
ChaCha20Poly1305ChaCha20-Poly1305
-
XChaCha20Poly1305XChaCha20-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
-
EddsaEdDSA (Ed25519 or Ed448, curve determined by key)
ECDH-ES key agreement algorithm variants.
pub type EcdhEsAlg {
EcdhEsDirect
EcdhEsAesKw(AesKeySize)
EcdhEsChaCha20Kw(ChaCha20Kw)
}
Constructors
-
EcdhEsDirectECDH-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
-
EcdsaP256ECDSA using P-256 and SHA-256
-
EcdsaP384ECDSA using P-384 and SHA-384
-
EcdsaP521ECDSA using P-521 and SHA-512
-
EcdsaSecp256k1ECDSA using secp256k1 and SHA-256 (RFC 8812)
HMAC signing algorithm variants.
pub type HmacAlg {
HmacSha256
HmacSha384
HmacSha512
}
Constructors
-
HmacSha256HMAC using SHA-256
-
HmacSha384HMAC using SHA-384
-
HmacSha512HMAC using SHA-512
Key encryption algorithms.
pub type KeyEncryptionAlg {
Direct
AesKeyWrap(AesKwMode, AesKeySize)
ChaCha20KeyWrap(ChaCha20Kw)
RsaEncryption(RsaEncryptionAlg)
EcdhEs(EcdhEsAlg)
Pbes2(Pbes2Alg)
}
Constructors
-
DirectDirect use of a shared symmetric key
-
AesKeyWrap(AesKwMode, AesKeySize)AES Key Wrap (standard or GCM mode)
-
ChaCha20KeyWrap(ChaCha20Kw)ChaCha20-Poly1305 Key Wrap
-
RsaEncryption(RsaEncryptionAlg)RSA key encryption
-
EcdhEs(EcdhEsAlg)ECDH-ES key agreement
-
Pbes2(Pbes2Alg)PBES2 password-based encryption
PBES2 key encryption algorithm variants.
pub type Pbes2Alg {
Pbes2Sha256Aes128Kw
Pbes2Sha384Aes192Kw
Pbes2Sha512Aes256Kw
}
Constructors
-
Pbes2Sha256Aes128KwPBES2 with HMAC-SHA-256 and A128KW wrapping
-
Pbes2Sha384Aes192KwPBES2 with HMAC-SHA-384 and A192KW wrapping
-
Pbes2Sha512Aes256KwPBES2 with HMAC-SHA-512 and A256KW wrapping
RSA key encryption algorithm variants.
pub type RsaEncryptionAlg {
RsaPkcs1v15
RsaOaepSha1
RsaOaepSha256
}
Constructors
-
RsaPkcs1v15RSAES 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
RsaOaepSha256for new applications.Note: Decryption may fail on Node.js 20.x (CVE-2023-46809).
-
RsaOaepSha1RSAES OAEP using default parameters
-
RsaOaepSha256RSAES OAEP using SHA-256 and MGF1 with SHA-256
RSA PKCS#1 v1.5 signing algorithm variants.
pub type RsaPkcs1Alg {
RsaPkcs1Sha256
RsaPkcs1Sha384
RsaPkcs1Sha512
}
Constructors
-
RsaPkcs1Sha256RSA PKCSv1.5 using SHA-256
-
RsaPkcs1Sha384RSA PKCSv1.5 using SHA-384
-
RsaPkcs1Sha512RSA PKCSv1.5 using SHA-512
RSA-PSS signing algorithm variants.
pub type RsaPssAlg {
RsaPssSha256
RsaPssSha384
RsaPssSha512
}
Constructors
-
RsaPssSha256RSA-PSS using SHA-256 (RSASSA-PSS)
-
RsaPssSha384RSA-PSS using SHA-384 (RSASSA-PSS)
-
RsaPssSha512RSA-PSS using SHA-512 (RSASSA-PSS)
Signing and MAC algorithms (union of asymmetric signatures and MACs).
pub type SigningAlg {
DigitalSignature(DigitalSignatureAlg)
Mac(MacAlg)
}
Constructors
-
DigitalSignature(DigitalSignatureAlg)Asymmetric digital signature algorithm
-
Mac(MacAlg)MAC algorithm