├── .cargo └── audit.toml ├── .github ├── dependabot.yml └── workflows │ ├── base16ct.yml │ ├── base32ct.yml │ ├── base64ct.yml │ ├── cmpv2.yml │ ├── cms.yml │ ├── const-oid.yml │ ├── crmf.yml │ ├── der.yml │ ├── gss-api.yml │ ├── pem-rfc7468.yml │ ├── pkcs1.yml │ ├── pkcs12.yml │ ├── pkcs5.yml │ ├── pkcs8.yml │ ├── sec1.yml │ ├── security-audit.yml │ ├── serdect.yml │ ├── spki.yml │ ├── tai64.yml │ ├── tai64_update_leap_seconds.yml │ ├── tls_codec.yml │ ├── workspace.yml │ ├── x509-cert.yml │ ├── x509-ocsp.yml │ └── x509-tsp.yml ├── .gitignore ├── .typos.toml ├── Cargo.lock ├── Cargo.toml ├── README.md ├── SECURITY.md ├── base16ct ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── benches │ └── mod.rs ├── src │ ├── display.rs │ ├── error.rs │ ├── lib.rs │ ├── lower.rs │ ├── mixed.rs │ └── upper.rs └── tests │ └── lib.rs ├── base32ct ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── src │ ├── alphabet.rs │ ├── alphabet │ │ └── rfc4648.rs │ ├── encoding.rs │ ├── error.rs │ └── lib.rs └── tests │ ├── proptests.proptest-regressions │ ├── proptests.rs │ └── vectors.rs ├── base64ct ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── benches │ └── mod.rs ├── src │ ├── alphabet.rs │ ├── alphabet │ │ ├── bcrypt.rs │ │ ├── crypt.rs │ │ ├── shacrypt.rs │ │ ├── standard.rs │ │ └── url.rs │ ├── decoder.rs │ ├── encoder.rs │ ├── encoding.rs │ ├── errors.rs │ ├── lib.rs │ ├── line_ending.rs │ └── test_vectors.rs └── tests │ ├── bcrypt.rs │ ├── common │ └── mod.rs │ ├── crypt.rs │ ├── proptests.proptest-regressions │ ├── proptests.rs │ ├── shacrypt.rs │ ├── standard.rs │ └── url.rs ├── cmpv2 ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── src │ ├── ann.rs │ ├── body.rs │ ├── certified_key_pair.rs │ ├── gp.rs │ ├── header.rs │ ├── lib.rs │ ├── message.rs │ ├── oob.rs │ ├── parameter.rs │ ├── poll.rs │ ├── pop.rs │ ├── response.rs │ ├── rev.rs │ └── status.rs └── tests │ ├── cert_req.rs │ ├── examples │ ├── cr_req_01.bin │ ├── cr_rsp_01.bin │ ├── ec384-ca-key.crt │ ├── ec384-ee-key.der │ ├── ec384-server-key.crt │ ├── ec384-server-key.der │ ├── ec384-server-key.pem │ ├── failed_kur_rsp_01.bin │ ├── genm_req_01.bin │ ├── genm_req_body_01.bin │ ├── genm_req_header_01.bin │ ├── genm_rsp_01.bin │ ├── ir_req_01.bin │ ├── ir_req_body_01.bin │ ├── ir_req_header_01.bin │ ├── ir_rsp_01.bin │ ├── ir_rsp_body_01.bin │ ├── ir_rsp_header_01.bin │ ├── kur_req_01.bin │ ├── kur_req_body_01.bin │ ├── kur_req_header_01.bin │ ├── kur_rsp_01.bin │ ├── p10cr_req_01.bin │ ├── p10cr_rsp_01.bin │ ├── rr_req_01.bin │ ├── rr_rsp_01.bin │ ├── rr_rsp_body_01.bin │ └── rr_rsp_header_01.bin │ ├── genm_req.rs │ ├── init_req.rs │ ├── key_update_req.rs │ ├── p10cr_req.rs │ └── rr_req.rs ├── cms ├── CHANGELOG.md ├── Cargo.toml ├── README.md ├── src │ ├── attr.rs │ ├── authenticated_data.rs │ ├── authenveloped_data.rs │ ├── builder.rs │ ├── builder │ │ ├── kari.rs │ │ ├── utils.rs │ │ └── utils │ │ │ └── kw.rs │ ├── cert.rs │ ├── compressed_data.rs │ ├── content_info.rs │ ├── digested_data.rs │ ├── encrypted_data.rs │ ├── enveloped_data.rs │ ├── kemri.rs │ ├── lib.rs │ ├── revocation.rs │ ├── signed_data.rs │ └── timestamped_data.rs └── tests │ ├── builder.rs │ ├── builder │ └── kari.rs │ ├── compressed_data.rs │ ├── digested_data.rs │ ├── encrypted_data.rs │ ├── enveloped_data.rs │ ├── examples │ ├── 1.3.6.1.4.1.22554.5.6.1_ML-KEM-512-ipd_kemri_auth.der │ ├── 1.3.6.1.4.1.22554.5.6.1_ML-KEM-512-ipd_kemri_id-alg-hkdf-with-sha256.der │ ├── 1.3.6.1.4.1.22554.5.6.1_ML-KEM-512-ipd_kemri_ukm.der │ ├── GoodCACert.crt │ ├── GoodCACert.pem │ ├── ValidCertificatePathTest1EE.crt │ ├── ValidCertificatePathTest1EE.pem │ ├── apple_mdm_signature_der.bin │ ├── authroot.stl │ ├── authroot.stl.sd │ ├── cert.pem │ ├── certData.bin │ ├── cms_ber.bin │ ├── cms_der.bin │ ├── compressed_data.bin │ ├── data.txt │ ├── digested_data.bin │ ├── ec384-ee-key.der │ ├── encrypted_data.bin │ ├── enveloped_data_kari.bin │ ├── enveloped_data_kekri.bin │ ├── enveloped_data_ktri.bin │ ├── enveloped_data_multi.bin │ ├── enveloped_data_pwri.bin │ ├── example.pfx │ ├── examples_notes.txt │ ├── keyEncryptedData.bin │ ├── p256-priv.der │ ├── p256-pub.der │ ├── pkits.p7b │ ├── pkits_ee.p7b │ ├── rsa2048-priv.der │ ├── rsa_cert.der │ ├── rsa_sk.pkcs1.pem │ ├── scep_der.bin │ ├── sceptest_cert-selfsigned.pem │ ├── sceptest_csr.der │ ├── sceptest_key.pem │ ├── sd.cms │ ├── signer_info_explicit_attrs.bin │ └── signer_info_sequence_not_set.bin │ ├── kemri.rs │ ├── signed_data.rs │ └── tests_from_pkcs7_crate.rs ├── const-oid ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── oiddbgen │ ├── Cargo.lock │ ├── Cargo.toml │ ├── README.md │ ├── fips202.md │ ├── fips203.md │ ├── fips204.md │ ├── fips205.md │ ├── ldap-parameters-3.csv │ ├── rfc2985.txt │ ├── rfc3161.txt │ ├── rfc5280.txt │ ├── rfc5639.txt │ ├── rfc5753.txt │ ├── rfc5911.txt │ ├── rfc5912.txt │ ├── rfc6268.txt │ ├── rfc6960.txt │ ├── rfc6962.txt │ ├── rfc7107.txt │ ├── rfc7292.txt │ ├── rfc7299.txt │ ├── rfc7693.txt │ ├── rfc8410.txt │ ├── rfc8894.md │ ├── rfc9688.txt │ ├── src │ │ ├── asn1.rs │ │ ├── ldap.rs │ │ ├── lib.rs │ │ ├── main.rs │ │ ├── node.rs │ │ ├── root.rs │ │ └── spec.rs │ ├── stb │ │ ├── bake.asn │ │ ├── bash.asn │ │ ├── belt.asn │ │ ├── bign.asn │ │ ├── bpki.asn │ │ ├── brng.asn │ │ └── btok.asn │ └── tcg-tpm.md ├── src │ ├── arcs.rs │ ├── buffer.rs │ ├── checked.rs │ ├── db.rs │ ├── db │ │ └── generated.rs │ ├── encoder.rs │ ├── error.rs │ ├── lib.rs │ ├── parser.rs │ └── traits.rs └── tests │ ├── oid.rs │ ├── oid_ref.rs │ ├── proptests.proptest-regressions │ └── proptests.rs ├── crmf ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── src │ ├── controls.rs │ ├── lib.rs │ ├── pop.rs │ ├── reg_info.rs │ └── request.rs └── tests │ ├── controls.rs │ ├── examples │ ├── certreqmsg.bin │ ├── certreqmsgs.bin │ ├── certrequest.bin │ └── certtemplate.bin │ └── request.rs ├── der ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── src │ ├── arrayvec.rs │ ├── asn1.rs │ ├── asn1 │ │ ├── any.rs │ │ ├── application.rs │ │ ├── bit_string.rs │ │ ├── bit_string │ │ │ └── allowed_len_bit_string.rs │ │ ├── bmp_string.rs │ │ ├── boolean.rs │ │ ├── choice.rs │ │ ├── context_specific.rs │ │ ├── general_string.rs │ │ ├── generalized_time.rs │ │ ├── ia5_string.rs │ │ ├── integer.rs │ │ ├── integer │ │ │ ├── int.rs │ │ │ └── uint.rs │ │ ├── internal_macros.rs │ │ ├── null.rs │ │ ├── octet_string.rs │ │ ├── oid.rs │ │ ├── optional.rs │ │ ├── printable_string.rs │ │ ├── private.rs │ │ ├── real.rs │ │ ├── sequence.rs │ │ ├── sequence_of.rs │ │ ├── set_of.rs │ │ ├── teletex_string.rs │ │ ├── utc_time.rs │ │ ├── utf8_string.rs │ │ └── videotex_string.rs │ ├── bytes_owned.rs │ ├── bytes_ref.rs │ ├── datetime.rs │ ├── decode.rs │ ├── document.rs │ ├── encode.rs │ ├── encode_ref.rs │ ├── encoding_rules.rs │ ├── error.rs │ ├── header.rs │ ├── length.rs │ ├── lib.rs │ ├── ord.rs │ ├── reader.rs │ ├── reader │ │ ├── pem.rs │ │ └── slice.rs │ ├── referenced.rs │ ├── str_owned.rs │ ├── str_ref.rs │ ├── tag.rs │ ├── tag │ │ ├── class.rs │ │ ├── mode.rs │ │ └── number.rs │ ├── writer.rs │ └── writer │ │ ├── pem.rs │ │ └── slice.rs └── tests │ ├── datetime.proptest-regressions │ ├── datetime.rs │ ├── derive.rs │ ├── derive_no_alloc.rs │ ├── examples │ ├── spki.der │ └── spki.pem │ ├── pem.rs │ └── set_of.rs ├── der_derive ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md └── src │ ├── asn1_type.rs │ ├── attributes.rs │ ├── bitstring.rs │ ├── bitstring │ └── field.rs │ ├── choice.rs │ ├── choice │ └── variant.rs │ ├── enumerated.rs │ ├── lib.rs │ ├── sequence.rs │ ├── sequence │ └── field.rs │ ├── tag.rs │ └── value_ord.rs ├── gss-api ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md └── src │ ├── lib.rs │ └── negotiation.rs ├── pem-rfc7468 ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── src │ ├── decoder.rs │ ├── encoder.rs │ ├── error.rs │ ├── grammar.rs │ └── lib.rs └── tests │ ├── decode.rs │ ├── encode.rs │ └── examples │ ├── chosen_header.pem │ ├── ed25519_id.pem │ ├── pkcs1.der │ ├── pkcs1.pem │ ├── pkcs1_with_preceding_junk.pem │ ├── pkcs8-enc.der │ ├── pkcs8-enc.pem │ ├── pkcs8.der │ ├── pkcs8.pem │ ├── ssh-id_ed25519.pem │ └── ssh_rsa_pem_password.pem ├── pkcs1 ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── src │ ├── error.rs │ ├── lib.rs │ ├── params.rs │ ├── private_key.rs │ ├── private_key │ │ └── other_prime_info.rs │ ├── public_key.rs │ ├── traits.rs │ └── version.rs └── tests │ ├── examples │ ├── rsa2048-priv-3prime.der │ ├── rsa2048-priv-3prime.pem │ ├── rsa2048-priv.der │ ├── rsa2048-priv.pem │ ├── rsa2048-pub.der │ ├── rsa2048-pub.pem │ ├── rsa4096-priv.der │ ├── rsa4096-priv.pem │ ├── rsa4096-pub.der │ └── rsa4096-pub.pem │ ├── params.rs │ ├── private_key.rs │ ├── public_key.rs │ └── traits.rs ├── pkcs12 ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── src │ ├── authenticated_safe.rs │ ├── bag_type.rs │ ├── cert_type.rs │ ├── crl_type.rs │ ├── digest_info.rs │ ├── kdf.rs │ ├── lib.rs │ ├── mac_data.rs │ ├── pbe_params.rs │ ├── pfx.rs │ └── safe_bag.rs └── tests │ ├── cert_tests.rs │ ├── examples │ ├── GoodCACert.crt │ ├── GoodCACert.der │ ├── ValidCertificatePathTest1EE.crt │ ├── ValidCertificatePathTest1EE.key │ ├── ValidCertificatePathTest1EE.p12 │ ├── ValidCertificatePathTest1EE.pem │ ├── ValidCertificatePathTest1EE_firefox.p12 │ ├── ValidCertificatePathTest1EE_macos.p12 │ ├── ValidCertificatePathTest1EE_windows_aes.p12.pfx │ ├── ValidCertificatePathTest1EE_windows_tdes.p12.pfx │ ├── cert.der │ ├── cert.pem │ ├── example.pfx │ ├── example10.pfx │ ├── example11.pfx │ ├── example12.pfx │ ├── example13.pfx │ ├── example14.pfx │ ├── example15.pfx │ ├── example16.pfx │ ├── example17.pfx │ ├── example2.pfx │ ├── example3.pfx │ ├── example4.pfx │ ├── example5.pfx │ ├── example6.pfx │ ├── example7.pfx │ ├── example8.pfx │ ├── example9.pfx │ ├── gen.sh │ ├── key.der │ └── key.pem │ └── kdf.rs ├── pkcs5 ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── src │ ├── error.rs │ ├── lib.rs │ ├── pbes1.rs │ ├── pbes2.rs │ └── pbes2 │ │ ├── encryption.rs │ │ ├── kdf.rs │ │ └── kdf │ │ └── salt.rs └── tests │ ├── encryption.rs │ ├── examples │ ├── pbes2_aes-128-cbc_hmacWithSHA1_algid.der │ ├── pbes2_aes-128-cbc_hmacWithSHA1_ciphertext.bin │ ├── pbes2_aes-128-cbc_hmacWithSHA224_algid.der │ ├── pbes2_aes-128-cbc_hmacWithSHA224_ciphertext.bin │ ├── pbes2_aes-128-cbc_hmacWithSHA256_algid.der │ ├── pbes2_aes-128-cbc_hmacWithSHA256_ciphertext.bin │ ├── pbes2_aes-128-cbc_hmacWithSHA384_algid.der │ ├── pbes2_aes-128-cbc_hmacWithSHA384_ciphertext.bin │ ├── pbes2_aes-128-cbc_hmacWithSHA512_algid.der │ ├── pbes2_aes-128-cbc_hmacWithSHA512_ciphertext.bin │ ├── pbes2_aes-192-cbc_hmacWithSHA1_algid.der │ ├── pbes2_aes-192-cbc_hmacWithSHA1_ciphertext.bin │ ├── pbes2_aes-192-cbc_hmacWithSHA224_algid.der │ ├── pbes2_aes-192-cbc_hmacWithSHA224_ciphertext.bin │ ├── pbes2_aes-192-cbc_hmacWithSHA256_algid.der │ ├── pbes2_aes-192-cbc_hmacWithSHA256_ciphertext.bin │ ├── pbes2_aes-192-cbc_hmacWithSHA384_algid.der │ ├── pbes2_aes-192-cbc_hmacWithSHA384_ciphertext.bin │ ├── pbes2_aes-192-cbc_hmacWithSHA512_algid.der │ ├── pbes2_aes-192-cbc_hmacWithSHA512_ciphertext.bin │ ├── pbes2_aes-256-cbc_hmacWithSHA1_algid.der │ ├── pbes2_aes-256-cbc_hmacWithSHA1_ciphertext.bin │ ├── pbes2_aes-256-cbc_hmacWithSHA224_algid.der │ ├── pbes2_aes-256-cbc_hmacWithSHA224_ciphertext.bin │ ├── pbes2_aes-256-cbc_hmacWithSHA256_algid-no-param.der │ ├── pbes2_aes-256-cbc_hmacWithSHA256_algid.der │ ├── pbes2_aes-256-cbc_hmacWithSHA256_ciphertext.bin │ ├── pbes2_aes-256-cbc_hmacWithSHA384_algid.der │ ├── pbes2_aes-256-cbc_hmacWithSHA384_ciphertext.bin │ ├── pbes2_aes-256-cbc_hmacWithSHA512_algid.der │ ├── pbes2_aes-256-cbc_hmacWithSHA512_ciphertext.bin │ ├── re-gen.sh │ ├── rsa_sk.pkcs1.pem │ ├── rsa_sk.pkcs8.der │ ├── rsa_sk_aes-128-cbc_hmacWithSHA1.pkcs8.der │ ├── rsa_sk_aes-128-cbc_hmacWithSHA224.pkcs8.der │ ├── rsa_sk_aes-128-cbc_hmacWithSHA256.pkcs8.der │ ├── rsa_sk_aes-128-cbc_hmacWithSHA384.pkcs8.der │ ├── rsa_sk_aes-128-cbc_hmacWithSHA512.pkcs8.der │ ├── rsa_sk_aes-192-cbc_hmacWithSHA1.pkcs8.der │ ├── rsa_sk_aes-192-cbc_hmacWithSHA224.pkcs8.der │ ├── rsa_sk_aes-192-cbc_hmacWithSHA256.pkcs8.der │ ├── rsa_sk_aes-192-cbc_hmacWithSHA384.pkcs8.der │ ├── rsa_sk_aes-192-cbc_hmacWithSHA512.pkcs8.der │ ├── rsa_sk_aes-256-cbc_hmacWithSHA1.pkcs8.der │ ├── rsa_sk_aes-256-cbc_hmacWithSHA224.pkcs8.der │ ├── rsa_sk_aes-256-cbc_hmacWithSHA256.pkcs8.der │ ├── rsa_sk_aes-256-cbc_hmacWithSHA384.pkcs8.der │ └── rsa_sk_aes-256-cbc_hmacWithSHA512.pkcs8.der │ ├── pbes2.rs │ └── pbes2_pbkdf2_decrypt.rs ├── pkcs7 └── README.md ├── pkcs8 ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── src │ ├── encrypted_private_key_info.rs │ ├── error.rs │ ├── lib.rs │ ├── private_key_info.rs │ ├── traits.rs │ └── version.rs └── tests │ ├── encrypted_private_key.rs │ ├── examples │ ├── bign256-priv.der │ ├── bign256-priv.pem │ ├── ed25519-encpriv-aes128-gcm-scrypt.der │ ├── ed25519-encpriv-aes128-pbkdf2-sha1.der │ ├── ed25519-encpriv-aes256-gcm-scrypt.der │ ├── ed25519-encpriv-aes256-pbkdf2-sha256.der │ ├── ed25519-encpriv-aes256-pbkdf2-sha256.pem │ ├── ed25519-encpriv-aes256-scrypt.der │ ├── ed25519-encpriv-aes256-scrypt.pem │ ├── ed25519-encpriv-des-pbkdf2-sha256.der │ ├── ed25519-encpriv-des3-pbkdf2-sha256.der │ ├── ed25519-priv-pkcs8v1.der │ ├── ed25519-priv-pkcs8v1.pem │ ├── ed25519-priv-pkcs8v2.der │ ├── ed25519-priv-pkcs8v2.pem │ ├── ed25519-pub.der │ ├── ed25519-pub.pem │ ├── p256-priv.der │ ├── p256-priv.pem │ ├── p256-pub.der │ ├── p256-pub.pem │ ├── rsa2048-priv.der │ ├── rsa2048-priv.pem │ ├── rsa2048-pub.der │ ├── rsa2048-pub.pem │ ├── x25519-priv.der │ └── x25519-priv.pem │ ├── private_key.rs │ └── traits.rs ├── sec1 ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── src │ ├── error.rs │ ├── lib.rs │ ├── parameters.rs │ ├── point.rs │ ├── private_key.rs │ └── traits.rs └── tests │ ├── examples │ ├── p256-priv.der │ └── p256-priv.pem │ ├── private_key.rs │ └── traits.rs ├── serdect ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── src │ ├── array.rs │ ├── common.rs │ ├── lib.rs │ └── slice.rs └── tests │ ├── bincode.rs │ ├── cbor.rs │ ├── messagepack.rs │ ├── serde-json-core.rs │ ├── serde_json.rs │ └── toml.rs ├── spki ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── src │ ├── algorithm.rs │ ├── digest.rs │ ├── error.rs │ ├── lib.rs │ ├── spki.rs │ └── traits.rs └── tests │ ├── examples │ ├── ed25519-pub.der │ ├── ed25519-pub.pem │ ├── p256-pub.der │ ├── p256-pub.pem │ ├── rsa2048-pub.der │ └── rsa2048-pub.pem │ ├── spki.rs │ └── traits.rs ├── tai64 ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md └── src │ └── lib.rs ├── tls_codec ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── benches │ ├── quic_vec.rs │ └── tls_vec.rs ├── derive │ ├── Cargo.toml │ ├── LICENSE-APACHE │ ├── LICENSE-MIT │ ├── src │ │ └── lib.rs │ └── tests │ │ ├── attributes.rs │ │ ├── attributes │ │ ├── test_that_duplicate_skip_attributes_dont_compile.rs │ │ ├── test_that_duplicate_skip_attributes_dont_compile.stderr │ │ ├── that_non_default_field_does_not_compile.rs │ │ ├── that_non_default_field_does_not_compile.stderr │ │ ├── that_skip_attribute_does_not_compile_on_enums.rs │ │ └── that_skip_attribute_does_not_compile_on_enums.stderr │ │ ├── decode.rs │ │ ├── decode_bytes.rs │ │ ├── encode.rs │ │ └── encode_bytes.rs ├── fuzz │ ├── .gitignore │ ├── Cargo.lock │ ├── Cargo.toml │ └── fuzz_targets │ │ └── inverse.rs ├── src │ ├── arrays.rs │ ├── lib.rs │ ├── primitives.rs │ ├── quic_vec.rs │ └── tls_vec.rs └── tests │ ├── decode.rs │ ├── decode_bytes.rs │ ├── encode.rs │ └── encode_bytes.rs ├── x509-cert ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── fuzz │ ├── .gitignore │ ├── Cargo.toml │ ├── inputs │ │ └── rsa2048-csr.der │ └── src │ │ └── bin │ │ ├── certreq.rs │ │ └── certreqinfo.rs ├── src │ ├── anchor.rs │ ├── attr.rs │ ├── builder.rs │ ├── builder │ │ ├── profile.rs │ │ └── profile │ │ │ ├── cabf.rs │ │ │ ├── cabf │ │ │ └── tls.rs │ │ │ └── devid.rs │ ├── certificate.rs │ ├── crl.rs │ ├── ext.rs │ ├── ext │ │ ├── pkix.rs │ │ └── pkix │ │ │ ├── access.rs │ │ │ ├── authkeyid.rs │ │ │ ├── certpolicy.rs │ │ │ ├── constraints.rs │ │ │ ├── constraints │ │ │ ├── basic.rs │ │ │ ├── name.rs │ │ │ └── policy.rs │ │ │ ├── crl.rs │ │ │ ├── crl │ │ │ └── dp.rs │ │ │ ├── keyusage.rs │ │ │ ├── name.rs │ │ │ ├── name │ │ │ ├── dirstr.rs │ │ │ ├── dp.rs │ │ │ ├── ediparty.rs │ │ │ ├── general.rs │ │ │ ├── hardware.rs │ │ │ └── other.rs │ │ │ ├── policymap.rs │ │ │ └── sct.rs │ ├── lib.rs │ ├── macros.rs │ ├── name.rs │ ├── request.rs │ ├── request │ │ └── builder.rs │ ├── serial_number.rs │ └── time.rs ├── test-support │ ├── .gitignore │ ├── Cargo.lock │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ ├── openssl.rs │ │ └── zlint.rs └── tests │ ├── builder.rs │ ├── builder_crl.rs │ ├── certificate.rs │ ├── certreq.rs │ ├── crl.rs │ ├── examples │ ├── 026EDA6FA1EDFA8C253936C75B5EEBD954BFF452.fake.der │ ├── 026EDA6FA1EDFA8C253936C75B5EEBD954BFF452.fake.pem │ ├── 085B1E2F40254F9C7A2387BE9FF4EC116C326E10.fake.der │ ├── 0954e2343dd5efe0a7f0967d69caf33e5f893720.der │ ├── 0fcc78fbbca9f32b08b19b032b84f2c86a128f35.der │ ├── 15b05c4865410c6b3ff76a4e8f3d87276756bd0c.der │ ├── 16ee54e48c76eaa1052e09010d8faefee95e5ebb.der │ ├── 2049a5b28f104b2c6e1a08546f9cfc0353d6fd30.der │ ├── 21723e7a0fb61a0bd4a29879b82a02b2fb4ad096.der │ ├── 284A0A3A9B56DD752DAA2E09E2FADEDB858D9338.fake.der │ ├── 28879DABB0FD11618FB74E47BE049D2933866D53.fake.der │ ├── 288C8BCFEE6B89D110DAE2C9873897BF7FF53382.fake.der │ ├── 28903a635b5280fae6774c0b6da7d6baa64af2e8.der │ ├── 33D8388EDA1E92475EF19075D2EF4093D1CB6F7F.fake.der │ ├── 342cd9d3062da48c346965297f081ebc2ef68fdc.der │ ├── 554D5FF11DA613A155584D8D4AA07F67724D8077.fake.der │ ├── GoodCACRL.crl │ ├── GoodCACert.crt │ ├── amazon.der │ ├── amazon.pem │ ├── crates.io-chain.pem │ ├── eca.der │ ├── eca_policies.ta │ ├── entrust.der │ ├── entrust_dnConstraint.ta │ ├── exostar.der │ ├── exostar_policyFlags.ta │ ├── p256-priv.der │ ├── p256-pub.der │ ├── qualcomm.pem │ ├── raytheon.der │ ├── raytheon_pathLenConstraint.ta │ ├── rsa2048-crt.der │ ├── rsa2048-crt.pem │ ├── rsa2048-csr.der │ ├── rsa2048-csr.pem │ ├── rsa2048-priv.der │ ├── rsa2048-prv.der │ ├── rsa2048-prv.pem │ ├── rsa2048-pub.der │ ├── tscpbcasha256.crl │ └── windows_bmpstring.pem │ ├── general_name.rs │ ├── name.rs │ ├── pkix_extensions.rs │ ├── trust_anchor_format.rs │ └── validity.rs ├── x509-ocsp ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── src │ ├── basic.rs │ ├── builder.rs │ ├── builder │ │ ├── request.rs │ │ └── response.rs │ ├── cert_id.rs │ ├── cert_status.rs │ ├── ext.rs │ ├── lib.rs │ ├── request.rs │ ├── responder_id.rs │ ├── response.rs │ └── time.rs └── tests │ ├── builder.rs │ ├── examples │ ├── DODEMAILCA_63-resp.der │ ├── ocsp-by-key-res.der │ ├── ocsp-dtm-no-chain-res.der │ ├── ocsp-internal-error.der │ ├── ocsp-malformed.der │ ├── ocsp-multiple-exts-clean-req.der │ ├── ocsp-multiple-exts-res.der │ ├── ocsp-multiple-requests-nonce-req.der │ ├── ocsp-multiple-requests-req.der │ ├── ocsp-multiple-responses-res.der │ ├── ocsp-sig-required.der │ ├── ocsp-signed-req.der │ ├── ocsp-try-later.der │ ├── ocsp-unauthorized.der │ ├── rsa-2048-sha256-ca-crl.der │ ├── rsa-2048-sha256-ca-key.der │ ├── rsa-2048-sha256-ca.der │ ├── rsa-2048-sha256-crt-key.der │ ├── rsa-2048-sha256-crt.der │ ├── rsa-2048-sha256-ocsp-crt-key.der │ ├── rsa-2048-sha256-ocsp-crt.der │ ├── rsa-2048-sha256-revoked-ocsp-res.der │ ├── sha1-certid-ocsp-req.der │ ├── sha1-certid-ocsp-res.der │ ├── sha224-certid-ocsp-req.der │ ├── sha256-certid-ocsp-req.der │ ├── sha256-certid-ocsp-res.der │ ├── sha384-certid-ocsp-req.der │ ├── sha512-certid-ocsp-req.der │ └── sha512-certid-ocsp-res.der │ ├── ext.rs │ ├── ocsp.rs │ ├── requests.rs │ └── responses.rs └── x509-tsp ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md └── src └── lib.rs /.cargo/audit.toml: -------------------------------------------------------------------------------- 1 | [advisories] 2 | ignore = [ 3 | "RUSTSEC-2024-0436", #paste 4 | "RUSTSEC-2023-0071", #rsa marvin attack - patched in 0.10, we're depending on 0.10.0-rc.0 5 | ] # advisory IDs to ignore e.g. ["RUSTSEC-2019-0001", ...] 6 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: cargo 4 | directory: "/" 5 | schedule: 6 | interval: weekly 7 | open-pull-requests-limit: 10 8 | - package-ecosystem: github-actions 9 | directory: "/" 10 | schedule: 11 | interval: "weekly" 12 | open-pull-requests-limit: 10 13 | -------------------------------------------------------------------------------- /.github/workflows/security-audit.yml: -------------------------------------------------------------------------------- 1 | name: Security Audit 2 | on: 3 | pull_request: 4 | paths: 5 | - "Cargo.lock" 6 | - ".github/workflows/security-audit.yml" 7 | push: 8 | branches: master 9 | paths: 10 | - "Cargo.lock" 11 | - ".github/workflows/security-audit.yml" 12 | schedule: 13 | - cron: "0 0 * * *" 14 | 15 | jobs: 16 | security_audit: 17 | name: Security Audit 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: actions/checkout@v4 21 | - uses: dtolnay/rust-toolchain@master 22 | with: 23 | toolchain: stable 24 | - uses: actions/cache@v4 25 | with: 26 | path: ~/.cargo/bin 27 | key: ${{ runner.os }}-cargo-audit-v0.21.2 28 | - uses: rustsec/audit-check@v2 29 | with: 30 | token: ${{ secrets.GITHUB_TOKEN }} 31 | 32 | -------------------------------------------------------------------------------- /.github/workflows/tai64_update_leap_seconds.yml: -------------------------------------------------------------------------------- 1 | name: Update Leap Seconds 2 | on: 3 | schedule: 4 | - cron: 0 0 * * 1 5 | 6 | jobs: 7 | update: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v4 11 | with: 12 | fetch-depth: 0 13 | - name: Update leap seconds in code 14 | run: | 15 | curl -o leap_seconds_list -L https://data.iana.org/time-zones/data/leap-seconds.list 16 | number=$(grep -v '^#' leap_seconds_list | tail -n1 | awk '{print $2}') 17 | sed -i "s/\(1970-01-01 00:00:\)[0-9]\+ TAI/\1${number} TAI/" tai64/src/lib.rs 18 | sed -i -E 's/(Self\()[0-9]+ \+ \(1 << 62\)\)/\1'"${number}"' + (1 << 62))/' tai64/src/lib.rs 19 | rm leap_seconds_list 20 | - name: Create Pull Request 21 | uses: peter-evans/create-pull-request@v7 22 | with: 23 | commit-message: update leap seconds in tai64 24 | title: Update leap seconds in tai64 25 | body: 'Following this source: https://data.iana.org/time-zones/data/leap-seconds.list, the leap seconds counter has been updated.' 26 | branch: update-leap-seconds 27 | base: master 28 | delete-branch: true 29 | -------------------------------------------------------------------------------- /.github/workflows/workspace.yml: -------------------------------------------------------------------------------- 1 | name: Workspace 2 | 3 | on: 4 | pull_request: 5 | paths-ignore: 6 | - README.md 7 | push: 8 | branches: master 9 | paths-ignore: 10 | - README.md 11 | 12 | env: 13 | CARGO_INCREMENTAL: 0 14 | RUSTFLAGS: "-Dwarnings" 15 | RUSTDOCFLAGS: "-Dwarnings" 16 | 17 | jobs: 18 | clippy: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | - uses: dtolnay/rust-toolchain@master 23 | with: 24 | toolchain: 1.87.0 25 | components: clippy 26 | - run: cargo clippy --all --all-features --tests 27 | 28 | doc: 29 | runs-on: ubuntu-latest 30 | steps: 31 | - uses: actions/checkout@v4 32 | 33 | - uses: dtolnay/rust-toolchain@master 34 | with: 35 | toolchain: stable 36 | - run: cargo doc --workspace --all-features 37 | 38 | rustfmt: 39 | runs-on: ubuntu-latest 40 | steps: 41 | - uses: actions/checkout@v4 42 | - uses: dtolnay/rust-toolchain@master 43 | with: 44 | toolchain: stable 45 | components: rustfmt 46 | - run: cargo fmt --all -- --check 47 | 48 | typos: 49 | runs-on: ubuntu-latest 50 | steps: 51 | - uses: actions/checkout@v4 52 | - uses: crate-ci/typos@v1.33.1 53 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | **/*.rs.bk 3 | 4 | # CLion IDE 5 | .idea 6 | 7 | # VS Code IDE 8 | .vscode 9 | -------------------------------------------------------------------------------- /.typos.toml: -------------------------------------------------------------------------------- 1 | [files] 2 | extend-exclude = [ 3 | ".git/", 4 | "const-oid/oiddbgen/*.txt", 5 | "const-oid/oiddbgen/ldap-parameters-3.csv", 6 | "const-oid/src/db/generated.rs", 7 | "der/src/asn1/context_specific.rs", 8 | "pem-rfc7468/README.md", 9 | "pkcs12/tests/cert_tests.rs", 10 | "x509-ocsp/tests/responses.rs", 11 | ] 12 | 13 | [default.extend-identifiers] 14 | # typ stands for type, but it's a reversed identifier 15 | typ = "typ" 16 | 17 | [default.extend-words] 18 | # Certificate Ann 19 | "cann" = "cann" 20 | # encrypt-decrypt-encrypt 21 | "EDE" = "EDE" 22 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Security updates are applied only to the most recent release. 6 | 7 | ## Reporting a Vulnerability 8 | 9 | If you have discovered a security vulnerability in this project, please report 10 | it privately. **Do not disclose it as a public issue.** This gives us time to 11 | work with you to fix the issue before public exposure, reducing the chance that 12 | the exploit will be used before a patch is released. 13 | 14 | Please disclose it at [security advisory](https://github.com/RustCrypto/formats/security/advisories/new). 15 | 16 | This project is maintained by a team of volunteers on a reasonable-effort basis. 17 | As such, please give us at least 90 days to work on a fix before public exposure. 18 | -------------------------------------------------------------------------------- /base16ct/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## 0.2.0 (2023-02-26) 8 | ### Changed 9 | - MSRV 1.60 ([#802]) 10 | - Lint improvements ([#824]) 11 | 12 | [#802]: https://github.com/RustCrypto/formats/pull/802 13 | [#824]: https://github.com/RustCrypto/formats/pull/824 14 | 15 | ## 0.1.1 (2022-01-15) 16 | ### Added 17 | - `HexDisplay` type ([#329]) 18 | 19 | [#329]: https://github.com/RustCrypto/formats/pull/329 20 | 21 | ## 0.1.0 (2022-01-12) 22 | - Initial release 23 | -------------------------------------------------------------------------------- /base16ct/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "base16ct" 3 | version = "0.2.0" 4 | description = """ 5 | Pure Rust implementation of Base16 a.k.a hexadecimal (RFC 4648) which avoids 6 | any usages of data-dependent branches/LUTs and thereby provides portable 7 | "best effort" constant-time operation and embedded-friendly no_std support 8 | """ 9 | authors = ["RustCrypto Developers"] 10 | license = "Apache-2.0 OR MIT" 11 | documentation = "https://docs.rs/base16ct" 12 | homepage = "https://github.com/RustCrypto/formats/tree/master/base16ct" 13 | repository = "https://github.com/RustCrypto/formats" 14 | categories = ["cryptography", "encoding", "no-std", "parser-implementations"] 15 | keywords = ["crypto", "hex", "hexadecimal"] 16 | readme = "README.md" 17 | edition = "2024" 18 | rust-version = "1.85" 19 | 20 | [features] 21 | alloc = [] 22 | std = ["alloc"] 23 | 24 | [package.metadata.docs.rs] 25 | all-features = true 26 | rustdoc-args = ["--cfg", "docsrs"] 27 | -------------------------------------------------------------------------------- /base16ct/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) 2 | Copyright (c) 2022-2025 The RustCrypto Project Developers 3 | 4 | Permission is hereby granted, free of charge, to any 5 | person obtaining a copy of this software and associated 6 | documentation files (the "Software"), to deal in the 7 | Software without restriction, including without 8 | limitation the rights to use, copy, modify, merge, 9 | publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software 11 | is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice 15 | shall be included in all copies or substantial portions 16 | of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 19 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 20 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 21 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 22 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 25 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 26 | DEALINGS IN THE SOFTWARE. 27 | -------------------------------------------------------------------------------- /base16ct/src/display.rs: -------------------------------------------------------------------------------- 1 | use core::fmt; 2 | 3 | /// `core::fmt` presenter for binary data encoded as hexadecimal (Base16). 4 | #[derive(Copy, Clone, Debug, Eq, PartialEq)] 5 | pub struct HexDisplay<'a>(pub &'a [u8]); 6 | 7 | impl fmt::Display for HexDisplay<'_> { 8 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 9 | write!(f, "{self:X}") 10 | } 11 | } 12 | 13 | impl fmt::UpperHex for HexDisplay<'_> { 14 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 15 | let mut hex = [0u8; 2]; 16 | 17 | for &byte in self.0 { 18 | f.write_str(crate::upper::encode_str(&[byte], &mut hex)?)?; 19 | } 20 | 21 | Ok(()) 22 | } 23 | } 24 | 25 | impl fmt::LowerHex for HexDisplay<'_> { 26 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 27 | let mut hex = [0u8; 2]; 28 | 29 | for &byte in self.0 { 30 | f.write_str(crate::lower::encode_str(&[byte], &mut hex)?)?; 31 | } 32 | 33 | Ok(()) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /base16ct/src/error.rs: -------------------------------------------------------------------------------- 1 | use core::fmt; 2 | 3 | /// Result type with the `base16ct` crate's [`Error`] type. 4 | pub type Result = core::result::Result; 5 | 6 | /// Error type 7 | #[derive(Clone, Eq, PartialEq, Debug)] 8 | pub enum Error { 9 | /// Invalid encoding of provided Base16 string. 10 | InvalidEncoding, 11 | 12 | /// Insufficient output buffer length. 13 | InvalidLength, 14 | } 15 | 16 | impl fmt::Display for Error { 17 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 18 | match self { 19 | Error::InvalidEncoding => f.write_str("invalid Base16 encoding"), 20 | Error::InvalidLength => f.write_str("invalid Base16 length"), 21 | } 22 | } 23 | } 24 | 25 | impl core::error::Error for Error {} 26 | 27 | impl From for fmt::Error { 28 | fn from(_: Error) -> fmt::Error { 29 | fmt::Error 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /base32ct/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## 0.2.2 (2025-02-23) 8 | ### Added 9 | - `const fn` for `encoded_len` ([#1424]) 10 | 11 | [#1424]: https://github.com/RustCrypto/formats/pull/1424 12 | 13 | ## 0.2.1 (2024-05-28) 14 | ### Added 15 | - Support for Base32 upper unpadded alphabet ([#1406]) 16 | 17 | ### Fixed 18 | - Broken encoding of unpadded base32 ([#1421]) 19 | 20 | [#1406]: https://github.com/RustCrypto/formats/pull/1406 21 | [#1421]: https://github.com/RustCrypto/formats/pull/1421 22 | 23 | ## 0.2.0 (2023-02-26) 24 | ### Changed 25 | - MSRV 1.60 ([#802]) 26 | - Lint improvements ([#824]) 27 | 28 | [#802]: https://github.com/RustCrypto/formats/pull/802 29 | [#824]: https://github.com/RustCrypto/formats/pull/824 30 | 31 | ## 0.1.0 (2022-06-12) 32 | - Initial release 33 | -------------------------------------------------------------------------------- /base32ct/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "base32ct" 3 | version = "0.2.2" 4 | description = """ 5 | Pure Rust implementation of Base32 (RFC 4648) which avoids any usages of 6 | data-dependent branches/LUTs and thereby provides portable "best effort" 7 | constant-time operation and embedded-friendly no_std support 8 | """ 9 | authors = ["RustCrypto Developers"] 10 | license = "Apache-2.0 OR MIT" 11 | documentation = "https://docs.rs/base32ct" 12 | homepage = "https://github.com/RustCrypto/formats/tree/master/base32ct" 13 | repository = "https://github.com/RustCrypto/formats" 14 | categories = ["cryptography", "encoding", "no-std", "parser-implementations"] 15 | keywords = ["crypto"] 16 | readme = "README.md" 17 | edition = "2024" 18 | rust-version = "1.85" 19 | 20 | [dev-dependencies] 21 | base32 = "0.5" 22 | proptest = { version = "1.6", default-features = false, features = ["std"] } 23 | 24 | [features] 25 | alloc = [] 26 | std = ["alloc"] 27 | 28 | [package.metadata.docs.rs] 29 | all-features = true 30 | rustdoc-args = ["--cfg", "docsrs"] 31 | -------------------------------------------------------------------------------- /base32ct/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) 2 | Copyright (c) 2016-2018 Paragon Initiative Enterprises. 3 | Copyright (c) 2022-2025 The RustCrypto Project Developers 4 | 5 | Permission is hereby granted, free of charge, to any 6 | person obtaining a copy of this software and associated 7 | documentation files (the "Software"), to deal in the 8 | Software without restriction, including without 9 | limitation the rights to use, copy, modify, merge, 10 | publish, distribute, sublicense, and/or sell copies of 11 | the Software, and to permit persons to whom the Software 12 | is furnished to do so, subject to the following 13 | conditions: 14 | 15 | The above copyright notice and this permission notice 16 | shall be included in all copies or substantial portions 17 | of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 20 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 21 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 22 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 23 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 24 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 26 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | DEALINGS IN THE SOFTWARE. 28 | -------------------------------------------------------------------------------- /base32ct/src/error.rs: -------------------------------------------------------------------------------- 1 | //! Error types. 2 | 3 | use core::fmt; 4 | 5 | /// Result type with the `base32ct` crate's [`Error`] type. 6 | pub type Result = core::result::Result; 7 | 8 | /// Error type 9 | #[derive(Clone, Eq, PartialEq, Debug)] 10 | pub enum Error { 11 | /// Invalid encoding of provided Base32 string. 12 | InvalidEncoding, 13 | 14 | /// Insufficient output buffer length. 15 | InvalidLength, 16 | } 17 | 18 | impl fmt::Display for Error { 19 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 20 | match self { 21 | Error::InvalidEncoding => f.write_str("invalid Base32 encoding"), 22 | Error::InvalidLength => f.write_str("invalid Base32 length"), 23 | } 24 | } 25 | } 26 | 27 | #[cfg(feature = "std")] 28 | impl std::error::Error for Error {} 29 | -------------------------------------------------------------------------------- /base32ct/tests/proptests.proptest-regressions: -------------------------------------------------------------------------------- 1 | # Seeds for failure cases proptest has generated in the past. It is 2 | # automatically read and these particular cases re-run before any 3 | # novel cases are generated. 4 | # 5 | # It is recommended to check this file in to source control so that 6 | # everyone who runs the test benefits from these saved cases. 7 | cc ff6848328162b13284e5d9d6145abc4b3e6bda96d267b760d914394a258fd11a # shrinks to bytes = [205, 180] 8 | -------------------------------------------------------------------------------- /base64ct/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "base64ct" 3 | version = "1.8.0" 4 | description = """ 5 | Pure Rust implementation of Base64 (RFC 4648) which avoids any usages of 6 | data-dependent branches/LUTs and thereby provides portable "best effort" 7 | constant-time operation and embedded-friendly no_std support 8 | """ 9 | authors = ["RustCrypto Developers"] 10 | license = "Apache-2.0 OR MIT" 11 | documentation = "https://docs.rs/base64ct" 12 | homepage = "https://github.com/RustCrypto/formats/tree/master/base64ct" 13 | repository = "https://github.com/RustCrypto/formats" 14 | categories = ["cryptography", "encoding", "no-std", "parser-implementations"] 15 | keywords = ["crypto", "base64", "pem", "phc"] 16 | readme = "README.md" 17 | edition = "2024" 18 | rust-version = "1.85" 19 | 20 | [dev-dependencies] 21 | base64 = "0.22" 22 | proptest = { version = "1.6", default-features = false, features = ["std"] } 23 | 24 | [features] 25 | alloc = [] 26 | std = ["alloc"] 27 | 28 | [package.metadata.docs.rs] 29 | all-features = true 30 | rustdoc-args = ["--cfg", "docsrs"] 31 | -------------------------------------------------------------------------------- /base64ct/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) 2 | Copyright (c) 2021-2025 The RustCrypto Project Developers 3 | 4 | Permission is hereby granted, free of charge, to any 5 | person obtaining a copy of this software and associated 6 | documentation files (the "Software"), to deal in the 7 | Software without restriction, including without 8 | limitation the rights to use, copy, modify, merge, 9 | publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software 11 | is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice 15 | shall be included in all copies or substantial portions 16 | of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 19 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 20 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 21 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 22 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 25 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 26 | DEALINGS IN THE SOFTWARE. 27 | -------------------------------------------------------------------------------- /base64ct/src/alphabet/bcrypt.rs: -------------------------------------------------------------------------------- 1 | //! bcrypt Base64 encoding. 2 | 3 | use super::{Alphabet, DecodeStep, EncodeStep}; 4 | 5 | /// bcrypt Base64 encoding. 6 | /// 7 | /// ```text 8 | /// ./ [A-Z] [a-z] [0-9] 9 | /// 0x2e-0x2f, 0x41-0x5a, 0x61-0x7a, 0x30-0x39 10 | /// ``` 11 | #[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] 12 | pub struct Base64Bcrypt; 13 | 14 | impl Alphabet for Base64Bcrypt { 15 | const BASE: u8 = b'.'; 16 | 17 | const DECODER: &'static [DecodeStep] = &[ 18 | DecodeStep::Range(b'.'..=b'/', -45), 19 | DecodeStep::Range(b'A'..=b'Z', -62), 20 | DecodeStep::Range(b'a'..=b'z', -68), 21 | DecodeStep::Range(b'0'..=b'9', 7), 22 | ]; 23 | 24 | const ENCODER: &'static [EncodeStep] = &[ 25 | EncodeStep::Apply(b'/', 17), 26 | EncodeStep::Apply(b'Z', 6), 27 | EncodeStep::Apply(b'z', -75), 28 | ]; 29 | 30 | const PADDED: bool = false; 31 | 32 | type Unpadded = Self; 33 | } 34 | -------------------------------------------------------------------------------- /base64ct/src/alphabet/crypt.rs: -------------------------------------------------------------------------------- 1 | //! `crypt(3)` Base64 encoding. 2 | 3 | use super::{Alphabet, DecodeStep, EncodeStep}; 4 | 5 | /// `crypt(3)` Base64 encoding. 6 | /// 7 | /// ```text 8 | /// [.-9] [A-Z] [a-z] 9 | /// 0x2e-0x39, 0x41-0x5a, 0x61-0x7a 10 | /// ``` 11 | #[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] 12 | pub struct Base64Crypt; 13 | 14 | impl Alphabet for Base64Crypt { 15 | const BASE: u8 = b'.'; 16 | 17 | const DECODER: &'static [DecodeStep] = &[ 18 | DecodeStep::Range(b'.'..=b'9', -45), 19 | DecodeStep::Range(b'A'..=b'Z', -52), 20 | DecodeStep::Range(b'a'..=b'z', -58), 21 | ]; 22 | 23 | const ENCODER: &'static [EncodeStep] = 24 | &[EncodeStep::Apply(b'9', 7), EncodeStep::Apply(b'Z', 6)]; 25 | 26 | const PADDED: bool = false; 27 | 28 | type Unpadded = Self; 29 | } 30 | -------------------------------------------------------------------------------- /cmpv2/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## 0.2.0 (2023-06-25) 8 | - Initial release 9 | 10 | ## 0.1.0 11 | - Skipped 12 | -------------------------------------------------------------------------------- /cmpv2/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cmpv2" 3 | version = "0.3.0-pre.0" 4 | description = """ 5 | Pure Rust implementation of the Certificate Management Protocol (CMP) as 6 | described in RFC 4210 7 | """ 8 | authors = ["RustCrypto Developers"] 9 | license = "Apache-2.0 OR MIT" 10 | homepage = "https://github.com/RustCrypto/formats/tree/master/cmpv2" 11 | repository = "https://github.com/RustCrypto/formats" 12 | categories = ["cryptography", "data-structures", "encoding", "no-std"] 13 | keywords = ["crypto"] 14 | readme = "README.md" 15 | edition = "2024" 16 | rust-version = "1.85" 17 | 18 | [dependencies] 19 | crmf = "=0.3.0-pre.0" 20 | der = { version = "0.8.0-rc.3", features = ["alloc", "derive", "flagset", "oid"] } 21 | spki = { version = "0.8.0-rc.0" } 22 | x509-cert = { version = "=0.3.0-pre.0", default-features = false } 23 | 24 | digest = { version = "0.11.0-pre.10", optional = true, default-features = false } 25 | 26 | [dev-dependencies] 27 | const-oid = { version = "0.10.0-rc.0", features = ["db"] } 28 | hex-literal = "1" 29 | 30 | [features] 31 | alloc = ["der/alloc"] 32 | std = ["der/std", "spki/std"] 33 | 34 | pem = ["alloc", "der/pem"] 35 | digest = ["dep:digest", "x509-cert/digest"] 36 | 37 | [package.metadata.docs.rs] 38 | all-features = true 39 | rustdoc-args = ["--cfg", "docsrs"] 40 | -------------------------------------------------------------------------------- /cmpv2/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2023-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /cmpv2/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![cfg_attr(docsrs, feature(doc_auto_cfg))] 3 | #![doc = include_str!("../README.md")] 4 | #![doc( 5 | html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg", 6 | html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg" 7 | )] 8 | #![forbid(unsafe_code)] 9 | #![warn( 10 | missing_docs, 11 | rust_2018_idioms, 12 | unused_lifetimes, 13 | unused_qualifications 14 | )] 15 | 16 | extern crate alloc; 17 | 18 | #[cfg(feature = "std")] 19 | extern crate std; 20 | 21 | pub mod ann; 22 | pub mod body; 23 | pub mod certified_key_pair; 24 | pub mod gp; 25 | pub mod header; 26 | pub mod message; 27 | pub mod oob; 28 | pub mod parameter; 29 | pub mod poll; 30 | pub mod pop; 31 | pub mod response; 32 | pub mod rev; 33 | pub mod status; 34 | -------------------------------------------------------------------------------- /cmpv2/tests/examples/cr_req_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/cr_req_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/cr_rsp_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/cr_rsp_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/ec384-ca-key.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB+zCCAYACFFSDe6u+lHeYkm/UL2Lgmhui9knEMAoGCCqGSM49BAMCMGExCzAJ 3 | BgNVBAYTAlVTMQswCQYDVQQIDAJWQTESMBAGA1UEBwwJQXJsaW5ndG9uMRIwEAYD 4 | VQQKDAlSZWQgSG91bmQxEDAOBgNVBAsMB1Rlc3RpbmcxCzAJBgNVBAMMAkNBMB4X 5 | DTIzMDExNjE4NTMwM1oXDTMzMDExMzE4NTMwM1owYTELMAkGA1UEBhMCVVMxCzAJ 6 | BgNVBAgMAlZBMRIwEAYDVQQHDAlBcmxpbmd0b24xEjAQBgNVBAoMCVJlZCBIb3Vu 7 | ZDEQMA4GA1UECwwHVGVzdGluZzELMAkGA1UEAwwCQ0EwdjAQBgcqhkjOPQIBBgUr 8 | gQQAIgNiAAQ84gJK1r6T77zvESQBEXVE4RpvH2MU4g8n7t8f1bXO/TdmI/SGqUHL 9 | Owt6In1PEs/eGPdBNaZ3fFFYBPlxOxPwlZ6GoJKHIw6Quart2+orED/rqqWZ1lj6 10 | 9sGtGP+nQtAwCgYIKoZIzj0EAwIDaQAwZgIxAJZiaBpEf/a6RNNnRyxWPp+rsVQ0 11 | rx22Qzzm+jXUg5+14gC1RFrlBOGQfYzS27kS4wIxAOJaOet3NhZzqeBmtr5TwA3A 12 | /mQcVmzkFFAua6M/GKfJ7te35aNiPnzBBpIHzfmqIQ== 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /cmpv2/tests/examples/ec384-ee-key.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/ec384-ee-key.der -------------------------------------------------------------------------------- /cmpv2/tests/examples/ec384-server-key.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB+zCCAYICFDrVMSBWBF/MNqrlex7goCLHnBoHMAoGCCqGSM49BAMCMGIxCzAJ 3 | BgNVBAYTAlVTMQswCQYDVQQIDAJWQTESMBAGA1UEBwwJQXJsaW5ndG9uMRIwEAYD 4 | VQQKDAlSZWQgSG91bmQxEDAOBgNVBAsMB1Rlc3RpbmcxDDAKBgNVBAMMA0NNUDAe 5 | Fw0yMzAxMTYxMjEwMjBaFw0yNDAxMTYxMjEwMjBaMGIxCzAJBgNVBAYTAlVTMQsw 6 | CQYDVQQIDAJWQTESMBAGA1UEBwwJQXJsaW5ndG9uMRIwEAYDVQQKDAlSZWQgSG91 7 | bmQxEDAOBgNVBAsMB1Rlc3RpbmcxDDAKBgNVBAMMA0NNUDB2MBAGByqGSM49AgEG 8 | BSuBBAAiA2IABJd3ntrQPyJ/CmvXIaNaIa2lQHmhy2yVvG2i0arLhcYQlJyqZ16K 9 | lb5h5z4OgywAL3skIpKZFLwvzZHxwT/4xkP9HxZ5y+a8A4ztRKwkxFWsDue84JHu 10 | Hmn12DhqObUJcTAKBggqhkjOPQQDAgNnADBkAjB5HLgkKYYsjrF+dvn2jrLJHK+M 11 | eYWKOMV9uXqBFwblejMw+aL9Rmi4p2DE50RKdDYCMEpI8Z5s9ogq7uOYODkS79Wu 12 | r/UxLb4gqpt0dLSz8a9RTvp2tOB7y6wg6Ufhbvd3Jw== 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /cmpv2/tests/examples/ec384-server-key.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/ec384-server-key.der -------------------------------------------------------------------------------- /cmpv2/tests/examples/ec384-server-key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PRIVATE KEY----- 2 | MIGkAgEBBDAnGoMa3q+JxrYKhs1QsfNj8xG4IAM6CaFoT62tQ66OxBYFyDaTqw1Q 3 | HtP1eMkHjligBwYFK4EEACKhZANiAASXd57a0D8ifwpr1yGjWiGtpUB5octslbxt 4 | otGqy4XGEJScqmdeipW+Yec+DoMsAC97JCKSmRS8L82R8cE/+MZD/R8WecvmvAOM 5 | 7USsJMRVrA7nvOCR7h5p9dg4ajm1CXE= 6 | -----END EC PRIVATE KEY----- 7 | -------------------------------------------------------------------------------- /cmpv2/tests/examples/failed_kur_rsp_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/failed_kur_rsp_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/genm_req_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/genm_req_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/genm_req_body_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/genm_req_body_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/genm_req_header_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/genm_req_header_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/genm_rsp_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/genm_rsp_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/ir_req_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/ir_req_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/ir_req_body_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/ir_req_body_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/ir_req_header_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/ir_req_header_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/ir_rsp_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/ir_rsp_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/ir_rsp_body_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/ir_rsp_body_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/ir_rsp_header_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/ir_rsp_header_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/kur_req_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/kur_req_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/kur_req_body_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/kur_req_body_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/kur_req_header_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/kur_req_header_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/kur_rsp_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/kur_rsp_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/p10cr_req_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/p10cr_req_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/p10cr_rsp_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/p10cr_rsp_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/rr_req_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/rr_req_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/rr_rsp_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/rr_rsp_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/rr_rsp_body_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/rr_rsp_body_01.bin -------------------------------------------------------------------------------- /cmpv2/tests/examples/rr_rsp_header_01.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cmpv2/tests/examples/rr_rsp_header_01.bin -------------------------------------------------------------------------------- /cms/src/attr.rs: -------------------------------------------------------------------------------- 1 | //! Attribute-related types 2 | use der::asn1::OctetString; 3 | 4 | use x509_cert::time::Time; 5 | 6 | use crate::signed_data::SignerInfo; 7 | 8 | /// The `MessageDigest` attribute is defined in [RFC 5652 Section 11.2]. 9 | /// 10 | /// ```text 11 | /// MessageDigest ::= OCTET STRING 12 | /// ``` 13 | /// 14 | /// [RFC 5652 Section 11.2]: https://www.rfc-editor.org/rfc/rfc5652#section-11.2 15 | pub type MessageDigest = OctetString; 16 | 17 | /// The `SigningTime` attribute is defined in [RFC 5652 Section 11.3]. 18 | /// 19 | /// ```text 20 | /// SigningTime ::= Time 21 | /// ``` 22 | /// 23 | /// [RFC 5652 Section 11.3]: https://www.rfc-editor.org/rfc/rfc5652#section-11.3 24 | pub type SigningTime = Time; 25 | 26 | /// The `Countersignature` attribute is defined in [RFC 5652 Section 11.4]. 27 | /// 28 | /// ```text 29 | /// Countersignature ::= SignerInfo 30 | /// ``` 31 | /// 32 | /// [RFC 5652 Section 11.4]: https://www.rfc-editor.org/rfc/rfc5652#section-11.4 33 | pub type Countersignature = SignerInfo; 34 | -------------------------------------------------------------------------------- /cms/src/builder/utils.rs: -------------------------------------------------------------------------------- 1 | //! Utilities module 2 | //! 3 | //! Contains various utilities used during KARI building. 4 | //! It currently contains: 5 | //! - kw: AES Key Wrap 6 | //! - kdf: KDF using ANSI-x9.63 Key Derivation Function 7 | 8 | pub(super) mod kw; 9 | -------------------------------------------------------------------------------- /cms/src/compressed_data.rs: -------------------------------------------------------------------------------- 1 | //! CompressedData-related types 2 | use der::Sequence; 3 | use spki::AlgorithmIdentifierOwned; 4 | 5 | use crate::content_info::CmsVersion; 6 | use crate::signed_data::EncapsulatedContentInfo; 7 | 8 | /// The `CompressedData` type is defined in [RFC 3274 Section 1.1]. 9 | /// 10 | /// ```text 11 | /// CompressedData ::= SEQUENCE { 12 | /// version CMSVersion, 13 | /// compressionAlgorithm CompressionAlgorithmIdentifier, 14 | /// encapContentInfo EncapsulatedContentInfo 15 | /// } 16 | /// ``` 17 | /// 18 | /// [RFC 3274 Section 1.1]: https://www.rfc-editor.org/rfc/rfc3274#section-1.1 19 | #[derive(Clone, Debug, Eq, PartialEq, Sequence)] 20 | #[allow(missing_docs)] 21 | pub struct CompressedData { 22 | pub version: CmsVersion, 23 | pub compression_alg: AlgorithmIdentifierOwned, 24 | pub encap_content_info: EncapsulatedContentInfo, 25 | } 26 | -------------------------------------------------------------------------------- /cms/src/digested_data.rs: -------------------------------------------------------------------------------- 1 | //! DigestedData-related types 2 | use der::{Sequence, asn1::OctetString}; 3 | 4 | use spki::AlgorithmIdentifierOwned; 5 | 6 | use crate::content_info::CmsVersion; 7 | use crate::signed_data::EncapsulatedContentInfo; 8 | 9 | /// The `DigestedData` type is defined in [RFC 5652 Section 7]. 10 | /// 11 | /// ```text 12 | /// DigestedData ::= SEQUENCE { 13 | /// version CMSVersion, 14 | /// digestAlgorithm DigestAlgorithmIdentifier, 15 | /// encapContentInfo EncapsulatedContentInfo, 16 | /// digest Digest 17 | /// } 18 | /// ``` 19 | /// 20 | /// [RFC 5652 Section 7]: https://www.rfc-editor.org/rfc/rfc5652#section-7 21 | #[derive(Clone, Debug, Eq, PartialEq, Sequence)] 22 | #[allow(missing_docs)] 23 | pub struct DigestedData { 24 | pub version: CmsVersion, 25 | pub digest_alg: AlgorithmIdentifierOwned, 26 | pub encap_content_info: EncapsulatedContentInfo, 27 | pub digest: Digest, 28 | } 29 | 30 | /// The `Digest` type is defined in [RFC 5652 Section 7]. 31 | /// 32 | /// ```text 33 | /// Digest ::= OCTET STRING 34 | /// ``` 35 | /// 36 | /// [RFC 5652 Section 7]: https://www.rfc-editor.org/rfc/rfc5652#section-7 37 | pub type Digest = OctetString; 38 | -------------------------------------------------------------------------------- /cms/src/encrypted_data.rs: -------------------------------------------------------------------------------- 1 | //! EncryptedData-related types 2 | use der::Sequence; 3 | 4 | use x509_cert::attr::Attributes; 5 | 6 | use crate::content_info::CmsVersion; 7 | use crate::enveloped_data::EncryptedContentInfo; 8 | 9 | /// The `EncryptedData` type is defined in [RFC 5652 Section 8]. 10 | /// 11 | /// ```text 12 | /// EncryptedData ::= SEQUENCE { 13 | /// version CMSVersion, 14 | /// encryptedContentInfo EncryptedContentInfo, 15 | /// ..., 16 | /// [[2: unprotectedAttrs [1] IMPLICIT Attributes 17 | /// {{UnprotectedEncAttributes}} OPTIONAL ]] } 18 | /// ``` 19 | /// 20 | /// [RFC 5652 Section 8]: https://www.rfc-editor.org/rfc/rfc5652#section-8 21 | #[derive(Clone, Debug, Eq, PartialEq, Sequence)] 22 | #[allow(missing_docs)] 23 | pub struct EncryptedData { 24 | pub version: CmsVersion, 25 | pub enc_content_info: EncryptedContentInfo, 26 | #[asn1( 27 | context_specific = "1", 28 | tag_mode = "IMPLICIT", 29 | constructed = "true", 30 | optional = "true" 31 | )] 32 | pub unprotected_attrs: Option, 33 | } 34 | -------------------------------------------------------------------------------- /cms/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![cfg_attr(docsrs, feature(doc_auto_cfg))] 3 | #![doc = include_str!("../README.md")] 4 | #![doc( 5 | html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg", 6 | html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg" 7 | )] 8 | #![forbid(unsafe_code)] 9 | #![warn( 10 | missing_docs, 11 | rust_2018_idioms, 12 | unused_lifetimes, 13 | unused_qualifications 14 | )] 15 | 16 | //! # `p7b` support 17 | //! 18 | //! This crate can be used to convert an X.509 certificate into a certs-only 19 | //! [`signed_data::SignedData`] message, a.k.a `.p7b` file. 20 | //! 21 | //! Use a [`TryFrom`] conversion between [`cert::x509::Certificate`] and 22 | //! [`content_info::ContentInfo`] to generate the data structures, then use 23 | //! `to_der` to serialize it. 24 | 25 | extern crate alloc; 26 | 27 | #[cfg(feature = "std")] 28 | extern crate std; 29 | 30 | pub mod attr; 31 | pub mod authenticated_data; 32 | pub mod authenveloped_data; 33 | pub mod builder; 34 | pub mod cert; 35 | pub mod compressed_data; 36 | pub mod content_info; 37 | pub mod digested_data; 38 | pub mod encrypted_data; 39 | pub mod enveloped_data; 40 | pub mod kemri; 41 | pub mod revocation; 42 | pub mod signed_data; 43 | pub mod timestamped_data; 44 | -------------------------------------------------------------------------------- /cms/tests/examples/1.3.6.1.4.1.22554.5.6.1_ML-KEM-512-ipd_kemri_auth.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/1.3.6.1.4.1.22554.5.6.1_ML-KEM-512-ipd_kemri_auth.der -------------------------------------------------------------------------------- /cms/tests/examples/1.3.6.1.4.1.22554.5.6.1_ML-KEM-512-ipd_kemri_id-alg-hkdf-with-sha256.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/1.3.6.1.4.1.22554.5.6.1_ML-KEM-512-ipd_kemri_id-alg-hkdf-with-sha256.der -------------------------------------------------------------------------------- /cms/tests/examples/1.3.6.1.4.1.22554.5.6.1_ML-KEM-512-ipd_kemri_ukm.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/1.3.6.1.4.1.22554.5.6.1_ML-KEM-512-ipd_kemri_ukm.der -------------------------------------------------------------------------------- /cms/tests/examples/GoodCACert.crt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/GoodCACert.crt -------------------------------------------------------------------------------- /cms/tests/examples/GoodCACert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDfDCCAmSgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBFMQswCQYDVQQGEwJVUzEf 3 | MB0GA1UEChMWVGVzdCBDZXJ0aWZpY2F0ZXMgMjAxMTEVMBMGA1UEAxMMVHJ1c3Qg 4 | QW5jaG9yMB4XDTEwMDEwMTA4MzAwMFoXDTMwMTIzMTA4MzAwMFowQDELMAkGA1UE 5 | BhMCVVMxHzAdBgNVBAoTFlRlc3QgQ2VydGlmaWNhdGVzIDIwMTExEDAOBgNVBAMT 6 | B0dvb2QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCQWJpHYo37 7 | Xfb7oJSPe+WvfTlzIG21WQ7MyMbGtK/m8mejCzR6c+f/pJhEH/OcDSMsXq8h5kXa 8 | BGqWK+vSwD/Pzp5OYGptXmGPcthDtAwlrafkGOS4GqIJ8+k9XGKs+vQUXJKsOk47 9 | RuzD6PZupq4s16xaLVqYbUC26UcY08GpnoLNHJZS/EmXw1ZZ3d4YZjNlpIpWFNHn 10 | UGmdiGKXUPX/9H0fVjIAaQwjnGAbpgyCumWgzIwPpX+ElFOUr3z7BoVnFKhIXze+ 11 | VmQGSWxZxvWDUN90Ul0tLEpLgk3OVxUB4VUGuf15OJOpgo1xibINPmWt14Vda2N9 12 | yrNKloJGZNqLAgMBAAGjfDB6MB8GA1UdIwQYMBaAFOR9X9FclYYILAWuvnW2ZafZ 13 | XahmMB0GA1UdDgQWBBRYAYQkG7wrUpRKPaUQchRR9a86yTAOBgNVHQ8BAf8EBAMC 14 | AQYwFwYDVR0gBBAwDjAMBgpghkgBZQMCATABMA8GA1UdEwEB/wQFMAMBAf8wDQYJ 15 | KoZIhvcNAQELBQADggEBADWHlxbmdTXNwBL/llwhQqwnazK7CC2WsXBBqgNPWj7m 16 | tvQ+aLG8/50Qc2Sun7o2VnwF9D18UUe8Gj3uPUYH+oSI1vDdyKcjmMbKRU4rk0eo 17 | 3UHNDXwqIVc9CQS9smyV+x1HCwL4TTrq+LXLKx/qVij0Yqk+UJfAtrg2jnYKXsCu 18 | FMBQQnWCGrwa1g1TphRp/RmYHnMynYFmZrXtzFz+U9XEA7C+gPq4kqDI/iVfIT1s 19 | 6lBtdB50lrDVwl2oYfAvW/6sC2se2QleZidUmrziVNP4oEeXINokU6T6p//HM1FG 20 | QYw2jOvpKcKtWCSAnegEbgsGYzATKjmPJPJ0npHFqzM= 21 | -----END CERTIFICATE----- 22 | -------------------------------------------------------------------------------- /cms/tests/examples/ValidCertificatePathTest1EE.crt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/ValidCertificatePathTest1EE.crt -------------------------------------------------------------------------------- /cms/tests/examples/ValidCertificatePathTest1EE.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDeTCCAmGgAwIBAgIBATANBgkqhkiG9w0BAQsFADBAMQswCQYDVQQGEwJVUzEf 3 | MB0GA1UEChMWVGVzdCBDZXJ0aWZpY2F0ZXMgMjAxMTEQMA4GA1UEAxMHR29vZCBD 4 | QTAeFw0xMDAxMDEwODMwMDBaFw0zMDEyMzEwODMwMDBaMFMxCzAJBgNVBAYTAlVT 5 | MR8wHQYDVQQKExZUZXN0IENlcnRpZmljYXRlcyAyMDExMSMwIQYDVQQDExpWYWxp 6 | ZCBFRSBDZXJ0aWZpY2F0ZSBUZXN0MTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC 7 | AQoCggEBANncdxgQEBhgQfvneBAP+IR3cO8tblU7EaaZUj9t9L2hl/o2Hm5EQhHI 8 | U/51hpteNxKIon3ZcQjUSTVxzkbPW9BZjmUf60I9yg7cTJDYVGnPXjiyIGDdg1Eu 9 | 39vVWziRWi3PmjO0b5aQ5XYUYkNphBDPVEH5Neqe1FqXnV4QWb3g5MNZidfe8nmw 10 | h2sCwFmhKgCCFW9rEREAUzR0PfThzFZiouRl6COxgx1YUwiyMy2WvuV9M54QWidz 11 | U91dmOJLEVNYkY/qchHsu5TyDQ9QrfIWtRoAJDHlFb0XBpCqJLGs3QxSHvCLaqu4 12 | 9+3fY7TOlGi/XpbQRJbx+PR6Ogp5FVMCAwEAAaNrMGkwHwYDVR0jBBgwFoAUWAGE 13 | JBu8K1KUSj2lEHIUUfWvOskwHQYDVR0OBBYEFKg8CZ1n9thHuqLQ/BhyVohAbZWV 14 | MA4GA1UdDwEB/wQEAwIE8DAXBgNVHSAEEDAOMAwGCmCGSAFlAwIBMAEwDQYJKoZI 15 | hvcNAQELBQADggEBAB5a2Q+vYqW5Ury87AxhiBMBqgoPDUejnqmyFxv4o9ks0o04 16 | vjuyz9QxiM/OafSOx7lwBVHABofGlbT2avoxni3EF7Pt5XoZYRhujNHkDtqbbWyN 17 | BpDuLNF5WNiEzZtB0xji/pHGXwAnFGV7Evovvai/NI4tzxdMWFswDy5pZkUmJiGY 18 | 0/OQrimHWk7Gvegofg+glOb/XLVcT92KYVkOBdL/xWnA04lK0cLlyPTICMP9KiNP 19 | hABcLEQtg4rCPSLHPGDyinjjG0Zl2pmP+GPB1HqgcKZ6pxCbnax/vhTwRCOHWKwQ 20 | FejzoL8eJcs2qwJpWq7/wG6wQ54Inhk8pzBujcI= 21 | -----END CERTIFICATE----- 22 | -------------------------------------------------------------------------------- /cms/tests/examples/apple_mdm_signature_der.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/apple_mdm_signature_der.bin -------------------------------------------------------------------------------- /cms/tests/examples/authroot.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/authroot.stl -------------------------------------------------------------------------------- /cms/tests/examples/authroot.stl.sd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/authroot.stl.sd -------------------------------------------------------------------------------- /cms/tests/examples/cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIBozCCAQwCCQCdtdn0BaXo+jANBgkqhkiG9w0BAQUFADAWMRQwEgYDVQQDDAtl 3 | eGFtcGxlLm9yZzAeFw0yMTEwMjMyMjQwMTZaFw0yMjEwMjMyMjQwMTZaMBYxFDAS 4 | BgNVBAMMC2V4YW1wbGUub3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDA 5 | toQ606NWEmqm1oUahJLeu21qpQ6EoqU8n3Sjp4NZ0dCNjxLAUL4IX5HjbCGYL28g 6 | X/J09Bfc4P0MPyFm313etWMwCovk26Z3RnPeUj/AsXYdYnjs+mdfQ7ogCp49iXgk 7 | 6w7Fz1Fe1hwUuAT52FlO1WLj9uMcOOb/flpQDJ8bJQIDAQABMA0GCSqGSIb3DQEB 8 | BQUAA4GBAFvfKiLp8Jrqq3Snjedbjkidxx6TlCdGGCK0IY5GSaUHAMriwd2fvCdd 9 | uAiSp8i0KRlAY/gmHXxpv2wEL7j3XTU3SR0x3X/gR40QBIIt4zefl2WvQhApdxiu 10 | M/a6vFB0M5P/EUWcm6aNPOvkr7nU+x4DWFFjRUC9+qKJU//x9xiG 11 | -----END CERTIFICATE----- 12 | -------------------------------------------------------------------------------- /cms/tests/examples/certData.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/certData.bin -------------------------------------------------------------------------------- /cms/tests/examples/cms_ber.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/cms_ber.bin -------------------------------------------------------------------------------- /cms/tests/examples/cms_der.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/cms_der.bin -------------------------------------------------------------------------------- /cms/tests/examples/compressed_data.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/compressed_data.bin -------------------------------------------------------------------------------- /cms/tests/examples/data.txt: -------------------------------------------------------------------------------- 1 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 2 | -------------------------------------------------------------------------------- /cms/tests/examples/digested_data.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/digested_data.bin -------------------------------------------------------------------------------- /cms/tests/examples/ec384-ee-key.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/ec384-ee-key.der -------------------------------------------------------------------------------- /cms/tests/examples/encrypted_data.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/encrypted_data.bin -------------------------------------------------------------------------------- /cms/tests/examples/enveloped_data_kari.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/enveloped_data_kari.bin -------------------------------------------------------------------------------- /cms/tests/examples/enveloped_data_kekri.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/enveloped_data_kekri.bin -------------------------------------------------------------------------------- /cms/tests/examples/enveloped_data_ktri.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/enveloped_data_ktri.bin -------------------------------------------------------------------------------- /cms/tests/examples/enveloped_data_multi.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/enveloped_data_multi.bin -------------------------------------------------------------------------------- /cms/tests/examples/enveloped_data_pwri.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/enveloped_data_pwri.bin -------------------------------------------------------------------------------- /cms/tests/examples/example.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/example.pfx -------------------------------------------------------------------------------- /cms/tests/examples/examples_notes.txt: -------------------------------------------------------------------------------- 1 | openssl genrsa -out rsa_sk.pkcs1.pem 1024 2 | openssl req -new -key rsa_sk.pkcs1.pem -out cert.csr 3 | openssl x509 -in cert.csr -out cert.pem -req -signkey rsa_sk.pkcs1.pem -days 365 4 | openssl pkcs12 -export -out example.pfx \ 5 | -name "example.org" \ 6 | -inkey rsa_sk.pkcs1.pem -in cert.pem \ 7 | -keypbe 'PBE-SHA1-RC2-40' -passout pass:hunter42 8 | openssl asn1parse -i -inform DER -in example.pfx -strparse 26 \ 9 | -noout -out >(openssl asn1parse -i -inform DER -strparse 4 -out keyEncryptedData.bin) 10 | openssl asn1parse -i -inform DER -in example.pfx -strparse 26 \ 11 | -noout -out >(openssl asn1parse -i -inform DER -strparse 631 -out certData.bin) 12 | -------------------------------------------------------------------------------- /cms/tests/examples/keyEncryptedData.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/keyEncryptedData.bin -------------------------------------------------------------------------------- /cms/tests/examples/p256-priv.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/p256-priv.der -------------------------------------------------------------------------------- /cms/tests/examples/p256-pub.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/p256-pub.der -------------------------------------------------------------------------------- /cms/tests/examples/pkits.p7b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/pkits.p7b -------------------------------------------------------------------------------- /cms/tests/examples/pkits_ee.p7b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/pkits_ee.p7b -------------------------------------------------------------------------------- /cms/tests/examples/rsa2048-priv.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/rsa2048-priv.der -------------------------------------------------------------------------------- /cms/tests/examples/rsa_cert.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/rsa_cert.der -------------------------------------------------------------------------------- /cms/tests/examples/rsa_sk.pkcs1.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXQIBAAKBgQDAtoQ606NWEmqm1oUahJLeu21qpQ6EoqU8n3Sjp4NZ0dCNjxLA 3 | UL4IX5HjbCGYL28gX/J09Bfc4P0MPyFm313etWMwCovk26Z3RnPeUj/AsXYdYnjs 4 | +mdfQ7ogCp49iXgk6w7Fz1Fe1hwUuAT52FlO1WLj9uMcOOb/flpQDJ8bJQIDAQAB 5 | AoGAEo4AMUHLSjA/wIyLCECXe4aERG5b9X1Ld4jKzC8GwJEpCVgrMAUWJuw8ua7h 6 | lSuMAYv7ZjNSUNwAwTsa1jLPcMTzFYAWZ5UH4RS/4guXFQ3ViFq8q9NibTpt1MfP 7 | sexZheLEsamWWGZCjUwGZP8Uha4t+J05r26+kXAIzBBXjcECQQD3yLEi6rj2OpW3 8 | 1sUgnXxcCnXnOmo0mfFOlCkQ8s6thL804y0t6pzfS/9BXBctMZT/WIYMeBN266pD 9 | zQ7hVy15AkEAxxpbEvZ2z/Dd4Vaiv9QPt5PPt2jDMkcdwWshBVWtf4230ISCYuwn 10 | cm7lFH3W1+IoPZcyDQ2dOnnn0349TyksDQJAUWiiqjIsKtn8rrXldl3HqgXVzu6m 11 | Tjn1yjdrdqIPvXrLx3iMM3XNrJ+vca3r/3E23t4azKX23y92dWg951NZIQJBAJ8s 12 | mOb+F1qCrEA8bPyDYtVW3Fc67+LALC+3n7yOFJjHCc8wQLUpKxg3Q/kv6ZTJ/3XN 13 | 7Hu3CJ35W7cfU5B3z/kCQQCm1KuoC7R99BZf1wRfITBNjHiTnlttg4kKsDSLNQXd 14 | wKPFCRVjupqcwHvuPiskKW9vcwvGGu2/b3FfqceHBPX9 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /cms/tests/examples/scep_der.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/scep_der.bin -------------------------------------------------------------------------------- /cms/tests/examples/sceptest_csr.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/sceptest_csr.der -------------------------------------------------------------------------------- /cms/tests/examples/sd.cms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/sd.cms -------------------------------------------------------------------------------- /cms/tests/examples/signer_info_explicit_attrs.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/signer_info_explicit_attrs.bin -------------------------------------------------------------------------------- /cms/tests/examples/signer_info_sequence_not_set.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/cms/tests/examples/signer_info_sequence_not_set.bin -------------------------------------------------------------------------------- /const-oid/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "const-oid" 3 | version = "0.10.1" 4 | authors = ["RustCrypto Developers"] 5 | license = "Apache-2.0 OR MIT" 6 | description = """ 7 | Const-friendly implementation of the ISO/IEC Object Identifier (OID) standard 8 | as defined in ITU X.660, with support for BER/DER encoding/decoding as well as 9 | heapless no_std (i.e. embedded) support 10 | """ 11 | documentation = "https://docs.rs/const-oid" 12 | homepage = "https://github.com/RustCrypto/formats/tree/master/const-oid" 13 | repository = "https://github.com/RustCrypto/formats" 14 | categories = ["cryptography", "data-structures", "encoding", "no-std", "parser-implementations"] 15 | keywords = ["iso", "iec", "itu", "oid"] 16 | readme = "README.md" 17 | edition = "2024" 18 | rust-version = "1.85" 19 | 20 | [dependencies] 21 | arbitrary = { version = "1.4", optional = true, features = ["derive"] } 22 | 23 | [dev-dependencies] 24 | hex-literal = "1" 25 | proptest = "1" 26 | regex = "1" 27 | 28 | [features] 29 | db = [] 30 | 31 | [package.metadata.docs.rs] 32 | all-features = true 33 | rustdoc-args = ["--cfg", "docsrs"] 34 | -------------------------------------------------------------------------------- /const-oid/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /const-oid/oiddbgen/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "oiddbgen" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | convert_case = "0.5.0" 8 | proc-macro2 = "1.0.36" 9 | quote = "1.0.15" 10 | regex = "1.5.5" 11 | syn = "2" 12 | 13 | [workspace] 14 | members = ["."] 15 | -------------------------------------------------------------------------------- /const-oid/oiddbgen/README.md: -------------------------------------------------------------------------------- 1 | # Welcome to oiddbgen! 2 | 3 | This program is internal-only and is used to generate the OID database tree. 4 | 5 | # How to Run 6 | 7 | If you want to generate the database yourself, from the `const-oid` directory you can just run: 8 | 9 | ``` 10 | $ cargo run --manifest-path=oiddbgen/Cargo.toml | rustfmt > src/db/generated.rs 11 | ``` 12 | -------------------------------------------------------------------------------- /const-oid/oiddbgen/fips202.md: -------------------------------------------------------------------------------- 1 | Object Identifiers (OID) for SHA-3 2 | ---------------------------------- 3 | This document lists the OIDs for 4 | - SHA3-224, 5 | - SHA3-256, 6 | - SHA3-384, 7 | - SHA3-512, 8 | - SHAKE128, and 9 | - SHAKE256. 10 | 11 | This file was manually created, as there exists no official document that is easily parsable. 12 | The SHA-3 standard is specified in [FIPS 202](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf). 13 | It references [Computer Security Objects Register (CSOR)] 14 | (https://csrc.nist.gov/projects/computer-security-objects-register/algorithm-registration), 15 | which publishes the following SHA-3 OIDs: 16 | 17 | nistAlgorithms OBJECT IDENTIFIER ::= { joint-iso-ccitt(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) } 18 | 19 | hashAlgs OBJECT IDENTIFIER ::= { nistAlgorithms 2 } 20 | 21 | id-sha3-224 OBJECT IDENTIFIER ::= { hashAlgs 7 } 22 | 23 | id-sha3-256 OBJECT IDENTIFIER ::= { hashAlgs 8 } 24 | 25 | id-sha3-384 OBJECT IDENTIFIER ::= { hashAlgs 9 } 26 | 27 | id-sha3-512 OBJECT IDENTIFIER ::= { hashAlgs 10 } 28 | 29 | id-shake128 OBJECT IDENTIFIER ::= { hashAlgs 11 } 30 | 31 | id-shake256 OBJECT IDENTIFIER ::= { hashAlgs 12 } 32 | -------------------------------------------------------------------------------- /const-oid/oiddbgen/fips203.md: -------------------------------------------------------------------------------- 1 | Object Identifiers (OID) for ML-KEM 2 | ----------------------------------- 3 | This document lists the OIDs for 4 | - ML-KEM-512, 5 | - ML-KEM-768, and 6 | - ML-KEM-1024. 7 | 8 | This file was manually created, as there exists no official document that is easily parsable. 9 | The ML-KEM standard is specified in [FIPS 203](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.203.pdf). 10 | The OIDs are defined in [Computer Security Objects Register (CSOR)] 11 | (https://csrc.nist.gov/projects/computer-security-objects-register/algorithm-registration), 12 | which publishes the following ML-KEM OIDs: 13 | 14 | nistAlgorithms OBJECT IDENTIFIER ::= { joint-iso-ccitt(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) } 15 | 16 | kems OBJECT IDENTIFIER ::= { nistAlgorithms 4 } 17 | 18 | id-alg-ml-kem-512 OBJECT IDENTIFIER ::= { kems 1 } 19 | 20 | id-alg-ml-kem-768 OBJECT IDENTIFIER ::= { kems 2 } 21 | 22 | id-alg-ml-kem-1024 OBJECT IDENTIFIER ::= { kems 3 } 23 | -------------------------------------------------------------------------------- /const-oid/oiddbgen/fips204.md: -------------------------------------------------------------------------------- 1 | Object Identifiers (OID) for ML-DSA 2 | ----------------------------------- 3 | This document lists the OIDs for 4 | - ML-DSA-44, 5 | - ML-DSA-65, 6 | - ML-DSA-87, 7 | - HashML-DSA-44 with SHA512, 8 | - HashML-DSA-65 with SHA512, and 9 | - HashML-DSA-87 with SHA512. 10 | 11 | This file was manually created, as there exists no official document that is easily parsable. 12 | The ML-DSA standard is specified in [FIPS 204](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.204.pdf). 13 | The OIDs are defined in [Computer Security Objects Register (CSOR)] 14 | (https://csrc.nist.gov/projects/computer-security-objects-register/algorithm-registration), 15 | which publishes the following ML-DSA OIDs: 16 | 17 | nistAlgorithms OBJECT IDENTIFIER ::= { joint-iso-ccitt(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) } 18 | 19 | sigAlgs OBJECT IDENTIFIER ::= { nistAlgorithms 3 } 20 | 21 | id-ml-dsa-44 OBJECT IDENTIFIER ::= { sigAlgs 17 } 22 | 23 | id-ml-dsa-65 OBJECT IDENTIFIER ::= { sigAlgs 18 } 24 | 25 | id-ml-dsa-87 OBJECT IDENTIFIER ::= { sigAlgs 19 } 26 | 27 | id-hash-ml-dsa-44-with-sha512 OBJECT IDENTIFIER ::= { sigAlgs 32 } 28 | 29 | id-hash-ml-dsa-65-with-sha512 OBJECT IDENTIFIER ::= { sigAlgs 33 } 30 | 31 | id-hash-ml-dsa-87-with-sha512 OBJECT IDENTIFIER ::= { sigAlgs 34 } 32 | 33 | -------------------------------------------------------------------------------- /const-oid/oiddbgen/rfc6962.txt: -------------------------------------------------------------------------------- 1 | Object Identifiers (OID) for Certificate Transparency 2 | ----------------------------------------------------- 3 | This document lists the OIDs for 4 | - Precertificate signed certificate timestamps extension, 5 | - Precertificate poison extension, and 6 | - Precertificate signing certificate, 7 | 8 | This file was manually created, as there exists no offical document that is easily parsable. 9 | RFC 6962 publishes the following OIDs: 10 | 11 | google OBJECT IDENTIFIER ::= { iso(1) org(3) dod(6) internet(1) private(4) enterprise(1) google(11129) } 12 | 13 | ct-precert-scts OBJECT IDENTIFIER ::= { google 2 4 2 } 14 | 15 | ct-precert-poison OBJECT IDENTIFIER ::= {google 2 4 3 } 16 | 17 | ct-precert-signing-cert OBJECT IDENTIFIER ::= { google 2 4 4 } -------------------------------------------------------------------------------- /const-oid/oiddbgen/rfc8894.md: -------------------------------------------------------------------------------- 1 | Simple Certificate Enrolment Protocol 2 | ------------------------------------- 3 | 4 | RFC 8894 unfortunately formatted the SCEP OIDs in a table, that can't 5 | be parsed easily. For this reason the definitions are repeated here 6 | in a parseable format. 7 | `id-pkix` is not contained in RFC 8894. It was added to make failInfoText parseable, too. 8 | 9 | # SCEP Secure Message Objects 10 | ## 3.2. SCEP pkiMessage 11 | ### 3.2.1. Signed Transaction Attributes 12 | 13 | id-VeriSign OBJECT IDENTIFIER ::= {2 16 US(840) 1 VeriSign(113733)} 14 | id-pki OBJECT IDENTIFIER ::= {id-VeriSign pki(1)} 15 | id-attributes OBJECT IDENTIFIER ::= {id-pki attributes(9)} 16 | id-transactionID OBJECT IDENTIFIER ::= {id-attributes transactionID(7)} 17 | id-messageType OBJECT IDENTIFIER ::= {id-attributes messageType(2)} 18 | id-pkiStatus OBJECT IDENTIFIER ::= {id-attributes pkiStatus(3)} 19 | id-failInfo OBJECT IDENTIFIER ::= {id-attributes failInfo(4)} 20 | id-senderNonce OBJECT IDENTIFIER ::= {id-attributes senderNonce(5)} 21 | id-recipientNonce OBJECT IDENTIFIER ::= {id-attributes recipientNonce(6)} 22 | id-pkix OBJECT IDENTIFIER ::= {1 3 6 1 5 5 pkix(7)} 23 | id-scep OBJECT IDENTIFIER ::= {id-pkix 24} 24 | id-scep-failInfoText OBJECT IDENTIFIER ::= {id-scep 1} 25 | -------------------------------------------------------------------------------- /const-oid/oiddbgen/src/ldap.rs: -------------------------------------------------------------------------------- 1 | #[derive(Clone, Debug, Default)] 2 | pub struct LdapParser<'a>(&'a str); 3 | 4 | impl<'a> LdapParser<'a> { 5 | pub fn new(ldap: &'a str) -> Self { 6 | Self(ldap) 7 | } 8 | 9 | pub fn iter(&self) -> impl '_ + Iterator { 10 | self.0.lines().filter_map(|line| { 11 | let (name, next) = line.split_at(line.find(',').unwrap()); 12 | let (.., next) = next[1..].split_at(next[1..].find(',').unwrap()); 13 | let (obid, next) = next[1..].split_at(next[1..].find(',').unwrap()); 14 | 15 | let indx = obid.find('.')?; 16 | obid.split_at(indx).0.parse::().ok()?; 17 | 18 | let spec = if let Some(boundary) = next[1..].find(',') { 19 | let (spec, _comment) = next[..].split_at(boundary + 1); 20 | spec 21 | } else { 22 | next 23 | }; 24 | 25 | if !spec.trim().starts_with(",[RFC") { 26 | return None; 27 | } 28 | 29 | let spec = spec[2..][..spec.len() - 3].to_ascii_lowercase(); 30 | let name = name.trim().to_string(); 31 | let obid = obid.trim().to_string(); 32 | Some((spec, name, obid)) 33 | }) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /const-oid/oiddbgen/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod asn1; 2 | mod ldap; 3 | mod node; 4 | mod root; 5 | mod spec; 6 | 7 | pub use asn1::Asn1Parser; 8 | pub use ldap::LdapParser; 9 | pub use root::Root; 10 | -------------------------------------------------------------------------------- /const-oid/oiddbgen/src/root.rs: -------------------------------------------------------------------------------- 1 | use crate::{node::Node, spec::Spec}; 2 | 3 | use std::collections::BTreeMap; 4 | 5 | use proc_macro2::{Ident, Span, TokenStream}; 6 | use quote::quote; 7 | 8 | #[derive(Clone, Debug, Default)] 9 | pub struct Root(BTreeMap); 10 | 11 | impl Root { 12 | pub fn add(&mut self, spec: &str, name: &str, obid: &str) { 13 | let name = name.trim().to_string(); 14 | let obid = obid.trim().to_string(); 15 | let spec = spec.trim().to_ascii_lowercase(); 16 | let spec = Ident::new(&spec, Span::call_site()); 17 | 18 | self.0 19 | .entry(spec) 20 | .or_insert_with(Spec::default) 21 | .insert(Node::new(obid, name)); 22 | } 23 | 24 | pub fn module(&self) -> TokenStream { 25 | let mut mods = TokenStream::default(); 26 | let mut recs = TokenStream::default(); 27 | 28 | for (spec, s) in &self.0 { 29 | mods.extend(s.module(spec)); 30 | recs.extend(s.records(quote! { &#spec })); 31 | } 32 | 33 | quote! { 34 | #![doc = "!! DO NOT EDIT !!: This file is auto-generated by oiddbgen."] 35 | 36 | #mods 37 | 38 | pub const DB: super::Database<'static> = super::Database(&[ 39 | #recs 40 | ]); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /const-oid/oiddbgen/src/spec.rs: -------------------------------------------------------------------------------- 1 | use std::collections::BTreeSet; 2 | 3 | use proc_macro2::{Ident, TokenStream}; 4 | use quote::quote; 5 | 6 | use crate::node::Node; 7 | 8 | #[derive(Clone, Debug, PartialEq, Eq, Default)] 9 | pub struct Spec(BTreeSet); 10 | 11 | impl Spec { 12 | pub fn insert(&mut self, value: Node) -> bool { 13 | self.0.insert(value) 14 | } 15 | 16 | pub fn records(&self, path: TokenStream) -> TokenStream { 17 | let mut stream = TokenStream::default(); 18 | 19 | for n in &self.0 { 20 | let name = n.name(); 21 | let symb = n.symbol(); 22 | stream.extend(quote! { (#path::#symb, #name), }) 23 | } 24 | 25 | stream 26 | } 27 | 28 | pub fn module(&self, spec: &Ident) -> TokenStream { 29 | let mut defs = TokenStream::default(); 30 | 31 | for n in &self.0 { 32 | defs.extend(n.definition()) 33 | } 34 | 35 | quote! { 36 | pub mod #spec { 37 | #defs 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /const-oid/oiddbgen/stb/bake.asn: -------------------------------------------------------------------------------- 1 | Bake-module-v1 {iso(1) member-body(2) by(112) 0 2 0 34 101 66 module(1) ver1(1)} 2 | DEFINITIONS ::= 3 | BEGIN 4 | bake OBJECT IDENTIFIER ::= {iso(1) member-body(2) by(112) 0 2 0 34 101 66} 5 | 6 | bake-bmqv OBJECT IDENTIFIER ::= {bake 11} 7 | bake-bsts OBJECT IDENTIFIER ::= {bake 12} 8 | bake-bpace OBJECT IDENTIFIER ::= {bake 21} 9 | bake-dh OBJECT IDENTIFIER ::= {bake 31} 10 | bake-kdf OBJECT IDENTIFIER ::= {bake 101} 11 | bake-swu OBJECT IDENTIFIER ::= {bake 201} 12 | 13 | bake-keys OBJECT IDENTIFIER ::= {bake keys(2)} 14 | bake-pubkey OBJECT IDENTIFIER ::= {bake-keys 1} 15 | END -------------------------------------------------------------------------------- /const-oid/oiddbgen/stb/brng.asn: -------------------------------------------------------------------------------- 1 | Brng-module-v2 {iso(1) member-body(2) by(112) 0 2 0 34 101 47 module(1) ver2(2)} 2 | DEFINITIONS ::= 3 | BEGIN 4 | brng OBJECT IDENTIFIER ::= {1 2 112 0 2 0 34 101 47} 5 | 6 | hmac-hspec OBJECT IDENTIFIER ::= {brng 11} 7 | hmac-hbelt OBJECT IDENTIFIER ::= {brng 12} 8 | brng-ctr-hspec OBJECT IDENTIFIER ::= {brng 21} 9 | brng-ctr-hbelt OBJECT IDENTIFIER ::= {brng 22} 10 | brng-ctr-stb11761 OBJECT IDENTIFIER ::= {brng 23} 11 | brng-hmac-hspec OBJECT IDENTIFIER ::= {brng 31} 12 | brng-hmac-hbelt OBJECT IDENTIFIER ::= {brng 32} 13 | 14 | hotp-hspec OBJECT IDENTIFIER ::= {brng 111} 15 | hotp-hbelt OBJECT IDENTIFIER ::= {brng 112} 16 | totp-hspec OBJECT IDENTIFIER ::= {brng 121} 17 | totp-hbelt OBJECT IDENTIFIER ::= {brng 122} 18 | ocra-hspec OBJECT IDENTIFIER ::= {brng 131} 19 | ocra-hbelt OBJECT IDENTIFIER ::= {brng 132} 20 | END 21 | -------------------------------------------------------------------------------- /const-oid/src/checked.rs: -------------------------------------------------------------------------------- 1 | //! Checked arithmetic helpers. 2 | 3 | /// `const fn`-friendly checked addition helper. 4 | macro_rules! checked_add { 5 | ($a:expr, $b:expr) => { 6 | match $a.checked_add($b) { 7 | Some(n) => n, 8 | None => return Err(Error::Overflow), 9 | } 10 | }; 11 | } 12 | 13 | /// `const fn`-friendly checked subtraction helper. 14 | macro_rules! checked_sub { 15 | ($a:expr, $b:expr) => { 16 | match $a.checked_sub($b) { 17 | Some(n) => n, 18 | None => return Err(Error::Overflow), 19 | } 20 | }; 21 | } 22 | 23 | /// `const fn`-friendly checked multiplication helper. 24 | macro_rules! checked_mul { 25 | ($a:expr, $b:expr) => { 26 | match $a.checked_mul($b) { 27 | Some(n) => n, 28 | None => return Err(Error::Overflow), 29 | } 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /const-oid/src/traits.rs: -------------------------------------------------------------------------------- 1 | //! Trait definitions. 2 | 3 | use crate::ObjectIdentifier; 4 | 5 | /// A trait which associates an OID with a type. 6 | pub trait AssociatedOid { 7 | /// The OID associated with this type. 8 | const OID: ObjectIdentifier; 9 | } 10 | 11 | /// A trait which associates a dynamic, `&self`-dependent OID with a type, 12 | /// which may change depending on the type's value. 13 | /// 14 | /// This trait is object safe and auto-impl'd for any types which impl 15 | /// [`AssociatedOid`]. 16 | pub trait DynAssociatedOid { 17 | /// Get the OID associated with this value. 18 | fn oid(&self) -> ObjectIdentifier; 19 | } 20 | 21 | impl DynAssociatedOid for T { 22 | fn oid(&self) -> ObjectIdentifier { 23 | T::OID 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /const-oid/tests/proptests.proptest-regressions: -------------------------------------------------------------------------------- 1 | # Seeds for failure cases proptest has generated in the past. It is 2 | # automatically read and these particular cases re-run before any 3 | # novel cases are generated. 4 | # 5 | # It is recommended to check this file in to source control so that 6 | # everyone who runs the test benefits from these saved cases. 7 | cc 1663923d2fb0c804c5b850d10dd0ded1cbfc06dddf3f88faa4abf149b8430831 # shrinks to s = "" 8 | cc 829ba8833ee42816bc33d308b7a186452e36617f0fa0e771edea08fd07d78718 # shrinks to s = "0.40" 9 | cc bc88f232a7e2e45d2b1325d4e02c09742aca7ad31903326fedb36c047533696c # shrinks to s = "0" 10 | cc d90305406041ea5e4cf4d9e7849cad03391db1869d0b1329f60ccbf1fabaee91 # shrinks to s = "0..0" 11 | cc 8ed8dde35d12a2c8e10cdde6d591a8f17f0cd6d6fdf90f1582536401364623bf # shrinks to s = "0.00" 12 | cc ba5e3e3dc1a64870477e82054bbf6d8272f8b0d0c9094115bf7e8b5ff59f3c63 # shrinks to s = "00.1.1" 13 | cc d211e943da9a0e3d0ee5097899b2435f784ca2b3d2f8d4790aae3744823a268a # shrinks to s = "1.1.1.60817410.1" 14 | cc 61bdeaa6cfc6707a0c4f3e9c6165d99d28042e78acb29b0ca7f747c169e83e74 # shrinks to s = "1.1.1.270000000" 15 | -------------------------------------------------------------------------------- /crmf/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## 0.2.0 (2023-06-25) 8 | - Initial release 9 | 10 | ## 0.1.0 11 | - Skipped 12 | -------------------------------------------------------------------------------- /crmf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "crmf" 3 | version = "0.3.0-pre.0" 4 | description = """ 5 | Pure Rust implementation of the Certificate Request Message Format (CRMF) as 6 | described in RFC 4211 7 | """ 8 | authors = ["RustCrypto Developers"] 9 | license = "Apache-2.0 OR MIT" 10 | homepage = "https://github.com/RustCrypto/formats/tree/master/crmf" 11 | repository = "https://github.com/RustCrypto/formats" 12 | categories = ["cryptography", "data-structures", "encoding", "no-std"] 13 | keywords = ["crypto"] 14 | readme = "README.md" 15 | edition = "2024" 16 | rust-version = "1.85" 17 | 18 | [dependencies] 19 | cms = "=0.3.0-pre.0" 20 | der = { version = "0.8.0-rc.3", features = ["alloc", "derive"] } 21 | spki = "0.8.0-rc.0" 22 | x509-cert = { version = "=0.3.0-pre.0", default-features = false } 23 | 24 | [dev-dependencies] 25 | const-oid = "0.10.0-rc.0" 26 | 27 | [features] 28 | alloc = ["der/alloc"] 29 | std = ["der/std", "spki/std"] 30 | pem = ["alloc", "der/pem"] 31 | 32 | [package.metadata.docs.rs] 33 | all-features = true 34 | rustdoc-args = ["--cfg", "docsrs"] 35 | -------------------------------------------------------------------------------- /crmf/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2023-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /crmf/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![cfg_attr(docsrs, feature(doc_auto_cfg))] 3 | #![doc = include_str!("../README.md")] 4 | #![doc( 5 | html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg", 6 | html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg" 7 | )] 8 | #![forbid(unsafe_code)] 9 | #![warn( 10 | missing_docs, 11 | rust_2018_idioms, 12 | unused_lifetimes, 13 | unused_qualifications 14 | )] 15 | 16 | extern crate alloc; 17 | 18 | #[cfg(feature = "std")] 19 | extern crate std; 20 | 21 | pub mod controls; 22 | pub mod pop; 23 | pub mod reg_info; 24 | pub mod request; 25 | -------------------------------------------------------------------------------- /crmf/src/reg_info.rs: -------------------------------------------------------------------------------- 1 | //! Registration Info-related types 2 | 3 | use der::asn1::Utf8StringRef; 4 | 5 | use crate::request::CertRequest; 6 | 7 | /// The `PrivateKeyInfo` type is defined in [RFC 4211 Section 7.1]. 8 | /// 9 | /// ```text 10 | /// UTF8Pairs ::= UTF8String 11 | /// ``` 12 | /// 13 | /// [RFC 4211 Section 7.1]: https://www.rfc-editor.org/rfc/rfc4211#section-7.1 14 | pub type Utf8Pairs<'a> = Utf8StringRef<'a>; 15 | 16 | /// The `PrivateKeyInfo` type is defined in [RFC 4211 Section 7.2]. 17 | /// 18 | /// ```text 19 | /// CertReq ::= CertRequest 20 | /// ``` 21 | /// 22 | /// [RFC 4211 Section 7.2]: https://www.rfc-editor.org/rfc/rfc4211#section-7.2 23 | pub type CertReq = CertRequest; 24 | -------------------------------------------------------------------------------- /crmf/tests/controls.rs: -------------------------------------------------------------------------------- 1 | use cms::content_info::ContentInfo; 2 | use cms::enveloped_data::EnvelopedData; 3 | use crmf::controls::{EncryptedKey, PkiArchiveOptions}; 4 | use der::{Decode, Encode}; 5 | 6 | #[test] 7 | fn pki_archive_options_test() { 8 | let der_ci = include_bytes!("../../cms/tests/examples/enveloped_data_ktri.bin"); 9 | let ci = ContentInfo::from_der(der_ci).unwrap(); 10 | assert_eq!(ci.content_type, const_oid::db::rfc5911::ID_ENVELOPED_DATA); 11 | 12 | // re-encode the AnyRef to get the SignedData bytes 13 | let bytes = ci.content.to_der().unwrap(); 14 | 15 | // parse as EnvelopedData then re-encode 16 | let data = EnvelopedData::from_der(bytes.as_slice()).unwrap(); 17 | 18 | let pao = PkiArchiveOptions::EncryptedPrivKey(EncryptedKey::EnvelopedData(Box::new(data))); 19 | let encoded_data = pao.to_der().unwrap(); 20 | let pao2 = PkiArchiveOptions::from_der(encoded_data.as_slice()).unwrap(); 21 | let encoded_data2 = pao2.to_der().unwrap(); 22 | assert_eq!(encoded_data, encoded_data2); 23 | println!("Encoded : {encoded_data:02X?}"); 24 | match pao2 { 25 | PkiArchiveOptions::EncryptedPrivKey(EncryptedKey::EnvelopedData(ed2)) => { 26 | let reencoded_ed = ed2.to_der().unwrap(); 27 | assert_eq!(bytes, reencoded_ed); 28 | } 29 | _ => panic!(), 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /crmf/tests/examples/certreqmsg.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/crmf/tests/examples/certreqmsg.bin -------------------------------------------------------------------------------- /crmf/tests/examples/certreqmsgs.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/crmf/tests/examples/certreqmsgs.bin -------------------------------------------------------------------------------- /crmf/tests/examples/certrequest.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/crmf/tests/examples/certrequest.bin -------------------------------------------------------------------------------- /crmf/tests/examples/certtemplate.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/crmf/tests/examples/certtemplate.bin -------------------------------------------------------------------------------- /der/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /der/src/asn1/application.rs: -------------------------------------------------------------------------------- 1 | //! Application class field. 2 | 3 | use crate::{ 4 | Choice, Class, Decode, DecodeValue, DerOrd, Encode, EncodeValue, EncodeValueRef, Error, Header, 5 | Length, Reader, Tag, TagMode, TagNumber, Tagged, ValueOrd, Writer, asn1::AnyRef, 6 | tag::IsConstructed, 7 | }; 8 | use core::cmp::Ordering; 9 | 10 | #[cfg(doc)] 11 | use crate::ErrorKind; 12 | 13 | impl_custom_class!(Application, Application, "APPLICATION", "0b01000000"); 14 | impl_custom_class_ref!(ApplicationRef, Application, "APPLICATION", "0b01000000"); 15 | -------------------------------------------------------------------------------- /der/src/asn1/choice.rs: -------------------------------------------------------------------------------- 1 | //! ASN.1 `CHOICE` support. 2 | 3 | use crate::{Decode, FixedTag, Tag, Tagged}; 4 | 5 | /// ASN.1 `CHOICE` denotes a union of one or more possible alternatives. 6 | /// 7 | /// The types MUST have distinct tags. 8 | /// 9 | /// This crate models choice as a trait, with a blanket impl for all types 10 | /// which impl `Decode + FixedTag` (i.e. they are modeled as a `CHOICE` 11 | /// with only one possible variant) 12 | pub trait Choice<'a>: Decode<'a> + Tagged { 13 | /// Is the provided [`Tag`] decodable as a variant of this `CHOICE`? 14 | fn can_decode(tag: Tag) -> bool; 15 | } 16 | 17 | /// This blanket impl allows any [`Tagged`] type to function as a [`Choice`] 18 | /// with a single alternative. 19 | impl<'a, T> Choice<'a> for T 20 | where 21 | T: Decode<'a> + FixedTag, 22 | { 23 | fn can_decode(tag: Tag) -> bool { 24 | T::TAG == tag 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /der/src/asn1/general_string.rs: -------------------------------------------------------------------------------- 1 | use crate::{BytesRef, DecodeValue, EncodeValue, FixedTag, Header, Length, Reader, Tag, Writer}; 2 | 3 | /// This is currently `&[u8]` internally, as `GeneralString` is not fully implemented yet 4 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] 5 | pub struct GeneralStringRef<'a> { 6 | /// Raw contents, unchecked 7 | inner: BytesRef<'a>, 8 | } 9 | impl<'a> GeneralStringRef<'a> { 10 | /// This is currently `&[u8]` internally, as `GeneralString` is not fully implemented yet 11 | pub fn as_bytes(&self) -> &'a [u8] { 12 | self.inner.as_slice() 13 | } 14 | } 15 | 16 | impl FixedTag for GeneralStringRef<'_> { 17 | const TAG: Tag = Tag::GeneralString; 18 | } 19 | impl<'a> DecodeValue<'a> for GeneralStringRef<'a> { 20 | type Error = crate::Error; 21 | 22 | fn decode_value>(reader: &mut R, header: Header) -> Result { 23 | Ok(Self { 24 | inner: BytesRef::decode_value(reader, header)?, 25 | }) 26 | } 27 | } 28 | impl EncodeValue for GeneralStringRef<'_> { 29 | fn value_len(&self) -> crate::Result { 30 | self.inner.value_len() 31 | } 32 | 33 | fn encode_value(&self, encoder: &mut impl Writer) -> crate::Result<()> { 34 | self.inner.encode_value(encoder) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /der/src/asn1/private.rs: -------------------------------------------------------------------------------- 1 | //! Private class field. 2 | 3 | use crate::{ 4 | Choice, Class, Decode, DecodeValue, DerOrd, Encode, EncodeValue, EncodeValueRef, Error, Header, 5 | Length, Reader, Tag, TagMode, TagNumber, Tagged, ValueOrd, Writer, asn1::AnyRef, 6 | tag::IsConstructed, 7 | }; 8 | use core::cmp::Ordering; 9 | 10 | #[cfg(doc)] 11 | use crate::ErrorKind; 12 | 13 | impl_custom_class!(Private, Private, "PRIVATE", "0b11000000"); 14 | impl_custom_class_ref!(PrivateRef, Private, "PRIVATE", "0b11000000"); 15 | -------------------------------------------------------------------------------- /der/src/encoding_rules.rs: -------------------------------------------------------------------------------- 1 | /// ASN.1 encoding rules. 2 | /// 3 | /// This enum identifies the specific encoding rules which are applied at the time a given document 4 | /// is decoded from a byte/octet serialization. 5 | /// 6 | /// In addition to the Distinguished Encoding Rules (DER), this crate also supports a strict subset 7 | /// of the Basic Encoding Rules (BER) which supports the minimum amount of additional productions 8 | /// beyond DER needed to interoperate with other implementations of cryptography-oriented formats 9 | /// which utilize BER, e.g. CMS, PKCS#8. 10 | #[derive(Clone, Copy, Debug, Default, Eq, PartialEq, PartialOrd, Ord)] 11 | pub enum EncodingRules { 12 | /// Basic Encoding Rules. 13 | Ber, 14 | 15 | /// Distinguished Encoding Rules. 16 | #[default] 17 | Der, 18 | } 19 | -------------------------------------------------------------------------------- /der/src/tag/mode.rs: -------------------------------------------------------------------------------- 1 | //! Tag modes. 2 | 3 | use crate::{Error, ErrorKind, Result}; 4 | use core::{fmt, str::FromStr}; 5 | 6 | /// Tagging modes: `EXPLICIT` versus `IMPLICIT`. 7 | #[derive(Copy, Clone, Debug, Default, Eq, PartialEq, PartialOrd, Ord)] 8 | pub enum TagMode { 9 | /// `EXPLICIT` tagging. 10 | /// 11 | /// Tag is added in addition to the inner tag of the type. 12 | #[default] 13 | Explicit, 14 | 15 | /// `IMPLICIT` tagging. 16 | /// 17 | /// Tag replaces the existing tag of the inner type. 18 | Implicit, 19 | } 20 | 21 | impl FromStr for TagMode { 22 | type Err = Error; 23 | 24 | fn from_str(s: &str) -> Result { 25 | match s { 26 | "EXPLICIT" | "explicit" => Ok(TagMode::Explicit), 27 | "IMPLICIT" | "implicit" => Ok(TagMode::Implicit), 28 | _ => Err(ErrorKind::TagModeUnknown.into()), 29 | } 30 | } 31 | } 32 | 33 | impl fmt::Display for TagMode { 34 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 35 | match self { 36 | TagMode::Explicit => f.write_str("EXPLICIT"), 37 | TagMode::Implicit => f.write_str("IMPLICIT"), 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /der/src/writer.rs: -------------------------------------------------------------------------------- 1 | //! Writer trait. 2 | 3 | #[cfg(feature = "pem")] 4 | pub(crate) mod pem; 5 | pub(crate) mod slice; 6 | 7 | use crate::Result; 8 | 9 | #[cfg(feature = "std")] 10 | use std::io; 11 | 12 | /// Writer trait which outputs encoded DER. 13 | pub trait Writer { 14 | /// Write the given DER-encoded bytes as output. 15 | fn write(&mut self, slice: &[u8]) -> Result<()>; 16 | 17 | /// Write a single byte. 18 | fn write_byte(&mut self, byte: u8) -> Result<()> { 19 | self.write(&[byte]) 20 | } 21 | } 22 | 23 | #[cfg(feature = "std")] 24 | impl Writer for W { 25 | fn write(&mut self, slice: &[u8]) -> Result<()> { 26 | ::write(self, slice)?; 27 | Ok(()) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /der/src/writer/pem.rs: -------------------------------------------------------------------------------- 1 | //! Streaming PEM writer. 2 | 3 | use super::Writer; 4 | use crate::Result; 5 | use pem_rfc7468::{Encoder, LineEnding}; 6 | 7 | /// `Writer` type which outputs PEM-encoded data. 8 | pub struct PemWriter<'w>(Encoder<'static, 'w>); 9 | 10 | impl<'w> PemWriter<'w> { 11 | /// Create a new PEM writer which outputs into the provided buffer. 12 | /// 13 | /// Uses the default 64-character line wrapping. 14 | pub fn new( 15 | type_label: &'static str, 16 | line_ending: LineEnding, 17 | out: &'w mut [u8], 18 | ) -> Result { 19 | Ok(Self(Encoder::new(type_label, line_ending, out)?)) 20 | } 21 | 22 | /// Get the PEM label which will be used in the encapsulation boundaries 23 | /// for this document. 24 | pub fn type_label(&self) -> &'static str { 25 | self.0.type_label() 26 | } 27 | 28 | /// Finish encoding PEM, writing the post-encapsulation boundary. 29 | /// 30 | /// On success, returns the total number of bytes written to the output buffer. 31 | pub fn finish(self) -> Result { 32 | Ok(self.0.finish()?) 33 | } 34 | } 35 | 36 | impl Writer for PemWriter<'_> { 37 | fn write(&mut self, slice: &[u8]) -> Result<()> { 38 | self.0.encode(slice)?; 39 | Ok(()) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /der/tests/datetime.proptest-regressions: -------------------------------------------------------------------------------- 1 | # Seeds for failure cases proptest has generated in the past. It is 2 | # automatically read and these particular cases re-run before any 3 | # novel cases are generated. 4 | # 5 | # It is recommended to check this file in to source control so that 6 | # everyone who runs the test benefits from these saved cases. 7 | cc 00dbea7e90761c16aa20e2fbf7ffad420da0c84d4ed4e6df123de03c9b4567e5 # shrinks to year = 1970, month = 1, day = 1, hour = 0, min = 60, sec = 0 8 | cc 3b0bd01ef4cad6bea0a287f9cdcd56bad186125ec388d204f6afcd193ca12c39 # shrinks to year = 1970, month = 1, day = 1, hour = 0, min = 0, sec = 60 9 | cc b15c8e6f894bfcb36a5d6b6e03f52b2b565dde7feafd44bf53941f9e9b1e67f4 # shrinks to year = 6580, month = 2, day = 29, hour = 0, min = 0, sec = 0 10 | cc ef4a0bb7c5ed9d58d2df8a731d3b9c1bc736ef0bd1f08a8c5f23ae804c0b6c24 # shrinks to year = 9600, month = 2, day = 29, hour = 0, min = 0, sec = 0 11 | -------------------------------------------------------------------------------- /der/tests/examples/spki.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/der/tests/examples/spki.der -------------------------------------------------------------------------------- /der/tests/examples/spki.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MCowBQYDK2VwAyEATSkWfz8ZEqb3rfopOgUaFcBexnuPFyZ7HFVQ3OhTvQ0= 3 | -----END PUBLIC KEY----- 4 | -------------------------------------------------------------------------------- /der_derive/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "der_derive" 3 | version = "0.8.0-rc.3" 4 | description = "Custom derive support for the `der` crate's `Choice` and `Sequence` traits" 5 | authors = ["RustCrypto Developers"] 6 | license = "Apache-2.0 OR MIT" 7 | documentation = "https://docs.rs/der" 8 | homepage = "https://github.com/RustCrypto/formats/tree/master/der_derive" 9 | repository = "https://github.com/RustCrypto/formats" 10 | categories = ["cryptography", "data-structures", "encoding", "no-std", "parser-implementations"] 11 | keywords = ["asn1", "der", "crypto", "itu", "pkcs"] 12 | readme = "README.md" 13 | edition = "2024" 14 | rust-version = "1.85" 15 | 16 | [lib] 17 | proc-macro = true 18 | 19 | [dependencies] 20 | proc-macro2 = "1" 21 | quote = "1" 22 | syn = { version = "2", features = ["extra-traits"] } 23 | -------------------------------------------------------------------------------- /der_derive/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /gss-api/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## 0.1.0 (2022-05-20) 8 | - Initial release 9 | -------------------------------------------------------------------------------- /gss-api/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "gss-api" 3 | version = "0.2.0-pre" 4 | description = """ 5 | Pure Rust implementation for Generic Security Service Application Program 6 | Interface (GSS-API) 7 | """ 8 | authors = ["RustCrypto Developers"] 9 | license = "Apache-2.0 OR MIT" 10 | homepage = "https://github.com/RustCrypto/formats/tree/master/gss-api" 11 | repository = "https://github.com/RustCrypto/formats" 12 | categories = ["cryptography", "authentication", "encoding", "no-std", "parser-implementations"] 13 | keywords = ["crypto", "gssapi", "kerberos", "krb5"] 14 | readme = "README.md" 15 | edition = "2024" 16 | rust-version = "1.85" 17 | 18 | [dependencies] 19 | der = { version = "0.8.0-rc.3", features = ["oid", "alloc"] } 20 | spki = { version = "0.8.0-rc.0" } 21 | x509-cert = { version = "=0.3.0-pre.0", default-features = false } 22 | 23 | [dev-dependencies] 24 | der = { version = "0.8.0-rc.3", features = ["oid", "pem", "alloc"] } 25 | hex-literal = "1" 26 | x509-cert = { version = "=0.3.0-pre.0", default-features = false, features = ["pem"] } 27 | 28 | [features] 29 | rfc2478 = [] 30 | 31 | [package.metadata.docs.rs] 32 | all-features = true 33 | rustdoc-args = ["--cfg", "docsrs"] 34 | -------------------------------------------------------------------------------- /gss-api/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2022-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /pem-rfc7468/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pem-rfc7468" 3 | version = "1.0.0-rc.3" 4 | description = """ 5 | PEM Encoding (RFC 7468) for PKIX, PKCS, and CMS Structures, implementing a 6 | strict subset of the original Privacy-Enhanced Mail encoding intended 7 | specifically for use with cryptographic keys, certificates, and other messages. 8 | Provides a no_std-friendly, constant-time implementation suitable for use with 9 | cryptographic private keys. 10 | """ 11 | authors = ["RustCrypto Developers"] 12 | license = "Apache-2.0 OR MIT" 13 | homepage = "https://github.com/RustCrypto/formats/tree/master/pem-rfc7468" 14 | repository = "https://github.com/RustCrypto/formats" 15 | categories = ["cryptography", "data-structures", "encoding", "no-std", "parser-implementations"] 16 | keywords = ["crypto", "key", "pem", "pkcs", "rsa"] 17 | readme = "README.md" 18 | edition = "2024" 19 | rust-version = "1.85" 20 | 21 | [dependencies] 22 | base64ct = { version = "1.4" } 23 | 24 | [features] 25 | alloc = ["base64ct/alloc"] 26 | std = ["alloc", "base64ct/std"] 27 | 28 | [package.metadata.docs.rs] 29 | all-features = true 30 | rustdoc-args = ["--cfg", "docsrs"] 31 | -------------------------------------------------------------------------------- /pem-rfc7468/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /pem-rfc7468/tests/encode.rs: -------------------------------------------------------------------------------- 1 | //! PEM decoding tests 2 | 3 | #![cfg(feature = "alloc")] 4 | 5 | use pem_rfc7468::LineEnding; 6 | 7 | #[test] 8 | fn pkcs1_example() { 9 | let label = "RSA PRIVATE KEY"; 10 | let bytes = include_bytes!("examples/pkcs1.der"); 11 | let encoded = pem_rfc7468::encode_string(label, LineEnding::LF, bytes).unwrap(); 12 | assert_eq!(&encoded, include_str!("examples/pkcs1.pem")); 13 | } 14 | 15 | #[test] 16 | fn pkcs8_example() { 17 | let label = "PRIVATE KEY"; 18 | let bytes = include_bytes!("examples/pkcs8.der"); 19 | let encoded = pem_rfc7468::encode_string(label, LineEnding::LF, bytes).unwrap(); 20 | assert_eq!(&encoded, include_str!("examples/pkcs8.pem")); 21 | } 22 | -------------------------------------------------------------------------------- /pem-rfc7468/tests/examples/ed25519_id.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN ED25519 CERT----- 2 | AQQABrknAdj5BeHBAd0mq1KD3ABvDzpBvUD0zU88DASbkRuV0WiaAQAgBADPc8aR 3 | rUUolIsrKFMKy7SVCxKvpGrcdFAni+Bah1WZHnac5JP3LnPc2/0G7dTSlSTeBk5k 4 | XqIySdIqtfYbW0kQinA0PaxDzzX5g1q3CclY9lNTAglR5fP71kunXh7ntwk= 5 | -----END ED25519 CERT----- 6 | -------------------------------------------------------------------------------- /pem-rfc7468/tests/examples/pkcs1.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pem-rfc7468/tests/examples/pkcs1.der -------------------------------------------------------------------------------- /pem-rfc7468/tests/examples/pkcs8-enc.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pem-rfc7468/tests/examples/pkcs8-enc.der -------------------------------------------------------------------------------- /pem-rfc7468/tests/examples/pkcs8-enc.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN ENCRYPTED PRIVATE KEY----- 2 | MIGbMFcGCSqGSIb3DQEFDTBKMCkGCSqGSIb3DQEFDDAcBAh52YLnDfkaiAICCAAw 3 | DAYIKoZIhvcNAgkFADAdBglghkgBZQMEASoEELLQLXiy79nf9pTPjgr0CSUEQNDN 4 | bHcPS7hxdkIjBcF0AYCeImZ0znQYXSIb/aqVBpiQyIgvzgKwXUG8v1SwNVlbzUFU 5 | syWTcIRpuGqs+IFaeys= 6 | -----END ENCRYPTED PRIVATE KEY----- 7 | -------------------------------------------------------------------------------- /pem-rfc7468/tests/examples/pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pem-rfc7468/tests/examples/pkcs8.der -------------------------------------------------------------------------------- /pem-rfc7468/tests/examples/pkcs8.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MC4CAQAwBQYDK2VwBCIEIBftnHPp22SewYmmEoMcX8VwI4IHwaqd+9LFPj/15eqF 3 | -----END PRIVATE KEY----- 4 | -------------------------------------------------------------------------------- /pem-rfc7468/tests/examples/ssh-id_ed25519.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN OPENSSH PRIVATE KEY----- 2 | b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW 3 | QyNTUxOQAAACCzPq7zfqLffKoBDe/eo04kH2XxtSmk9D7RQyf1xUqrYgAAAJgAIAxdACAM 4 | XQAAAAtzc2gtZWQyNTUxOQAAACCzPq7zfqLffKoBDe/eo04kH2XxtSmk9D7RQyf1xUqrYg 5 | AAAEC2BsIi0QwW2uFscKTUUXNHLsYX4FxlaSDSblbAj7WR7bM+rvN+ot98qgEN796jTiQf 6 | ZfG1KaT0PtFDJ/XFSqtiAAAAEHVzZXJAZXhhbXBsZS5jb20BAgMEBQ== 7 | -----END OPENSSH PRIVATE KEY----- 8 | -------------------------------------------------------------------------------- /pkcs1/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pkcs1" 3 | version = "0.8.0-rc.2" 4 | description = """ 5 | Pure Rust implementation of Public-Key Cryptography Standards (PKCS) #1: 6 | RSA Cryptography Specifications Version 2.2 (RFC 8017) 7 | """ 8 | authors = ["RustCrypto Developers"] 9 | license = "Apache-2.0 OR MIT" 10 | homepage = "https://github.com/RustCrypto/formats/tree/master/pkcs1" 11 | repository = "https://github.com/RustCrypto/formats" 12 | categories = ["cryptography", "data-structures", "encoding", "no-std", "parser-implementations"] 13 | keywords = ["crypto", "key", "pem", "pkcs", "rsa"] 14 | readme = "README.md" 15 | edition = "2024" 16 | rust-version = "1.85" 17 | 18 | [dependencies] 19 | der = { version = "0.8.0-rc.3", features = ["oid"] } 20 | spki = { version = "0.8.0-rc.0" } 21 | 22 | # optional dependencies 23 | pkcs8 = { version = "0.11.0-rc.1", optional = true, default-features = false } 24 | 25 | [dev-dependencies] 26 | const-oid = { version = "0.10", features = ["db"] } 27 | hex-literal = "1" 28 | tempfile = "3" 29 | 30 | [features] 31 | zeroize = ["der/zeroize"] 32 | alloc = ["der/alloc", "zeroize", "pkcs8?/alloc"] 33 | pem = ["alloc", "der/pem", "pkcs8?/pem"] 34 | std = ["der/std", "alloc"] 35 | 36 | [package.metadata.docs.rs] 37 | all-features = true 38 | rustdoc-args = ["--cfg", "docsrs"] 39 | -------------------------------------------------------------------------------- /pkcs1/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /pkcs1/tests/examples/rsa2048-priv-3prime.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs1/tests/examples/rsa2048-priv-3prime.der -------------------------------------------------------------------------------- /pkcs1/tests/examples/rsa2048-priv.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs1/tests/examples/rsa2048-priv.der -------------------------------------------------------------------------------- /pkcs1/tests/examples/rsa2048-pub.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs1/tests/examples/rsa2048-pub.der -------------------------------------------------------------------------------- /pkcs1/tests/examples/rsa2048-pub.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PUBLIC KEY----- 2 | MIIBCgKCAQEAtsQsUV8QpqrygsY+2+JCQ6Fw8/omM71IM2N/R8pPbzbgOl0p78MZ 3 | GsgPOQ2HSznjD0FPzsH8oO2B5Uftws04LHb2HJAYlz25+lN5cqfHAfa3fgmC38Ff 4 | wBkn7l582UtPWZ/wcBOnyCgb3yLcvJrXyrt8QxHJgvWO23ITrUVYszImbXQ67YGS 5 | 0YhMrbixRzmo2tpm3JcIBtnHrEUMsT0NfFdfsZhTT8YbxBvA8FdODgEwx7u/vf3J 6 | 9qbi4+Kv8cvqyJuleIRSjVXPsIMnoejIn04APPKIjpMyQdnWlby7rNyQtE4+CV+j 7 | cFjqJbE/Xilcvqxt6DirjFCvYeKYl1uHLwIDAQAB 8 | -----END RSA PUBLIC KEY----- 9 | -------------------------------------------------------------------------------- /pkcs1/tests/examples/rsa4096-priv.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs1/tests/examples/rsa4096-priv.der -------------------------------------------------------------------------------- /pkcs1/tests/examples/rsa4096-pub.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs1/tests/examples/rsa4096-pub.der -------------------------------------------------------------------------------- /pkcs1/tests/examples/rsa4096-pub.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PUBLIC KEY----- 2 | MIICCgKCAgEAp6dFcoEeomF+Sehb1zDd4w8QP32I7j92XlQNPdmTu7C6FAAChZ0L 3 | QIl0NmN/WLgo6nTfgyFjQHf5nUqi1UyjdYUu9ZdmHTcTzh7ztP1qjiICOORnZoos 4 | fuOGHSISrmoevd+oi2LfEPa8957/SsKY+yVj3xuHZDga+bH7DM0IXgJrCtn2choj 5 | UXfQOWtIdUrUp1JCJQqHO/L25+48dd1hPjZbpPMhCmzGa5Ci+j92LKaIQIe2v4Fh 6 | 6xRIGfD1cvIfbI4nPnDUWjZbiygZznNGE8wjsBMpoXkB8XB4QDhh9UxSoFHipYx1 7 | wtnYAJG7mAihBsH37LQDThUFi+7HJcX5GdYuqiNLYmKNNGxgu5GecIUdqzhXHm8O 8 | 12NBKfmU6jaP7nNz397AREXrykf6IO0VQKhgyUi6vJjaWRyh3i4uJVQO+bfLNT9g 9 | ITuBSkXTWe+puBHu/wjGWZO/ioXCv+qqftXmtD4YrmBEZM5flhUBNufQn4sk+tQ9 10 | eHARjPp7wkh1UG67wyG5d+CGGupQEoYgEh8LOUqc3QpCQRoTUMB3DZddcbAKkENi 11 | QMlnoMOlwgoPbed/Pyyv2pTtAUPB9uNPc+DKwnnu63xjdyOisCbIKALhpK66qIRt 12 | +Y55GUmHc+DU8xmVb03jqtAO+5oUfWazrBoB01ss+0jUALDnqA3JdVECAwEAAQ== 13 | -----END RSA PUBLIC KEY----- 14 | -------------------------------------------------------------------------------- /pkcs12/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## 0.1.0 (2024-01-04) 8 | - Initial release 9 | -------------------------------------------------------------------------------- /pkcs12/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2022-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /pkcs12/src/authenticated_safe.rs: -------------------------------------------------------------------------------- 1 | //! AuthenticatedSafe-related types 2 | 3 | use alloc::vec::Vec; 4 | use cms::content_info::ContentInfo; 5 | 6 | /// The `AuthenticatedSafe` type is defined in [RFC 7292 Section 4.1]. 7 | /// 8 | /// ```text 9 | /// AuthenticatedSafe ::= SEQUENCE OF ContentInfo 10 | /// -- Data if unencrypted 11 | /// -- EncryptedData if password-encrypted 12 | /// -- EnvelopedData if public key-encrypted 13 | /// ``` 14 | /// 15 | /// [RFC 7292 Section 4.1]: https://www.rfc-editor.org/rfc/rfc7292#section-4.1 16 | pub type AuthenticatedSafe<'a> = Vec; 17 | -------------------------------------------------------------------------------- /pkcs12/src/crl_type.rs: -------------------------------------------------------------------------------- 1 | //! CertBag-related types 2 | 3 | use der::Sequence; 4 | use der::asn1::{ObjectIdentifier, OctetString}; 5 | 6 | /// The `CertBag` type is defined in [RFC 7292 Section 4.2.4]. 7 | /// 8 | ///```text 9 | /// CRLBag ::= SEQUENCE { 10 | /// crlId BAG-TYPE.&id ({CRLTypes}), 11 | /// crltValue [0] EXPLICIT BAG-TYPE.&Type ({CRLTypes}{@crlId}) 12 | /// } 13 | ///``` 14 | /// 15 | /// [RFC 7292 Section 4.2.4]: https://www.rfc-editor.org/rfc/rfc7292#section-4.2.4 16 | #[derive(Clone, Debug, Eq, PartialEq, Sequence)] 17 | #[allow(missing_docs)] 18 | pub struct CrlBag { 19 | pub crl_id: ObjectIdentifier, 20 | #[asn1(context_specific = "0", tag_mode = "EXPLICIT")] 21 | pub crl_value: CrlTypes, 22 | } 23 | 24 | // todo defer: add support for other CRL types 25 | /// The `CRLTypes` type is defined in [RFC 7292 Section 4.2.4]. 26 | /// 27 | ///```text 28 | /// x509CRL BAG-TYPE ::= 29 | /// {OCTET STRING IDENTIFIED BY {crlTypes 1}} 30 | /// -- DER-encoded X.509 CRL stored in OCTET STRING 31 | /// 32 | /// CRLTypes BAG-TYPE ::= { 33 | /// x509CRL, 34 | /// ... -- For future extensions 35 | /// } 36 | ///``` 37 | /// 38 | /// [RFC 7292 Section 4.2.4]: https://www.rfc-editor.org/rfc/rfc7292#section-4.2.4 39 | pub type CrlTypes = OctetString; 40 | -------------------------------------------------------------------------------- /pkcs12/src/digest_info.rs: -------------------------------------------------------------------------------- 1 | //! DigestInfo-related types 2 | 3 | use der::{Sequence, ValueOrd, asn1::OctetString}; 4 | use spki::AlgorithmIdentifierOwned; 5 | 6 | /// ```text 7 | /// DigestInfo ::= SEQUENCE { 8 | /// digestAlgorithm DigestAlgorithmIdentifier, 9 | /// digest Digest } 10 | /// ``` 11 | #[derive(Clone, Debug, Eq, PartialEq, Sequence, ValueOrd)] 12 | pub struct DigestInfo { 13 | /// the algorithm. 14 | pub algorithm: AlgorithmIdentifierOwned, 15 | 16 | /// the digest 17 | pub digest: OctetString, 18 | } 19 | -------------------------------------------------------------------------------- /pkcs12/src/mac_data.rs: -------------------------------------------------------------------------------- 1 | //! MacData-related types 2 | 3 | use crate::digest_info::DigestInfo; 4 | use der::{Sequence, ValueOrd, asn1::OctetString}; 5 | 6 | /// The `MacData` type is defined in [RFC 7292 Section 4]. 7 | /// 8 | /// ```text 9 | /// MacData ::= SEQUENCE { 10 | /// mac DigestInfo, 11 | /// macSalt OCTET STRING, 12 | /// iterations INTEGER DEFAULT 1 13 | /// -- Note: The default is for historical reasons and its 14 | /// -- use is deprecated. 15 | ///} 16 | /// ``` 17 | /// 18 | /// [RFC 7292 Section 4]: https://www.rfc-editor.org/rfc/rfc7292#section-4 19 | #[derive(Clone, Debug, Eq, PartialEq, Sequence, ValueOrd)] 20 | pub struct MacData { 21 | /// the MAC digest info 22 | pub mac: DigestInfo, 23 | 24 | /// the MAC salt 25 | pub mac_salt: OctetString, 26 | 27 | /// the number of iterations 28 | #[asn1(default = "default_one")] 29 | pub iterations: i32, 30 | } 31 | 32 | fn default_one() -> i32 { 33 | 1 34 | } 35 | -------------------------------------------------------------------------------- /pkcs12/src/pfx.rs: -------------------------------------------------------------------------------- 1 | //! PFX-related types 2 | 3 | use core::cmp::Ordering; 4 | 5 | use der::{Enumerated, Sequence, ValueOrd}; 6 | 7 | use crate::mac_data::MacData; 8 | use cms::content_info::ContentInfo; 9 | 10 | /// just the version v3 11 | #[derive(Clone, Copy, Debug, Enumerated, Eq, PartialEq, PartialOrd, Ord)] 12 | #[asn1(type = "INTEGER")] 13 | #[repr(u8)] 14 | pub enum Version { 15 | /// syntax version 3 16 | V3 = 3, 17 | } 18 | 19 | impl ValueOrd for Version { 20 | fn value_cmp(&self, other: &Self) -> der::Result { 21 | Ok(self.cmp(other)) 22 | } 23 | } 24 | 25 | /// The `PFX` type is defined in [RFC 7292 Section 4]. 26 | /// 27 | /// ```text 28 | /// PFX ::= SEQUENCE { 29 | /// version INTEGER {v3(3)}(v3,...), 30 | /// authSafe ContentInfo, 31 | /// macData MacData OPTIONAL 32 | /// } 33 | /// 34 | /// ``` 35 | /// 36 | /// [RFC 7292 Section 4]: https://www.rfc-editor.org/rfc/rfc7292#section-4 37 | #[derive(Debug, Sequence)] 38 | pub struct Pfx { 39 | /// the syntax version number. 40 | pub version: Version, 41 | 42 | /// the authenticated safe 43 | pub auth_safe: ContentInfo, 44 | 45 | /// the message digest info 46 | pub mac_data: Option, 47 | } 48 | -------------------------------------------------------------------------------- /pkcs12/tests/examples/GoodCACert.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDfDCCAmSgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBFMQswCQYDVQQGEwJVUzEf 3 | MB0GA1UEChMWVGVzdCBDZXJ0aWZpY2F0ZXMgMjAxMTEVMBMGA1UEAxMMVHJ1c3Qg 4 | QW5jaG9yMB4XDTEwMDEwMTA4MzAwMFoXDTMwMTIzMTA4MzAwMFowQDELMAkGA1UE 5 | BhMCVVMxHzAdBgNVBAoTFlRlc3QgQ2VydGlmaWNhdGVzIDIwMTExEDAOBgNVBAMT 6 | B0dvb2QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCQWJpHYo37 7 | Xfb7oJSPe+WvfTlzIG21WQ7MyMbGtK/m8mejCzR6c+f/pJhEH/OcDSMsXq8h5kXa 8 | BGqWK+vSwD/Pzp5OYGptXmGPcthDtAwlrafkGOS4GqIJ8+k9XGKs+vQUXJKsOk47 9 | RuzD6PZupq4s16xaLVqYbUC26UcY08GpnoLNHJZS/EmXw1ZZ3d4YZjNlpIpWFNHn 10 | UGmdiGKXUPX/9H0fVjIAaQwjnGAbpgyCumWgzIwPpX+ElFOUr3z7BoVnFKhIXze+ 11 | VmQGSWxZxvWDUN90Ul0tLEpLgk3OVxUB4VUGuf15OJOpgo1xibINPmWt14Vda2N9 12 | yrNKloJGZNqLAgMBAAGjfDB6MB8GA1UdIwQYMBaAFOR9X9FclYYILAWuvnW2ZafZ 13 | XahmMB0GA1UdDgQWBBRYAYQkG7wrUpRKPaUQchRR9a86yTAOBgNVHQ8BAf8EBAMC 14 | AQYwFwYDVR0gBBAwDjAMBgpghkgBZQMCATABMA8GA1UdEwEB/wQFMAMBAf8wDQYJ 15 | KoZIhvcNAQELBQADggEBADWHlxbmdTXNwBL/llwhQqwnazK7CC2WsXBBqgNPWj7m 16 | tvQ+aLG8/50Qc2Sun7o2VnwF9D18UUe8Gj3uPUYH+oSI1vDdyKcjmMbKRU4rk0eo 17 | 3UHNDXwqIVc9CQS9smyV+x1HCwL4TTrq+LXLKx/qVij0Yqk+UJfAtrg2jnYKXsCu 18 | FMBQQnWCGrwa1g1TphRp/RmYHnMynYFmZrXtzFz+U9XEA7C+gPq4kqDI/iVfIT1s 19 | 6lBtdB50lrDVwl2oYfAvW/6sC2se2QleZidUmrziVNP4oEeXINokU6T6p//HM1FG 20 | QYw2jOvpKcKtWCSAnegEbgsGYzATKjmPJPJ0npHFqzM= 21 | -----END CERTIFICATE----- 22 | -------------------------------------------------------------------------------- /pkcs12/tests/examples/GoodCACert.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/GoodCACert.der -------------------------------------------------------------------------------- /pkcs12/tests/examples/ValidCertificatePathTest1EE.crt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/ValidCertificatePathTest1EE.crt -------------------------------------------------------------------------------- /pkcs12/tests/examples/ValidCertificatePathTest1EE.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/ValidCertificatePathTest1EE.key -------------------------------------------------------------------------------- /pkcs12/tests/examples/ValidCertificatePathTest1EE.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/ValidCertificatePathTest1EE.p12 -------------------------------------------------------------------------------- /pkcs12/tests/examples/ValidCertificatePathTest1EE_firefox.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/ValidCertificatePathTest1EE_firefox.p12 -------------------------------------------------------------------------------- /pkcs12/tests/examples/ValidCertificatePathTest1EE_macos.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/ValidCertificatePathTest1EE_macos.p12 -------------------------------------------------------------------------------- /pkcs12/tests/examples/ValidCertificatePathTest1EE_windows_aes.p12.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/ValidCertificatePathTest1EE_windows_aes.p12.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/ValidCertificatePathTest1EE_windows_tdes.p12.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/ValidCertificatePathTest1EE_windows_tdes.p12.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/cert.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/cert.der -------------------------------------------------------------------------------- /pkcs12/tests/examples/cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICzDCCAjWgAwIBAgIUZMDrcllVoypmH9d8mGdPACkwWRswDQYJKoZIhvcNAQEL 3 | BQAweDELMAkGA1UEBhMCREsxFDASBgNVBAgMC0hvdmVkc3RhZGVuMRUwEwYDVQQH 4 | DAxLw4PCuGJlbmhhdm4xDDAKBgNVBAoMAy4uLjEMMAoGA1UECwwDLi4uMQwwCgYD 5 | VQQDDAMuLi4xEjAQBgkqhkiG9w0BCQEWAy4uLjAeFw0yMzAxMDMxNzIwNTBaFw0y 6 | NDAxMDMxNzIwNTBaMHgxCzAJBgNVBAYTAkRLMRQwEgYDVQQIDAtIb3ZlZHN0YWRl 7 | bjEVMBMGA1UEBwwMS8ODwrhiZW5oYXZuMQwwCgYDVQQKDAMuLi4xDDAKBgNVBAsM 8 | Ay4uLjEMMAoGA1UEAwwDLi4uMRIwEAYJKoZIhvcNAQkBFgMuLi4wgZ8wDQYJKoZI 9 | hvcNAQEBBQADgY0AMIGJAoGBALFxLL2rx1ilbfXiI3iMIrjIenu3ucHysMYh0t1f 10 | 6mTyAqDsg7C5VEh5CESFbGEc10vu5ZrGfx3iREpFyuK/sMf4DJ+JHNw5nemMBcRy 11 | edHccx2qLDqeTmtwRQCPaSJm6D1pGACRRjpDMl/s+FFkxPUBeGGerkJlbow+rC5A 12 | nZS3AgMBAAGjUzBRMB0GA1UdDgQWBBR6gNs30Q3+JPqx0nTdyW1ODBWUQzAfBgNV 13 | HSMEGDAWgBR6gNs30Q3+JPqx0nTdyW1ODBWUQzAPBgNVHRMBAf8EBTADAQH/MA0G 14 | CSqGSIb3DQEBCwUAA4GBAAMvY8V9Si+1ZjGRQCqSTtlkaakYOEfgnfqXOUbGNnO6 15 | 7vsJbSX3S0CG0ciMbaIxyMG2TkRzSfJiODOblC5RnXg7EF0nU0oNBIYw3FY40lTD 16 | rCgqQV4aEYScPCmuHS7pGM87VTrcxbMY+1vPq6iSadn4ijifOaBpj7Z5esWwVaUp 17 | -----END CERTIFICATE----- 18 | -------------------------------------------------------------------------------- /pkcs12/tests/examples/example.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/example10.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example10.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/example11.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example11.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/example12.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example12.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/example13.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example13.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/example14.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example14.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/example15.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example15.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/example16.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example16.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/example17.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example17.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/example2.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example2.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/example3.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example3.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/example4.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example4.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/example5.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example5.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/example6.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example6.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/example7.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example7.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/example8.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example8.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/example9.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/example9.pfx -------------------------------------------------------------------------------- /pkcs12/tests/examples/gen.sh: -------------------------------------------------------------------------------- 1 | openssl req -x509 -newkey rsa:1024 -keyout key.pem -out cert.pem -sha256 -days 365 -noenc -subj "/C=DK/ST=Hovedstaden/L=København/O=.../OU=.../CN=.../emailAddress=..." 2 | openssl pkcs12 -export -out example.pfx -inkey key.pem -in cert.pem -passout pass: 3 | openssl pkcs12 -export -out example2.pfx -in cert.pem -inkey key.pem -certpbe NONE -passout pass:1234 -------------------------------------------------------------------------------- /pkcs12/tests/examples/key.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs12/tests/examples/key.der -------------------------------------------------------------------------------- /pkcs12/tests/examples/key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBALFxLL2rx1ilbfXi 3 | I3iMIrjIenu3ucHysMYh0t1f6mTyAqDsg7C5VEh5CESFbGEc10vu5ZrGfx3iREpF 4 | yuK/sMf4DJ+JHNw5nemMBcRyedHccx2qLDqeTmtwRQCPaSJm6D1pGACRRjpDMl/s 5 | +FFkxPUBeGGerkJlbow+rC5AnZS3AgMBAAECgYBoT+8MZbKgI0hcVx+hG0jCNmEC 6 | 4AQcx04ye+nZaCyEQV1YOxJDzv+ER1qb5Y/MG0daBUwHTA+ogr7ApvzZhfUm7qB/ 7 | ISf57QmoJc+60x8u45VXxOSMPuTHXWAwY56kSLglFbDFyy0dA02vsXo3PZ/DLa8Q 8 | sEaGmZUMJYgWUGBX+QJBAN1EQE7jiPs3tOizuCNrw8LIxkMPjrm7FU0BTA3CcmqA 9 | K5FXh6WDTeMvp+fstjscpWrg9buSUTBWHR8uO0AUKBUCQQDNS846s57CtFbcldOL 10 | UMfvEkZ73HuaXF6wPb8SoaUPR/9AhQaWCfQuBkzi4rW8ZGPigxl4hS6BA2zkqIk8 11 | SBCbAkEA0Na6W7smbvYFKh12jvgHrLETb/gfHe4WDLhMsC/3Dc4rUOLshKuJuAQi 12 | 1iP1W5WOC3KIfKF9P8IHeoaIJdLggQJBALQeuoZOahCyYTOQUNZ+vaxIAIdT3y6D 13 | tKA0zJvwLv3FUXKuRCUH/rES3gqClqj/+5MVKxfO4gpXkwbbx+yX3dkCQQDaQrrB 14 | HvJ3l5F5SY5jFOsQY27dfXqdhbTRTQtE+uqAd3lwOix0mjROAfiXXXJ6I95cXUFb 15 | EtKC5DoanfxFWn49 16 | -----END PRIVATE KEY----- 17 | -------------------------------------------------------------------------------- /pkcs5/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA1_algid.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA1_algid.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA1_ciphertext.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA1_ciphertext.bin -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA224_algid.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA224_algid.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA224_ciphertext.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA224_ciphertext.bin -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA256_algid.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA256_algid.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA256_ciphertext.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA256_ciphertext.bin -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA384_algid.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA384_algid.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA384_ciphertext.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA384_ciphertext.bin -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA512_algid.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA512_algid.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA512_ciphertext.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-128-cbc_hmacWithSHA512_ciphertext.bin -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA1_algid.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA1_algid.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA1_ciphertext.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA1_ciphertext.bin -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA224_algid.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA224_algid.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA224_ciphertext.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA224_ciphertext.bin -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA256_algid.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA256_algid.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA256_ciphertext.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA256_ciphertext.bin -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA384_algid.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA384_algid.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA384_ciphertext.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA384_ciphertext.bin -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA512_algid.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA512_algid.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA512_ciphertext.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-192-cbc_hmacWithSHA512_ciphertext.bin -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA1_algid.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA1_algid.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA1_ciphertext.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA1_ciphertext.bin -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA224_algid.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA224_algid.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA224_ciphertext.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA224_ciphertext.bin -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA256_algid-no-param.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA256_algid-no-param.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA256_algid.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA256_algid.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA256_ciphertext.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA256_ciphertext.bin -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA384_algid.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA384_algid.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA384_ciphertext.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA384_ciphertext.bin -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA512_algid.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA512_algid.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA512_ciphertext.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/pbes2_aes-256-cbc_hmacWithSHA512_ciphertext.bin -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk.pkcs1.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXAIBAAKBgQC8kFIo73BV0oUpAzYB0yFQydoJX4XhJU89biicA133jJd8MkVE 3 | DQrnFNsjckBB9yretNvJxIG30cBc6139Goowj0q7Ocwb32LONYYhuU4wG8zl8L8B 4 | EaC1mi4J02OUChZ7JCw6W9nat69kMaEbOWZxSDkfybXBelh6OxUGdXd3cwIDAQAB 5 | AoGAawDi/sPRVYJfekSOMz7iWvwQtNz2Fiub6dpHRTFL85xeomXMlK9qDnPxXw4I 6 | lOZz92leiALxMaTfqlsOPQEAhU5XoA8jGwVSC2T6urfrSzQzKfLn4rKyEQCYIiIe 7 | Q2b7ScxFUFxaOXxELK1AzGnTJ2NUCkk5+SdNSP8DzYeRwnECQQD7Bzca+7Qgff6l 8 | y9mXj3sz4RAF1t8lGf/2dzGmRXwIq87O74s50jBl0tvdEg5RUj7bQ09XdRuMjBKp 9 | 1DOJS3U/AkEAwExkpLgT35HU0D1Y1zWlpERX8qGbLlBp/AlRgRuwFSPnmoFyVutV 10 | ahgOH5KayVN55rwJRLH9jEhjrtjZyGxszQJAB4q69BuV2NgQO4j5W51a9T8QzSwc 11 | fi/eydfg7P7vcA9BYmQ+CZmwDI8ePfEZ7wWKj+ngy17gWgOnV+ThO4HB3wJBAJM4 12 | aTzqaNybCzC6Js/slHnkkOiC7QlSKzH3+Fw91Fr6+A+D1wPQe74T2Iw3cyV7MTKC 13 | 9x2OnyzNJvPvtRwKVmkCQGTiqQybnnZ4PSY6fIe5AnvcO9tK4BchySkOQ2Ws726G 14 | zGcbmmz1ShDo7tPNUk4hcWUOJFbR6/1zDYJIzmACvL0= 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk.pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/rsa_sk.pkcs8.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk_aes-128-cbc_hmacWithSHA1.pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/rsa_sk_aes-128-cbc_hmacWithSHA1.pkcs8.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk_aes-128-cbc_hmacWithSHA224.pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/rsa_sk_aes-128-cbc_hmacWithSHA224.pkcs8.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk_aes-128-cbc_hmacWithSHA256.pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/rsa_sk_aes-128-cbc_hmacWithSHA256.pkcs8.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk_aes-128-cbc_hmacWithSHA384.pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/rsa_sk_aes-128-cbc_hmacWithSHA384.pkcs8.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk_aes-128-cbc_hmacWithSHA512.pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/rsa_sk_aes-128-cbc_hmacWithSHA512.pkcs8.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk_aes-192-cbc_hmacWithSHA1.pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/rsa_sk_aes-192-cbc_hmacWithSHA1.pkcs8.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk_aes-192-cbc_hmacWithSHA224.pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/rsa_sk_aes-192-cbc_hmacWithSHA224.pkcs8.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk_aes-192-cbc_hmacWithSHA256.pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/rsa_sk_aes-192-cbc_hmacWithSHA256.pkcs8.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk_aes-192-cbc_hmacWithSHA384.pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/rsa_sk_aes-192-cbc_hmacWithSHA384.pkcs8.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk_aes-192-cbc_hmacWithSHA512.pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/rsa_sk_aes-192-cbc_hmacWithSHA512.pkcs8.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk_aes-256-cbc_hmacWithSHA1.pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/rsa_sk_aes-256-cbc_hmacWithSHA1.pkcs8.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk_aes-256-cbc_hmacWithSHA224.pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/rsa_sk_aes-256-cbc_hmacWithSHA224.pkcs8.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk_aes-256-cbc_hmacWithSHA256.pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/rsa_sk_aes-256-cbc_hmacWithSHA256.pkcs8.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk_aes-256-cbc_hmacWithSHA384.pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/rsa_sk_aes-256-cbc_hmacWithSHA384.pkcs8.der -------------------------------------------------------------------------------- /pkcs5/tests/examples/rsa_sk_aes-256-cbc_hmacWithSHA512.pkcs8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs5/tests/examples/rsa_sk_aes-256-cbc_hmacWithSHA512.pkcs8.der -------------------------------------------------------------------------------- /pkcs7/README.md: -------------------------------------------------------------------------------- 1 | ## 🚨 DEPRECATED! 🚨 2 | 3 | The `pkcs7` crate is deprecated and will not receive further releases. 4 | 5 | Please migrate to the following instead: 6 | 7 | - For Cryptographic Message Syntax (CMS): use the [`cms` crate](https://github.com/RustCrypto/formats/tree/master/cms). 8 | - For PKCS#7 block padding: use [`block_padding::Pkcs7`](https://docs.rs/block-padding/latest/block_padding/struct.Pkcs7.html) 9 | 10 | See [#1045] for more information. 11 | 12 | [#1045]: https://github.com/RustCrypto/formats/issues/1045 13 | -------------------------------------------------------------------------------- /pkcs8/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /pkcs8/tests/examples/bign256-priv.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs8/tests/examples/bign256-priv.der -------------------------------------------------------------------------------- /pkcs8/tests/examples/bign256-priv.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MD8CAQAwGAYKKnAAAgAiZS0CAQYKKnAAAgAiZS0DAQQgH2a1uEtzOWdFM/AynHTy 3 | GDQoH+0HMkKeDHkjX8Jz4mk= 4 | -----END PRIVATE KEY----- 5 | -------------------------------------------------------------------------------- /pkcs8/tests/examples/ed25519-encpriv-aes128-gcm-scrypt.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs8/tests/examples/ed25519-encpriv-aes128-gcm-scrypt.der -------------------------------------------------------------------------------- /pkcs8/tests/examples/ed25519-encpriv-aes128-pbkdf2-sha1.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs8/tests/examples/ed25519-encpriv-aes128-pbkdf2-sha1.der -------------------------------------------------------------------------------- /pkcs8/tests/examples/ed25519-encpriv-aes256-gcm-scrypt.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs8/tests/examples/ed25519-encpriv-aes256-gcm-scrypt.der -------------------------------------------------------------------------------- /pkcs8/tests/examples/ed25519-encpriv-aes256-pbkdf2-sha256.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs8/tests/examples/ed25519-encpriv-aes256-pbkdf2-sha256.der -------------------------------------------------------------------------------- /pkcs8/tests/examples/ed25519-encpriv-aes256-pbkdf2-sha256.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN ENCRYPTED PRIVATE KEY----- 2 | MIGbMFcGCSqGSIb3DQEFDTBKMCkGCSqGSIb3DQEFDDAcBAh52YLnDfkaiAICCAAw 3 | DAYIKoZIhvcNAgkFADAdBglghkgBZQMEASoEELLQLXiy79nf9pTPjgr0CSUEQNDN 4 | bHcPS7hxdkIjBcF0AYCeImZ0znQYXSIb/aqVBpiQyIgvzgKwXUG8v1SwNVlbzUFU 5 | syWTcIRpuGqs+IFaeys= 6 | -----END ENCRYPTED PRIVATE KEY----- 7 | -------------------------------------------------------------------------------- /pkcs8/tests/examples/ed25519-encpriv-aes256-scrypt.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs8/tests/examples/ed25519-encpriv-aes256-scrypt.der -------------------------------------------------------------------------------- /pkcs8/tests/examples/ed25519-encpriv-aes256-scrypt.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN ENCRYPTED PRIVATE KEY----- 2 | MIGTME8GCSqGSIb3DQEFDTBCMCEGCSsGAQQB2kcECzAUBAjmIR4jSK1p4AICQAAC 3 | AQgCAQEwHQYJYIZIAWUDBAEqBBCb0KYlHyJU+f1ZY4h8J88BBEDMYrp3PA9JX6s2 4 | aOT8782wjnig7hXgoVAT9iq+CNqnQgZe6zZtbmyYzDsOfmm9yGHIiv648D26Hixt 5 | mdBtFzYM 6 | -----END ENCRYPTED PRIVATE KEY----- 7 | -------------------------------------------------------------------------------- /pkcs8/tests/examples/ed25519-encpriv-des-pbkdf2-sha256.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs8/tests/examples/ed25519-encpriv-des-pbkdf2-sha256.der -------------------------------------------------------------------------------- /pkcs8/tests/examples/ed25519-encpriv-des3-pbkdf2-sha256.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs8/tests/examples/ed25519-encpriv-des3-pbkdf2-sha256.der -------------------------------------------------------------------------------- /pkcs8/tests/examples/ed25519-priv-pkcs8v1.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs8/tests/examples/ed25519-priv-pkcs8v1.der -------------------------------------------------------------------------------- /pkcs8/tests/examples/ed25519-priv-pkcs8v1.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MC4CAQAwBQYDK2VwBCIEIBftnHPp22SewYmmEoMcX8VwI4IHwaqd+9LFPj/15eqF 3 | -----END PRIVATE KEY----- 4 | -------------------------------------------------------------------------------- /pkcs8/tests/examples/ed25519-priv-pkcs8v2.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs8/tests/examples/ed25519-priv-pkcs8v2.der -------------------------------------------------------------------------------- /pkcs8/tests/examples/ed25519-priv-pkcs8v2.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MHICAQEwBQYDK2VwBCIEINTuctv5E1hK1bbY8fdp+K06/nwoy/HU++CXqI9EdVhC 3 | oB8wHQYKKoZIhvcNAQkJFDEPDA1DdXJkbGUgQ2hhaXJzgSEAGb9ECWmEzf6FQbrB 4 | Z9w7lshQhqowtrbLDFw4rXAxZuE= 5 | -----END PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /pkcs8/tests/examples/ed25519-pub.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs8/tests/examples/ed25519-pub.der -------------------------------------------------------------------------------- /pkcs8/tests/examples/ed25519-pub.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MCowBQYDK2VwAyEATSkWfz8ZEqb3rfopOgUaFcBexnuPFyZ7HFVQ3OhTvQ0= 3 | -----END PUBLIC KEY----- 4 | -------------------------------------------------------------------------------- /pkcs8/tests/examples/p256-priv.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs8/tests/examples/p256-priv.der -------------------------------------------------------------------------------- /pkcs8/tests/examples/p256-priv.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgaWJBcVYaYzQN4OfY 3 | afKgVJJVjhoEhotqn4VKhmeIGI2hRANCAAQcrP+1Xy8s79idies3SyaBFSRSgC3u 4 | oJkWBoE32DnPf8SBpESSME1+9mrBF77+g6jQjxVfK1L59hjdRHApBI4P 5 | -----END PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /pkcs8/tests/examples/p256-pub.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs8/tests/examples/p256-pub.der -------------------------------------------------------------------------------- /pkcs8/tests/examples/p256-pub.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEHKz/tV8vLO/YnYnrN0smgRUkUoAt 3 | 7qCZFgaBN9g5z3/EgaREkjBNfvZqwRe+/oOo0I8VXytS+fYY3URwKQSODw== 4 | -----END PUBLIC KEY----- 5 | -------------------------------------------------------------------------------- /pkcs8/tests/examples/rsa2048-priv.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs8/tests/examples/rsa2048-priv.der -------------------------------------------------------------------------------- /pkcs8/tests/examples/rsa2048-pub.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs8/tests/examples/rsa2048-pub.der -------------------------------------------------------------------------------- /pkcs8/tests/examples/rsa2048-pub.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtsQsUV8QpqrygsY+2+JC 3 | Q6Fw8/omM71IM2N/R8pPbzbgOl0p78MZGsgPOQ2HSznjD0FPzsH8oO2B5Uftws04 4 | LHb2HJAYlz25+lN5cqfHAfa3fgmC38FfwBkn7l582UtPWZ/wcBOnyCgb3yLcvJrX 5 | yrt8QxHJgvWO23ITrUVYszImbXQ67YGS0YhMrbixRzmo2tpm3JcIBtnHrEUMsT0N 6 | fFdfsZhTT8YbxBvA8FdODgEwx7u/vf3J9qbi4+Kv8cvqyJuleIRSjVXPsIMnoejI 7 | n04APPKIjpMyQdnWlby7rNyQtE4+CV+jcFjqJbE/Xilcvqxt6DirjFCvYeKYl1uH 8 | LwIDAQAB 9 | -----END PUBLIC KEY----- 10 | -------------------------------------------------------------------------------- /pkcs8/tests/examples/x25519-priv.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/pkcs8/tests/examples/x25519-priv.der -------------------------------------------------------------------------------- /pkcs8/tests/examples/x25519-priv.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MC4CAQAwBQYDK2VuBCIEIHBgJSkzrG56SpsOsmMsWgQKhyV624aaPszD0WtyTyZH 3 | -----END PRIVATE KEY----- 4 | -------------------------------------------------------------------------------- /sec1/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /sec1/tests/examples/p256-priv.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/sec1/tests/examples/p256-priv.der -------------------------------------------------------------------------------- /sec1/tests/examples/p256-priv.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PRIVATE KEY----- 2 | MHcCAQEEIGliQXFWGmM0DeDn2GnyoFSSVY4aBIaLap+FSoZniBiNoAoGCCqGSM49 3 | AwEHoUQDQgAEHKz/tV8vLO/YnYnrN0smgRUkUoAt7qCZFgaBN9g5z3/EgaREkjBN 4 | fvZqwRe+/oOo0I8VXytS+fYY3URwKQSODw== 5 | -----END EC PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /serdect/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022-2025 The RustCrypto Project Developers 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /spki/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /spki/src/digest.rs: -------------------------------------------------------------------------------- 1 | use der::{Result, Writer}; 2 | use digest::Digest; 3 | 4 | /// Adapter object to write to a digest backend 5 | pub struct DigestWriter<'d, D>(pub &'d mut D); 6 | 7 | impl Writer for DigestWriter<'_, D> 8 | where 9 | D: Digest, 10 | { 11 | fn write(&mut self, slice: &[u8]) -> Result<()> { 12 | self.0.update(slice); 13 | Ok(()) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /spki/tests/examples/ed25519-pub.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/spki/tests/examples/ed25519-pub.der -------------------------------------------------------------------------------- /spki/tests/examples/ed25519-pub.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MCowBQYDK2VwAyEATSkWfz8ZEqb3rfopOgUaFcBexnuPFyZ7HFVQ3OhTvQ0= 3 | -----END PUBLIC KEY----- 4 | -------------------------------------------------------------------------------- /spki/tests/examples/p256-pub.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/spki/tests/examples/p256-pub.der -------------------------------------------------------------------------------- /spki/tests/examples/p256-pub.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEHKz/tV8vLO/YnYnrN0smgRUkUoAt 3 | 7qCZFgaBN9g5z3/EgaREkjBNfvZqwRe+/oOo0I8VXytS+fYY3URwKQSODw== 4 | -----END PUBLIC KEY----- 5 | -------------------------------------------------------------------------------- /spki/tests/examples/rsa2048-pub.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/spki/tests/examples/rsa2048-pub.der -------------------------------------------------------------------------------- /spki/tests/examples/rsa2048-pub.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtsQsUV8QpqrygsY+2+JC 3 | Q6Fw8/omM71IM2N/R8pPbzbgOl0p78MZGsgPOQ2HSznjD0FPzsH8oO2B5Uftws04 4 | LHb2HJAYlz25+lN5cqfHAfa3fgmC38FfwBkn7l582UtPWZ/wcBOnyCgb3yLcvJrX 5 | yrt8QxHJgvWO23ITrUVYszImbXQ67YGS0YhMrbixRzmo2tpm3JcIBtnHrEUMsT0N 6 | fFdfsZhTT8YbxBvA8FdODgEwx7u/vf3J9qbi4+Kv8cvqyJuleIRSjVXPsIMnoejI 7 | n04APPKIjpMyQdnWlby7rNyQtE4+CV+jcFjqJbE/Xilcvqxt6DirjFCvYeKYl1uH 8 | LwIDAQAB 9 | -----END PUBLIC KEY----- 10 | -------------------------------------------------------------------------------- /tai64/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tai64" 3 | description = "TAI64 and TAI64N (i.e. Temps Atomique International) timestamp support for Rust" 4 | version = "4.1.0" 5 | authors = ["RustCrypto Developers"] 6 | license = "Apache-2.0 OR MIT" 7 | homepage = "https://github.com/RustCrypto/formats/tree/master/tai64" 8 | repository = "https://github.com/RustCrypto/formats" 9 | readme = "README.md" 10 | categories = ["date-and-time", "internationalization", "network-programming", "no-std", "parser-implementations"] 11 | keywords = ["tai64", "time", "timestamps"] 12 | edition = "2024" 13 | rust-version = "1.85" 14 | 15 | [dependencies] 16 | serde = { version = "1", optional = true, default-features = false } 17 | zeroize = { version = "1.8", optional = true, default-features = false } 18 | 19 | [features] 20 | default = ["std"] 21 | std = [] 22 | 23 | [package.metadata.docs.rs] 24 | all-features = true 25 | -------------------------------------------------------------------------------- /tai64/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /tls_codec/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /tls_codec/derive/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tls_codec_derive" 3 | version = "0.4.2" 4 | authors = ["RustCrypto Developers"] 5 | license = "Apache-2.0 OR MIT" 6 | documentation = "https://docs.rs/tls_codec_derive/" 7 | description = "Derive macros for the tls_codec trait" 8 | readme = "../README.md" 9 | homepage = "https://github.com/RustCrypto/formats/tree/master/tls_codec/derive" 10 | repository = "https://github.com/RustCrypto/formats" 11 | edition = "2024" 12 | rust-version = "1.85" 13 | 14 | [lib] 15 | proc-macro = true 16 | 17 | [dependencies] 18 | syn = { version = "2", features = ["parsing"] } 19 | quote = "1.0" 20 | proc-macro2 = "1.0" 21 | 22 | [dev-dependencies] 23 | tls_codec = { path = "../" } 24 | trybuild = "1" 25 | 26 | [features] 27 | default = ["std"] 28 | conditional_deserialization = ["syn/full"] 29 | std = [] 30 | -------------------------------------------------------------------------------- /tls_codec/derive/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /tls_codec/derive/tests/attributes.rs: -------------------------------------------------------------------------------- 1 | #[test] 2 | fn attributes() { 3 | let t = trybuild::TestCases::new(); 4 | t.compile_fail("tests/attributes/*.rs"); 5 | } 6 | -------------------------------------------------------------------------------- /tls_codec/derive/tests/attributes/test_that_duplicate_skip_attributes_dont_compile.rs: -------------------------------------------------------------------------------- 1 | use tls_codec_derive::{TlsDeserialize, TlsSerialize, TlsSize}; 2 | 3 | #[derive(TlsDeserialize, TlsSerialize, TlsSize)] 4 | struct StructWithDuplicateSkip { 5 | #[tls_codec(skip, skip)] 6 | a: u8, 7 | } 8 | 9 | fn main() {} 10 | -------------------------------------------------------------------------------- /tls_codec/derive/tests/attributes/test_that_duplicate_skip_attributes_dont_compile.stderr: -------------------------------------------------------------------------------- 1 | error: Attribute `skip` specified more than once 2 | --> tests/attributes/test_that_duplicate_skip_attributes_dont_compile.rs:3:10 3 | | 4 | 3 | #[derive(TlsDeserialize, TlsSerialize, TlsSize)] 5 | | ^^^^^^^^^^^^^^ 6 | | 7 | = note: this error originates in the derive macro `TlsDeserialize` (in Nightly builds, run with -Z macro-backtrace for more info) 8 | 9 | error: Attribute `skip` specified more than once 10 | --> tests/attributes/test_that_duplicate_skip_attributes_dont_compile.rs:3:26 11 | | 12 | 3 | #[derive(TlsDeserialize, TlsSerialize, TlsSize)] 13 | | ^^^^^^^^^^^^ 14 | | 15 | = note: this error originates in the derive macro `TlsSerialize` (in Nightly builds, run with -Z macro-backtrace for more info) 16 | 17 | error: Attribute `skip` specified more than once 18 | --> tests/attributes/test_that_duplicate_skip_attributes_dont_compile.rs:3:40 19 | | 20 | 3 | #[derive(TlsDeserialize, TlsSerialize, TlsSize)] 21 | | ^^^^^^^ 22 | | 23 | = note: this error originates in the derive macro `TlsSize` (in Nightly builds, run with -Z macro-backtrace for more info) 24 | -------------------------------------------------------------------------------- /tls_codec/derive/tests/attributes/that_non_default_field_does_not_compile.rs: -------------------------------------------------------------------------------- 1 | use tls_codec_derive::{TlsDeserialize, TlsSerialize, TlsSize}; 2 | 3 | struct NonDefaultField {} 4 | 5 | #[derive(TlsDeserialize, TlsSerialize, TlsSize)] 6 | struct StructWithNonDefaultField { 7 | #[tls_codec(skip)] 8 | a: NonDefaultField, 9 | b: u8, 10 | } 11 | 12 | fn main() {} 13 | -------------------------------------------------------------------------------- /tls_codec/derive/tests/attributes/that_non_default_field_does_not_compile.stderr: -------------------------------------------------------------------------------- 1 | error[E0277]: the trait bound `NonDefaultField: Default` is not satisfied 2 | --> tests/attributes/that_non_default_field_does_not_compile.rs:5:10 3 | | 4 | 5 | #[derive(TlsDeserialize, TlsSerialize, TlsSize)] 5 | | ^^^^^^^^^^^^^^ the trait `Default` is not implemented for `NonDefaultField` 6 | | 7 | = note: this error originates in the derive macro `TlsDeserialize` (in Nightly builds, run with -Z macro-backtrace for more info) 8 | help: consider annotating `NonDefaultField` with `#[derive(Default)]` 9 | | 10 | 3 + #[derive(Default)] 11 | 4 | struct NonDefaultField {} 12 | | 13 | -------------------------------------------------------------------------------- /tls_codec/derive/tests/attributes/that_skip_attribute_does_not_compile_on_enums.rs: -------------------------------------------------------------------------------- 1 | use tls_codec_derive::{TlsDeserialize, TlsSerialize, TlsSize}; 2 | 3 | #[derive(TlsDeserialize, TlsSerialize, TlsSize)] 4 | #[repr(u8)] 5 | enum EnumWithSkip { 6 | #[tls_codec(skip)] 7 | A, 8 | B, 9 | } 10 | 11 | fn main() {} 12 | -------------------------------------------------------------------------------- /tls_codec/derive/tests/attributes/that_skip_attribute_does_not_compile_on_enums.stderr: -------------------------------------------------------------------------------- 1 | error: Unrecognized variant attribute `skip` 2 | --> tests/attributes/that_skip_attribute_does_not_compile_on_enums.rs:3:10 3 | | 4 | 3 | #[derive(TlsDeserialize, TlsSerialize, TlsSize)] 5 | | ^^^^^^^^^^^^^^ 6 | | 7 | = note: this error originates in the derive macro `TlsDeserialize` (in Nightly builds, run with -Z macro-backtrace for more info) 8 | 9 | error: Unrecognized variant attribute `skip` 10 | --> tests/attributes/that_skip_attribute_does_not_compile_on_enums.rs:3:26 11 | | 12 | 3 | #[derive(TlsDeserialize, TlsSerialize, TlsSize)] 13 | | ^^^^^^^^^^^^ 14 | | 15 | = note: this error originates in the derive macro `TlsSerialize` (in Nightly builds, run with -Z macro-backtrace for more info) 16 | 17 | error: Unrecognized variant attribute `skip` 18 | --> tests/attributes/that_skip_attribute_does_not_compile_on_enums.rs:3:40 19 | | 20 | 3 | #[derive(TlsDeserialize, TlsSerialize, TlsSize)] 21 | | ^^^^^^^ 22 | | 23 | = note: this error originates in the derive macro `TlsSize` (in Nightly builds, run with -Z macro-backtrace for more info) 24 | -------------------------------------------------------------------------------- /tls_codec/fuzz/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | corpus 3 | artifacts 4 | coverage 5 | -------------------------------------------------------------------------------- /tls_codec/fuzz/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tls_codec-fuzz" 3 | version = "0.0.0" 4 | publish = false 5 | edition = "2024" 6 | 7 | [package.metadata] 8 | cargo-fuzz = true 9 | 10 | [dependencies] 11 | libfuzzer-sys = "0.4" 12 | 13 | [dependencies.tls_codec] 14 | path = ".." 15 | features = ["arbitrary"] 16 | 17 | # Prevent this from interfering with workspaces 18 | [workspace] 19 | members = ["."] 20 | 21 | [profile.release] 22 | debug = 1 23 | 24 | [[bin]] 25 | name = "inverse" 26 | path = "fuzz_targets/inverse.rs" 27 | test = false 28 | doc = false 29 | -------------------------------------------------------------------------------- /tls_codec/fuzz/fuzz_targets/inverse.rs: -------------------------------------------------------------------------------- 1 | #![no_main] 2 | 3 | use libfuzzer_sys::fuzz_target; 4 | use tls_codec::{Deserialize, Serialize, Size, VLBytes}; 5 | 6 | fuzz_target!(|expected: VLBytes| { 7 | let serialized = expected.tls_serialize_detached().unwrap(); 8 | let slice = &mut serialized.as_slice(); 9 | 10 | let got = VLBytes::tls_deserialize(slice).unwrap(); 11 | 12 | // Assert that serialized length matches predicted length. 13 | assert_eq!(expected.tls_serialized_len(), serialized.len()); 14 | 15 | // Assert that all bytes were consumed. 16 | assert!(slice.is_empty()); 17 | 18 | // Assert that ... 19 | // expected == deserialize(serialize(expected)) 20 | assert_eq!(expected, got); 21 | }); 22 | -------------------------------------------------------------------------------- /tls_codec/tests/decode_bytes.rs: -------------------------------------------------------------------------------- 1 | use tls_codec::{DeserializeBytes, TlsByteVecU8, TlsByteVecU16, TlsByteVecU24, TlsByteVecU32}; 2 | 3 | #[test] 4 | fn deserialize_tls_byte_vec_u8() { 5 | let bytes = [3, 2, 1, 0]; 6 | let (result, rest) = TlsByteVecU8::tls_deserialize_bytes(&bytes).unwrap(); 7 | let expected_result = [2, 1, 0]; 8 | assert_eq!(result.as_slice(), expected_result); 9 | assert_eq!(rest, []); 10 | } 11 | 12 | #[test] 13 | fn deserialize_tls_byte_vec_u16() { 14 | let bytes = [0, 3, 2, 1, 0]; 15 | let (result, rest) = TlsByteVecU16::tls_deserialize_bytes(&bytes).unwrap(); 16 | let expected_result = [2, 1, 0]; 17 | assert_eq!(result.as_slice(), expected_result); 18 | assert_eq!(rest, []); 19 | } 20 | 21 | #[test] 22 | fn deserialize_tls_byte_vec_u24() { 23 | let bytes = [0, 0, 3, 2, 1, 0]; 24 | let (result, rest) = TlsByteVecU24::tls_deserialize_bytes(&bytes).unwrap(); 25 | let expected_result = [2, 1, 0]; 26 | assert_eq!(result.as_slice(), expected_result); 27 | assert_eq!(rest, []); 28 | } 29 | 30 | #[test] 31 | fn deserialize_tls_byte_vec_u32() { 32 | let bytes = [0, 0, 0, 3, 2, 1, 0]; 33 | let (result, rest) = TlsByteVecU32::tls_deserialize_bytes(&bytes).unwrap(); 34 | let expected_result = [2, 1, 0]; 35 | assert_eq!(result.as_slice(), expected_result); 36 | assert_eq!(rest, []); 37 | } 38 | -------------------------------------------------------------------------------- /x509-cert/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /x509-cert/fuzz/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | corpus 3 | artifacts 4 | Cargo.lock 5 | -------------------------------------------------------------------------------- /x509-cert/fuzz/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "x509-fuzz" 3 | version = "0.0.0" 4 | authors = ["RustCrypto Developers"] 5 | publish = false 6 | edition = "2021" 7 | 8 | [package.metadata] 9 | cargo-fuzz = true 10 | 11 | [dependencies] 12 | libfuzzer-sys = "0.4" 13 | x509-cert = "*" 14 | 15 | # Prevents this crate from interfering with the workspace 16 | [workspace] 17 | members = ["."] 18 | 19 | [patch.crates-io] 20 | der = { path = "../../der" } 21 | der_derive = { path = "../../der_derive" } 22 | pem-rfc7468 = { path = "../../pem-rfc7468" } 23 | spki = { path = "../../spki" } 24 | -------------------------------------------------------------------------------- /x509-cert/fuzz/inputs/rsa2048-csr.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/fuzz/inputs/rsa2048-csr.der -------------------------------------------------------------------------------- /x509-cert/fuzz/src/bin/certreq.rs: -------------------------------------------------------------------------------- 1 | #![no_main] 2 | 3 | use libfuzzer_sys::fuzz_target; 4 | use x509_cert::der::Decode; 5 | use x509_cert::request::CertReq; 6 | 7 | fuzz_target!(|input: &[u8]| { 8 | let _ = CertReq::from_der(input); 9 | }); 10 | -------------------------------------------------------------------------------- /x509-cert/fuzz/src/bin/certreqinfo.rs: -------------------------------------------------------------------------------- 1 | #![no_main] 2 | 3 | use libfuzzer_sys::fuzz_target; 4 | use x509_cert::der::Decode; 5 | use x509_cert::request::CertReqInfo; 6 | 7 | fuzz_target!(|input: &[u8]| { 8 | let _ = CertReqInfo::from_der(input); 9 | }); 10 | -------------------------------------------------------------------------------- /x509-cert/src/ext/pkix/constraints.rs: -------------------------------------------------------------------------------- 1 | //! PKIX Constraint Extensions 2 | 3 | mod basic; 4 | mod policy; 5 | 6 | pub mod name; 7 | 8 | pub use basic::BasicConstraints; 9 | pub use name::NameConstraints; 10 | pub use policy::PolicyConstraints; 11 | -------------------------------------------------------------------------------- /x509-cert/src/ext/pkix/constraints/policy.rs: -------------------------------------------------------------------------------- 1 | use const_oid::{AssociatedOid, ObjectIdentifier, db::rfc5280::ID_CE_POLICY_CONSTRAINTS}; 2 | use der::Sequence; 3 | 4 | /// Policy constraints extension as defined in [RFC 5280 Section 4.2.1.11]. 5 | /// 6 | /// ```text 7 | /// PolicyConstraints ::= SEQUENCE { 8 | /// requireExplicitPolicy [0] SkipCerts OPTIONAL, 9 | /// inhibitPolicyMapping [1] SkipCerts OPTIONAL 10 | /// } 11 | /// ``` 12 | /// 13 | /// [RFC 5280 Section 4.2.1.11]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.11 14 | #[derive(Clone, Debug, Eq, PartialEq, Sequence)] 15 | #[allow(missing_docs)] 16 | pub struct PolicyConstraints { 17 | #[asn1(context_specific = "0", optional = "true", tag_mode = "IMPLICIT")] 18 | pub require_explicit_policy: Option, 19 | 20 | #[asn1(context_specific = "1", optional = "true", tag_mode = "IMPLICIT")] 21 | pub inhibit_policy_mapping: Option, 22 | } 23 | 24 | impl AssociatedOid for PolicyConstraints { 25 | const OID: ObjectIdentifier = ID_CE_POLICY_CONSTRAINTS; 26 | } 27 | 28 | impl_extension!(PolicyConstraints, critical = true); 29 | -------------------------------------------------------------------------------- /x509-cert/src/ext/pkix/name.rs: -------------------------------------------------------------------------------- 1 | //! PKIX Name types 2 | 3 | mod dirstr; 4 | mod dp; 5 | mod ediparty; 6 | mod general; 7 | mod hardware; 8 | mod other; 9 | 10 | pub use dirstr::DirectoryString; 11 | pub use dp::DistributionPointName; 12 | pub use ediparty::EdiPartyName; 13 | pub use general::{GeneralName, GeneralNames}; 14 | pub use hardware::HardwareModuleName; 15 | pub use other::OtherName; 16 | -------------------------------------------------------------------------------- /x509-cert/src/ext/pkix/name/dp.rs: -------------------------------------------------------------------------------- 1 | use super::GeneralNames; 2 | use crate::name::RelativeDistinguishedName; 3 | 4 | use der::{Choice, ValueOrd}; 5 | 6 | /// DistributionPointName as defined in [RFC 5280 Section 4.2.1.13]. 7 | /// 8 | /// ```text 9 | /// DistributionPointName ::= CHOICE { 10 | /// fullName [0] GeneralNames, 11 | /// nameRelativeToCRLIssuer [1] RelativeDistinguishedName 12 | /// } 13 | /// ``` 14 | /// 15 | /// [RFC 5280 Section 4.2.1.13]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.13 16 | #[derive(Clone, Debug, Eq, PartialEq, Choice, ValueOrd)] 17 | #[allow(missing_docs)] 18 | pub enum DistributionPointName { 19 | #[asn1(context_specific = "0", tag_mode = "IMPLICIT", constructed = "true")] 20 | FullName(GeneralNames), 21 | 22 | #[asn1(context_specific = "1", tag_mode = "IMPLICIT", constructed = "true")] 23 | NameRelativeToCRLIssuer(RelativeDistinguishedName), 24 | } 25 | -------------------------------------------------------------------------------- /x509-cert/src/ext/pkix/name/other.rs: -------------------------------------------------------------------------------- 1 | use der::{Any, Sequence, ValueOrd, asn1::ObjectIdentifier}; 2 | 3 | /// OtherName as defined in [RFC 5280 Section 4.2.1.6]. 4 | /// 5 | /// ```text 6 | /// OtherName ::= SEQUENCE { 7 | /// type-id OBJECT IDENTIFIER, 8 | /// value [0] EXPLICIT ANY DEFINED BY type-id 9 | /// } 10 | /// ``` 11 | /// 12 | /// [RFC 5280 Section 4.2.1.6]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.6 13 | #[derive(Clone, Debug, Eq, PartialEq, Sequence, ValueOrd)] 14 | #[allow(missing_docs)] 15 | pub struct OtherName { 16 | pub type_id: ObjectIdentifier, 17 | 18 | #[asn1(context_specific = "0", tag_mode = "EXPLICIT")] 19 | pub value: Any, 20 | } 21 | 22 | #[test] 23 | #[cfg(test)] 24 | #[allow(clippy::unwrap_used)] 25 | fn test() { 26 | use alloc::string::ToString; 27 | use der::{Decode, Encode, asn1::Utf8StringRef}; 28 | use hex_literal::hex; 29 | 30 | let input = hex!("3021060A2B060104018237140203A0130C1155706E5F323134393530313330406D696C"); 31 | let decoded = OtherName::from_der(&input).unwrap(); 32 | 33 | let onval = Utf8StringRef::try_from(&decoded.value).unwrap(); 34 | assert_eq!(onval.to_string(), "Upn_214950130@mil"); 35 | 36 | let encoded = decoded.to_der().unwrap(); 37 | assert_eq!(&input[..], &encoded); 38 | } 39 | -------------------------------------------------------------------------------- /x509-cert/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![cfg_attr(docsrs, feature(doc_auto_cfg))] 3 | #![doc = include_str!("../README.md")] 4 | #![doc( 5 | html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg", 6 | html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg" 7 | )] 8 | #![forbid(unsafe_code)] 9 | #![warn( 10 | clippy::alloc_instead_of_core, 11 | clippy::mod_module_files, 12 | clippy::std_instead_of_alloc, 13 | clippy::std_instead_of_core, 14 | clippy::unwrap_used, 15 | missing_docs, 16 | rust_2018_idioms, 17 | unused_lifetimes, 18 | unused_qualifications 19 | )] 20 | 21 | extern crate alloc; 22 | 23 | #[cfg(feature = "std")] 24 | extern crate std; 25 | 26 | #[macro_use] 27 | mod macros; 28 | 29 | pub mod anchor; 30 | pub mod attr; 31 | pub mod certificate; 32 | pub mod crl; 33 | pub mod ext; 34 | pub mod name; 35 | pub mod request; 36 | pub mod serial_number; 37 | pub mod time; 38 | 39 | #[cfg(feature = "builder")] 40 | pub mod builder; 41 | 42 | pub use certificate::{Certificate, PkiPath, TbsCertificate, Version}; 43 | pub use der; 44 | pub use spki; 45 | pub use spki::{ 46 | AlgorithmIdentifierOwned as AlgorithmIdentifier, 47 | SubjectPublicKeyInfoOwned as SubjectPublicKeyInfo, 48 | }; 49 | -------------------------------------------------------------------------------- /x509-cert/test-support/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /x509-cert/test-support/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "x509-cert-test-support" 3 | description = """ 4 | Set of utils to run certificates through zlint or openssl. 5 | """ 6 | version = "0.1.0" 7 | edition = "2021" 8 | authors = ["RustCrypto Developers"] 9 | license = "Apache-2.0 OR MIT" 10 | homepage = "https://github.com/RustCrypto/formats/tree/master/x509-cert/test-support" 11 | repository = "https://github.com/RustCrypto/formats" 12 | categories = ["cryptography"] 13 | readme = "README.md" 14 | 15 | [dependencies] 16 | serde = { version = "1.0.184", features = ["derive"] } 17 | serde_json = "1" 18 | tempfile = "3" 19 | -------------------------------------------------------------------------------- /x509-cert/test-support/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod openssl; 2 | pub mod zlint; 3 | -------------------------------------------------------------------------------- /x509-cert/tests/crl.rs: -------------------------------------------------------------------------------- 1 | use der::Decode; 2 | use x509_cert::{certificate::Rfc5280, crl::CertificateList}; 3 | 4 | #[test] 5 | fn decode_crl() { 6 | // vanilla CRL from PKITS 7 | let der_encoded_cert = include_bytes!("examples/GoodCACRL.crl"); 8 | let crl = CertificateList::::from_der(der_encoded_cert).unwrap(); 9 | assert_eq!(2, crl.tbs_cert_list.crl_extensions.unwrap().len()); 10 | assert_eq!(2, crl.tbs_cert_list.revoked_certificates.unwrap().len()); 11 | 12 | // CRL with an entry with no entry extensions 13 | let der_encoded_cert = include_bytes!("examples/tscpbcasha256.crl"); 14 | let crl = CertificateList::::from_der(der_encoded_cert).unwrap(); 15 | assert_eq!(2, crl.tbs_cert_list.crl_extensions.unwrap().len()); 16 | assert_eq!(4, crl.tbs_cert_list.revoked_certificates.unwrap().len()); 17 | } 18 | -------------------------------------------------------------------------------- /x509-cert/tests/examples/026EDA6FA1EDFA8C253936C75B5EEBD954BFF452.fake.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/026EDA6FA1EDFA8C253936C75B5EEBD954BFF452.fake.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/085B1E2F40254F9C7A2387BE9FF4EC116C326E10.fake.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/085B1E2F40254F9C7A2387BE9FF4EC116C326E10.fake.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/0954e2343dd5efe0a7f0967d69caf33e5f893720.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/0954e2343dd5efe0a7f0967d69caf33e5f893720.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/0fcc78fbbca9f32b08b19b032b84f2c86a128f35.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/0fcc78fbbca9f32b08b19b032b84f2c86a128f35.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/15b05c4865410c6b3ff76a4e8f3d87276756bd0c.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/15b05c4865410c6b3ff76a4e8f3d87276756bd0c.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/16ee54e48c76eaa1052e09010d8faefee95e5ebb.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/16ee54e48c76eaa1052e09010d8faefee95e5ebb.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/2049a5b28f104b2c6e1a08546f9cfc0353d6fd30.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/2049a5b28f104b2c6e1a08546f9cfc0353d6fd30.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/21723e7a0fb61a0bd4a29879b82a02b2fb4ad096.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/21723e7a0fb61a0bd4a29879b82a02b2fb4ad096.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/284A0A3A9B56DD752DAA2E09E2FADEDB858D9338.fake.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/284A0A3A9B56DD752DAA2E09E2FADEDB858D9338.fake.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/28879DABB0FD11618FB74E47BE049D2933866D53.fake.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/28879DABB0FD11618FB74E47BE049D2933866D53.fake.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/288C8BCFEE6B89D110DAE2C9873897BF7FF53382.fake.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/288C8BCFEE6B89D110DAE2C9873897BF7FF53382.fake.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/28903a635b5280fae6774c0b6da7d6baa64af2e8.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/28903a635b5280fae6774c0b6da7d6baa64af2e8.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/33D8388EDA1E92475EF19075D2EF4093D1CB6F7F.fake.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/33D8388EDA1E92475EF19075D2EF4093D1CB6F7F.fake.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/342cd9d3062da48c346965297f081ebc2ef68fdc.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/342cd9d3062da48c346965297f081ebc2ef68fdc.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/554D5FF11DA613A155584D8D4AA07F67724D8077.fake.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/554D5FF11DA613A155584D8D4AA07F67724D8077.fake.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/GoodCACRL.crl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/GoodCACRL.crl -------------------------------------------------------------------------------- /x509-cert/tests/examples/GoodCACert.crt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/GoodCACert.crt -------------------------------------------------------------------------------- /x509-cert/tests/examples/amazon.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/amazon.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/eca.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/eca.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/eca_policies.ta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/eca_policies.ta -------------------------------------------------------------------------------- /x509-cert/tests/examples/entrust.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/entrust.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/entrust_dnConstraint.ta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/entrust_dnConstraint.ta -------------------------------------------------------------------------------- /x509-cert/tests/examples/exostar.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/exostar.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/exostar_policyFlags.ta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/exostar_policyFlags.ta -------------------------------------------------------------------------------- /x509-cert/tests/examples/p256-priv.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/p256-priv.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/p256-pub.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/p256-pub.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/qualcomm.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICnDCCAiGgAwIBAgIWAITOC/ag/oJO5eUGyqideMYVAWJXcTAKBggqhkjOPQQD 3 | AzB2MSQwIgYDVQQKDBtRdWFsY29tbSBUZWNobm9sb2dpZXMsIEluYy4xKjAoBgNV 4 | BAsMIVF1YWxjb21tIENyeXB0b2dyYXBoaWMgT3BlcmF0aW9uczEiMCAGA1UEAwwZ 5 | UU1DIEF0dGVzdGF0aW9uIFJvb3QgQ0EgNDAeFw0xNzA4MDEyMjE2MzJaFw0yNzA4 6 | MDEyMjE2MzJaMH4xJDAiBgNVBAoMG1F1YWxjb21tIFRlY2hub2xvZ2llcywgSW5j 7 | LjEqMCgGA1UECwwhUXVhbGNvbW0gQ3J5cHRvZ3JhcGhpYyBPcGVyYXRpb25zMSow 8 | KAYDVQQDDCFRTUMgQXR0ZXN0YXRpb24gUm9vdCBDQSA0IFN1YkNBIDEwdjAQBgcq 9 | hkjOPQIBBgUrgQQAIgNiAAQDsjssSUEFLyyBe17UmO3pMzqKS+V1jfQkhq7a7zmH 10 | LCrPFmfaKLm0/szdzZxn+zwhoYen3fgJIuZUaip8wAQxLe4550c1ZBl3iSTvYUbe 11 | J+gBz2DiJHRBOtY1bQH35NWjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQAwDgYDVR0P 12 | AQH/BAQDAgEGMB0GA1UdDgQWBBTrVYStHPbaTn4k7bPerqZAmJcuXzAfBgNVHSME 13 | GDAWgBQBBnkODO3o7rgWy996xOf1BxR4VTAKBggqhkjOPQQDAwNpADBmAjEAmpM/ 14 | Xvfawl4/A3jd0VVb6lOBh0Jy+zFz1Jz/hw+Xpm9G4XJCscBE7r7lbe2Xc1DHAjEA 15 | psnskI8pLJQwL80QzAwP3HvgyDUeedNpxnYNK797vqJu6uRMLsZBVHatLM1R4gyE 16 | -----END CERTIFICATE----- 17 | -------------------------------------------------------------------------------- /x509-cert/tests/examples/raytheon.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/raytheon.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/raytheon_pathLenConstraint.ta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/raytheon_pathLenConstraint.ta -------------------------------------------------------------------------------- /x509-cert/tests/examples/rsa2048-crt.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/rsa2048-crt.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/rsa2048-csr.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/rsa2048-csr.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/rsa2048-csr.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIIDCTCCAfECAQAwZDEUMBIGA1UEAwwLZXhhbXBsZS5jb20xFDASBgNVBAcMC0xv 3 | cyBBbmdlbGVzMRMwEQYDVQQIDApDYWxpZm9ybmlhMRQwEgYDVQQKDAtFeGFtcGxl 4 | IEluYzELMAkGA1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB 5 | AQC/Wff+cW3eR8c1ecqEbvqNMKs2EuDWpSQgSnLKjlDJ9FlRPfDXMzG+09ei2no2 6 | Jxnkce5qnYeCfRAk7URgWrm0jzuAjF4XO58+xAA9V/FxhIn1x6BCHEb71SekCrS6 7 | a52xalRdHs9uKlYzvYBZTrpK/ucfY+HTV8ZOmj/2uDdGqIXDc/NSeYfkwrSvf+TU 8 | 6hZAXl4VKF3ZOII6oY4mNLr+hHp2HK+rsEAdP6A6B6nQl8uwx3FWzP42Ex2t8cEJ 9 | woI5cvCvIaNfNY54gwTAx4uVFznZH6v/0HqozU9pdGs9DrRYdGn5059PvcdhIA37 10 | J9r2lWIxHYsZG37vquL41vjrAgMBAAGgYDBeBgkqhkiG9w0BCQ4xUTBPMAkGA1Ud 11 | EwQCMAAwCwYDVR0PBAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcD 12 | AjAWBgNVHREEDzANggtleGFtcGxlLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAKwU8 13 | /oHGVCF2vXCzc6X8jcHxgGpasQ0l42aQ7tHfV61fGOwMzxZfAAJFsUFXFBIktDHs 14 | ZxXv6Tf2a4ktEe34hY7fZ6zK6XAaIkS+yoBwXXzCkrrZsCAB5Fcu5JKwhHPVr1nM 15 | g92h3lwr9HD9eESVBwqcWvjqmkBgwdvFxGkMyN9tUoxV2C7JwN8wRrvK51QgJdfu 16 | FweIycI0EycDKQoxrCcA5VM5WQIm1eWC7GGGmGJ2n9hbRfKH/91ttTCZXTH5TX0s 17 | Ju8/SKGCwwJsxpjzgqcvGhHjxomVMFXawN/r6c2xY8o68z/8TaD2uEudfN1DIczs 18 | 1LrFKN7/lxX/2dRzHg== 19 | -----END CERTIFICATE REQUEST----- 20 | -------------------------------------------------------------------------------- /x509-cert/tests/examples/rsa2048-priv.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/rsa2048-priv.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/rsa2048-prv.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/rsa2048-prv.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/rsa2048-pub.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/rsa2048-pub.der -------------------------------------------------------------------------------- /x509-cert/tests/examples/tscpbcasha256.crl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-cert/tests/examples/tscpbcasha256.crl -------------------------------------------------------------------------------- /x509-cert/tests/examples/windows_bmpstring.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDSDCCAjCgAwIBAgIQKPABcjfrcIpG1K6NEhSpIjANBgkqhkiG9w0BAQUFADBN 3 | MUswSQYDVQQDHkIAVwBEAEsAVABlAHMAdABDAGUAcgB0ACBt92yMACwAMQAzADMA 4 | OQAwADYANwAxADYAMwA5ADAAOAAzADMAMQA5ADMwHhcNMjUwNTAyMTUwMDM5WhcN 5 | MzUwNTAyMDAwMDAwWjBNMUswSQYDVQQDHkIAVwBEAEsAVABlAHMAdABDAGUAcgB0 6 | ACBt92yMACwAMQAzADMAOQAwADYANwAxADYAMwA5ADAAOAAzADMAMQA5ADMwggEi 7 | MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDlgz7PDdlf6UzTtcWMRpaGGCdg 8 | KYQOBOJWg6lnTQMxALfWD2bzVrbLM8N2HlMUi1AhDmr3EX6xgFi3gdXB9DgZKwEB 9 | C1yq9CtU3QEyb/BKdsSaBasZPwfNEak8shAacvi0ssDhd05CIPYpvAlyO1RP1+m9 10 | g3LaHaTYnlPM1PYGr3yJ8qMprGsMepgrLf1AlHQRhWyEml5C0s/1WaflYo/NJnBy 11 | thyxksCEM2+AeO8A6CtwkL1yL47i6WImqk68NbeDiYalGwFt1Nb1Yd8PVbE7FT36 12 | 4vdMJ7jdQxzsCDiIq+KORZGSF/nVVpDeWRy8W0YtcfQ0LRbpIdEpRJOpK2UZAgMB 13 | AAGjJDAiMAsGA1UdDwQEAwIEMDATBgNVHSUEDDAKBggrBgEFBQcDAzANBgkqhkiG 14 | 9w0BAQUFAAOCAQEAycUVQ5SKUGsdQL5hkvJchs5I43/zEfEHRaT75lYlMn2lAMsa 15 | qX4vDBanWs0no9+0/7j0hPRBamNZGFThE6MswXcYdJrxhfp0ZjHntK0IMWO8riVO 16 | Y6O/4xHF8rUPQkOBFIcRBF19Ads2Qdfgtjzc+288YRCLiZ4TmWjYlg9TVst7x/Fo 17 | Hl1xH2Nbvm8AYPX9iPoqEzbq9aPy2MWi9Pf+R0lfqAjsdvj85A4dZKD2ovjOYzPX 18 | PBSJQizmCHjovucot2iB5MumoSGloHbIFZl2fe/2jqDjPwX4wDoYO94kenlhxedo 19 | lX4Tf6VRXWA0hVpJiE7NQMaVtO6rO/5P0pE1Pg== 20 | -----END CERTIFICATE----- -------------------------------------------------------------------------------- /x509-ocsp/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## 0.2.1 (2024-01-07) 8 | ### Added 9 | - Builder ([#1259]) 10 | 11 | [#1259]: https://github.com/RustCrypto/formats/pull/1259 12 | 13 | ## 0.2.0 (2024-01-03) [YANKED] 14 | - Initial release 15 | 16 | ## 0.1.0 17 | - Skipped 18 | -------------------------------------------------------------------------------- /x509-ocsp/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /x509-ocsp/src/builder.rs: -------------------------------------------------------------------------------- 1 | //! OCSP builder module 2 | 3 | use alloc::fmt; 4 | 5 | mod request; 6 | mod response; 7 | 8 | pub use self::request::OcspRequestBuilder; 9 | pub use self::response::OcspResponseBuilder; 10 | 11 | /// Error type 12 | #[derive(Debug)] 13 | pub enum Error { 14 | /// ASN.1 DER-related errors 15 | Asn1(der::Error), 16 | 17 | /// Public key errors 18 | PublicKey(spki::Error), 19 | 20 | /// Signing errors 21 | Signature(signature::Error), 22 | } 23 | 24 | #[cfg(feature = "std")] 25 | impl std::error::Error for Error {} 26 | 27 | impl fmt::Display for Error { 28 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 29 | match self { 30 | Error::Asn1(err) => write!(f, "ASN.1 error: {err}"), 31 | Error::PublicKey(err) => write!(f, "public key error: {err}"), 32 | Error::Signature(err) => write!(f, "signature error: {err}"), 33 | } 34 | } 35 | } 36 | 37 | impl From for Error { 38 | fn from(other: der::Error) -> Self { 39 | Self::Asn1(other) 40 | } 41 | } 42 | 43 | impl From for Error { 44 | fn from(other: spki::Error) -> Self { 45 | Self::PublicKey(other) 46 | } 47 | } 48 | 49 | impl From for Error { 50 | fn from(other: signature::Error) -> Self { 51 | Self::Signature(other) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/DODEMAILCA_63-resp.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/DODEMAILCA_63-resp.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/ocsp-by-key-res.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/ocsp-by-key-res.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/ocsp-dtm-no-chain-res.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/ocsp-dtm-no-chain-res.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/ocsp-internal-error.der: -------------------------------------------------------------------------------- 1 | 0 2 |  -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/ocsp-malformed.der: -------------------------------------------------------------------------------- 1 | 0 2 |  -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/ocsp-multiple-exts-clean-req.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/ocsp-multiple-exts-clean-req.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/ocsp-multiple-exts-res.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/ocsp-multiple-exts-res.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/ocsp-multiple-requests-nonce-req.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/ocsp-multiple-requests-nonce-req.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/ocsp-multiple-requests-req.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/ocsp-multiple-requests-req.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/ocsp-multiple-responses-res.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/ocsp-multiple-responses-res.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/ocsp-sig-required.der: -------------------------------------------------------------------------------- 1 | 0 2 |  -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/ocsp-signed-req.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/ocsp-signed-req.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/ocsp-try-later.der: -------------------------------------------------------------------------------- 1 | 0 2 |  -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/ocsp-unauthorized.der: -------------------------------------------------------------------------------- 1 | 0 2 |  -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/rsa-2048-sha256-ca-crl.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/rsa-2048-sha256-ca-crl.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/rsa-2048-sha256-ca-key.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/rsa-2048-sha256-ca-key.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/rsa-2048-sha256-ca.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/rsa-2048-sha256-ca.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/rsa-2048-sha256-crt-key.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/rsa-2048-sha256-crt-key.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/rsa-2048-sha256-crt.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/rsa-2048-sha256-crt.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/rsa-2048-sha256-ocsp-crt-key.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/rsa-2048-sha256-ocsp-crt-key.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/rsa-2048-sha256-ocsp-crt.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/rsa-2048-sha256-ocsp-crt.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/rsa-2048-sha256-revoked-ocsp-res.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/rsa-2048-sha256-revoked-ocsp-res.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/sha1-certid-ocsp-req.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/sha1-certid-ocsp-req.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/sha1-certid-ocsp-res.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/sha1-certid-ocsp-res.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/sha224-certid-ocsp-req.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/sha224-certid-ocsp-req.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/sha256-certid-ocsp-req.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/sha256-certid-ocsp-req.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/sha256-certid-ocsp-res.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/sha256-certid-ocsp-res.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/sha384-certid-ocsp-req.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/sha384-certid-ocsp-req.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/sha512-certid-ocsp-req.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/sha512-certid-ocsp-req.der -------------------------------------------------------------------------------- /x509-ocsp/tests/examples/sha512-certid-ocsp-res.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustCrypto/formats/6892620e198deeb4dc2db9a88dea9d7b85ef1520/x509-ocsp/tests/examples/sha512-certid-ocsp-res.der -------------------------------------------------------------------------------- /x509-tsp/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## 0.1.0 (2023-05-25) 8 | - Initial release 9 | -------------------------------------------------------------------------------- /x509-tsp/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "x509-tsp" 3 | version = "0.2.0-pre" 4 | edition = "2024" 5 | description = """ 6 | Pure Rust implementation of the Timestamping Protocol as described in RFC 3161. 7 | """ 8 | authors = ["RustCrypto Developers"] 9 | license = "Apache-2.0 OR MIT" 10 | homepage = "https://github.com/RustCrypto/formats/tree/master/x509-tsp" 11 | repository = "https://github.com/RustCrypto/formats" 12 | categories = ["cryptography", "encoding", "no-std", "parser-implementations"] 13 | keywords = ["crypto", "tsp", "timestamp"] 14 | readme = "README.md" 15 | rust-version = "1.85" 16 | 17 | [dependencies] 18 | der = { version = "0.8.0-rc.3", features = ["alloc", "derive", "oid", "pem"] } 19 | cms = { version = "=0.3.0-pre.0" } 20 | cmpv2 = { version = "=0.3.0-pre.0", features = ["alloc"] } 21 | x509-cert = { version = "=0.3.0-pre.0", default-features = false } 22 | 23 | [dev-dependencies] 24 | hex-literal = "1" 25 | -------------------------------------------------------------------------------- /x509-tsp/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2023-2025 The RustCrypto Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | --------------------------------------------------------------------------------