gose/cose/algorithm

COSE algorithm integer ID mapping (RFC 9053).

Maps between gose/algorithm types and COSE integer identifiers.

Values

pub fn content_alg_from_int(
  id: Int,
) -> Result(algorithm.ContentAlg, gose.GoseError)

Parse a content encryption algorithm from its COSE integer identifier.

pub fn content_alg_to_int(
  alg: algorithm.ContentAlg,
) -> Result(Int, gose.GoseError)

Convert a content encryption algorithm to its COSE integer identifier.

Some content encryption algorithms are JOSE-only and have no COSE identifier, in which case this returns an error.

pub fn key_encryption_alg_from_int(
  id: Int,
) -> Result(algorithm.KeyEncryptionAlg, gose.GoseError)

Parse a key encryption algorithm from its COSE integer identifier.

Both ECDH-ES+HKDF-256 (-25) and ECDH-ES+HKDF-512 (-26) map to EcdhEs(EcdhEsDirect) because the shared algorithm type does not distinguish the HKDF variant. The HKDF variant is preserved at the cose/encrypt layer via EcdhEsDirectVariant. Use new_ecdh_es_direct_recipient and ecdh_es_direct_decryptor for HKDF-512 support.

pub fn key_encryption_alg_to_int(
  alg: algorithm.KeyEncryptionAlg,
) -> Result(Int, gose.GoseError)

Convert a key encryption algorithm to its COSE integer identifier.

Some key encryption algorithms are JOSE-only and have no COSE identifier, in which case this returns an error.

pub fn mac_alg_from_int(
  id: Int,
) -> Result(algorithm.MacAlg, gose.GoseError)

Parse a MAC algorithm from its COSE integer identifier.

pub fn mac_alg_to_int(alg: algorithm.MacAlg) -> Int

Convert a MAC algorithm to its COSE integer identifier.

pub fn signature_alg_from_int(
  id: Int,
) -> Result(algorithm.DigitalSignatureAlg, gose.GoseError)

Parse a signature algorithm from its COSE integer identifier.

pub fn signature_alg_to_int(
  alg: algorithm.DigitalSignatureAlg,
) -> Int

Convert a signature algorithm to its COSE integer identifier.

pub fn signing_alg_from_int(
  id: Int,
) -> Result(algorithm.SigningAlg, gose.GoseError)

Parse a signing algorithm from its COSE integer identifier.

pub fn signing_alg_to_int(alg: algorithm.SigningAlg) -> Int

Convert a signing algorithm to its COSE integer identifier.

Search Document