Module key_formats

Module key_formats 

Source
Expand description

Standard key format support (DER, JWK, PKCS#8).

This module provides import/export functionality for standard cryptographic key formats used in various protocols and applications.

§Supported Formats

  • DER: Distinguished Encoding Rules (ASN.1 binary format)
  • JWK: JSON Web Key (RFC 7517)
  • PKCS#8: Public-Key Cryptography Standards #8

§Example

use chie_crypto::key_formats::{JwkKey, DerKey};
use chie_crypto::signing::KeyPair;

// Generate a keypair
let keypair = KeyPair::generate();

// Export to JWK
let jwk = JwkKey::from_ed25519_keypair(&keypair);
let jwk_json = jwk.to_json().unwrap();

// Import from JWK
let imported_jwk = JwkKey::from_json(&jwk_json).unwrap();
let imported_keypair = imported_jwk.to_ed25519_keypair().unwrap();

Structs§

DerKey
DER (Distinguished Encoding Rules) key representation
JwkKey
JSON Web Key (JWK) representation

Enums§

KeyFormatError
Key format errors

Type Aliases§

KeyFormatResult
Result type for key format operations