├── picky
├── LICENSE-MIT
├── LICENSE-APACHE
├── fuzz
│ ├── .gitignore
│ ├── README.md
│ ├── fuzz_targets
│ │ ├── jose.rs
│ │ └── x509.rs
│ └── Cargo.toml
├── tests
│ └── artifacts_vector
│ │ ├── oom-4858a62f60be11cf4a60eef4cdad042ccb30927c
│ │ ├── oom-b4720b734896445daffae45d5e3363f8c61785da
│ │ ├── crash-155f132f5f648ee37fecc1de689fdc7443fb30a9
│ │ ├── crash-7fd87f0f47cd3de4a7d20a3ba6102f3eb6e82427
│ │ ├── crash-aa736175d07af8e970ad8ba87e299bf065d26f30
│ │ ├── slow-unit-4763febe11286919c41b2a8b07ae03e5923f0834
│ │ ├── slow-unit-8b8b4392d9590538c156a51eaf100b9d3f014d0f
│ │ └── slow-unit-eee10772d15bae083a6a56283cc6e5295427f61f
├── src
│ ├── jose
│ │ └── mod.rs
│ ├── putty
│ │ └── mod.rs
│ └── lib.rs
└── README.md
├── picky-asn1
├── LICENSE-MIT
├── LICENSE-APACHE
├── README.md
├── Cargo.toml
└── src
│ └── lib.rs
├── picky-krb
├── LICENSE-MIT
├── LICENSE-APACHE
├── src
│ ├── lib.rs
│ └── crypto
│ │ ├── aes
│ │ ├── hmac_sha196_aes_128.rs
│ │ └── hmac_sha196_aes_256.rs
│ │ ├── des
│ │ ├── hmac_sha1_des3_kd.rs
│ │ └── mod.rs
│ │ ├── utils.rs
│ │ └── common.rs
└── README.md
├── picky-asn1-der
├── LICENSE-MIT
├── LICENSE-APACHE
├── tests
│ ├── test_vectors
│ │ ├── serde_primitive_null.txt
│ │ ├── serde_primitive_octet_string.txt
│ │ ├── serde_primitive_boolean.txt
│ │ ├── serde_primitive_null_err.txt
│ │ ├── serde_primitive_octet_string_err.txt
│ │ ├── serde_primitive_utf8_string_err.txt
│ │ ├── serde_primitive_utf8_string.txt
│ │ ├── serde_primitive_boolean_err.txt
│ │ ├── serde_primitive_integer_err.txt
│ │ └── serde_primitive_integer.txt
│ └── pki_tests
│ │ ├── mod.rs
│ │ └── check_macro.rs
├── src
│ ├── ser
│ │ ├── null.rs
│ │ ├── utf8_string.rs
│ │ └── boolean.rs
│ └── de
│ │ ├── utf8_string.rs
│ │ ├── null.rs
│ │ └── boolean.rs
└── Cargo.toml
├── picky-asn1-x509
├── LICENSE-MIT
├── LICENSE-APACHE
├── src
│ ├── signature.rs
│ ├── lib.rs
│ └── pkcs12
│ │ └── safe_bag
│ │ └── key.rs
└── README.md
├── picky-test-data
├── LICENSE-MIT
├── LICENSE-APACHE
├── test_assets
│ ├── jose
│ │ ├── jwk_ed25519.json
│ │ ├── jwk_x25519.json
│ │ ├── jwk_ec_p256.json
│ │ ├── jwt_sig_ed25519_private.pem
│ │ ├── jwt_sig_ed25519_go_private.pem
│ │ ├── jwt_sig_ed25519_go.txt
│ │ ├── jwt_sig_ed25519.txt
│ │ ├── jwk_ec_p384.json
│ │ ├── jwk_ec_p521.json
│ │ ├── jwt_sig_es256.txt
│ │ ├── jwt_sig_es384.txt
│ │ ├── jwe_gcm256_ec_p256_ecdh.txt
│ │ ├── jwt_sig_es512.txt
│ │ ├── jwe_gcm128_ec_p384_ecdh_kw192.txt
│ │ ├── jwt_sig_example.txt
│ │ └── jwt_sig_with_exp.txt
│ ├── authroot.stl
│ ├── pkcs12
│ │ ├── asset_leaf.crt
│ │ ├── asset_root.crt
│ │ ├── certmgr_3des.pfx
│ │ ├── certmgr_aes256.pfx
│ │ ├── openssl_nocrypt.pfx
│ │ ├── asset_intermediate.crt
│ │ ├── leaf_empty_password.pfx
│ │ ├── leaf_password_is_abc.pfx
│ │ ├── leaf.csr
│ │ ├── ca.csr
│ │ ├── intermediate.csr
│ │ ├── leaf.key
│ │ ├── intermediate.key
│ │ ├── ca.key
│ │ ├── leaf.cer
│ │ ├── intermediate.cer
│ │ └── ca.cer
│ ├── ssh
│ │ ├── ssh_key_ed25519.pub
│ │ ├── ssh_encrypted_key_ed25519.pub
│ │ ├── ssh_key_sk_ed25519.pub
│ │ ├── ssh_key_p256.pub
│ │ ├── ssh_encrypted_key_p256.pub
│ │ ├── ssh_key_p384.pub
│ │ ├── ssh_key_sk_ecdsa.pub
│ │ ├── ssh_key_p521.pub
│ │ ├── ssh_key_ed25519
│ │ ├── ssh_cert_ed25519.crt
│ │ ├── ssh_encrypted_key_ed25519
│ │ ├── ssh_key_sk_ed25519
│ │ ├── ssh_key_p256
│ │ ├── ssh_key_rsa.pub
│ │ ├── ssh_key_sk_ed25519_enc
│ │ ├── ssh_encrypted_key_p256
│ │ ├── ssh_p256_key_sk_ed25519-cert.pub
│ │ ├── ssh_sk_ed25519_key_p256-cert.pub
│ │ ├── ssh_cert_p256.crt
│ │ ├── ssh_key_p384
│ │ ├── ssh_key_sk_ecdsa
│ │ ├── ssh_p256_key_sk_ecdsa-cert.pub
│ │ ├── ssh_cert_p384.crt
│ │ ├── ssh_sk_ecdsa_key_p256-cert.pub
│ │ ├── ssh_key_sk_ecdsa_enc
│ │ └── ssh_key_p521
│ ├── public_keys
│ │ ├── ed25519-pem-pk_1.key
│ │ ├── x25519-pem-pk_1.key
│ │ ├── ed448-pem-pk_1.key
│ │ ├── x448-pem-pk_1.key
│ │ ├── ec-nist256-pk_1.key
│ │ ├── ec-secp256k1-pk_1.key
│ │ ├── ec-nist384-pk_1.key
│ │ └── ec-nist521-pk_1.key
│ ├── private_keys
│ │ ├── ed25519-pem-pk_1.key
│ │ ├── ed25519-pem-pk_2.key
│ │ ├── ed25519-pem-pk_3.key
│ │ ├── x25519-pem-pk_1.key
│ │ ├── ec-nist256-nopublic-der-pk_1.key
│ │ ├── x448-pem-pk_1.key
│ │ ├── ed448-pem-pk_1.key
│ │ ├── ec-nist384-nopublic-der-pk_1.key
│ │ ├── ec-nist521-nopublic-der-pk_1.key
│ │ ├── ec-nist256-der-pk_1.key
│ │ ├── ec-nist256-pk_1.key
│ │ ├── ec-nist256-pk_2.key
│ │ ├── ec-nist384-der-pk_1.key
│ │ ├── ec-nist384-pk_1.key
│ │ ├── ec-nist521-der-pk_1.key
│ │ └── ec-nist521-pk_1.key
│ ├── missing_authority_key_identifier_field.crt
│ ├── putty
│ │ ├── ed25519
│ │ ├── ed25519_v2.ppk
│ │ ├── ed25519.ppk
│ │ ├── ed25519_v2_encrypted.ppk
│ │ ├── rsa_pub_empty_comment
│ │ ├── ed25519_encrypted.ppk
│ │ └── rsa_pub_escaped_conmment
│ ├── .gitattributes
│ ├── certification_request.csr
│ ├── intermediate_ca.crt
│ └── root_ca.crt
├── Cargo.toml
└── CHANGELOG.md
├── ffi
├── js
│ ├── main.js
│ ├── .gitignore
│ ├── example
│ │ └── index.html
│ ├── tsconfig.json
│ ├── index.js
│ ├── README.md
│ └── package.json
├── dotnet
│ ├── global.json
│ ├── .editorconfig
│ ├── Devolutions.Picky
│ │ ├── Generated
│ │ │ ├── SpcStringType.cs
│ │ │ ├── RawSpcStringType.cs
│ │ │ ├── GetCaResult.cs
│ │ │ ├── SpcLinkType.cs
│ │ │ ├── RawGetCaResult.cs
│ │ │ ├── RawSpcLinkType.cs
│ │ │ ├── Argon2Algorithm.cs
│ │ │ ├── CertType.cs
│ │ │ ├── RawArgon2Algorithm.cs
│ │ │ ├── RawCertType.cs
│ │ │ ├── UnsignedAttributeValueType.cs
│ │ │ ├── Pkcs12AttributeKind.cs
│ │ │ ├── RawUnsignedAttributeValueType.cs
│ │ │ ├── DirectoryStringType.cs
│ │ │ ├── RawPkcs12AttributeKind.cs
│ │ │ ├── SafeBagKind.cs
│ │ │ ├── CmsVersion.cs
│ │ │ ├── RawDirectoryStringType.cs
│ │ │ ├── RawSafeBagKind.cs
│ │ │ ├── RawCmsVersion.cs
│ │ │ ├── SshCertType.cs
│ │ │ ├── AesParametersType.cs
│ │ │ ├── RawSshCertType.cs
│ │ │ ├── PuttyPpkVersion.cs
│ │ │ ├── RawAesParametersType.cs
│ │ │ ├── RawPuttyPpkVersion.cs
│ │ │ ├── AlgorithmIdentifierParametersType.cs
│ │ │ ├── Pbes2Cipher.cs
│ │ │ ├── RawAlgorithmIdentifierParametersType.cs
│ │ │ ├── RawPbes2Cipher.cs
│ │ │ ├── Pbes1Cipher.cs
│ │ │ ├── PuttyArgon2Flavour.cs
│ │ │ ├── RawPbes1Cipher.cs
│ │ │ ├── RawPuttyArgon2Flavour.cs
│ │ │ ├── AttributeValueType.cs
│ │ │ ├── GeneralNameType.cs
│ │ │ ├── HashAlgorithm.cs
│ │ │ ├── RawAttributeValueType.cs
│ │ │ ├── RawHashAlgorithm.cs
│ │ │ ├── RawGeneralNameType.cs
│ │ │ ├── Pkcs12HashAlgorithm.cs
│ │ │ ├── RawPkcs12HashAlgorithm.cs
│ │ │ ├── Version.cs
│ │ │ ├── RawVersion.cs
│ │ │ ├── ExtensionViewType.cs
│ │ │ ├── PuttyPpkKeyAlgorithm.cs
│ │ │ ├── RawExtensionViewType.cs
│ │ │ ├── RawPuttyPpkKeyAlgorithm.cs
│ │ │ ├── NameAttr.cs
│ │ │ ├── RawNameAttr.cs
│ │ │ ├── EdAlgorithm.cs
│ │ │ ├── RawEdAlgorithm.cs
│ │ │ ├── ShaVariant.cs
│ │ │ ├── RawShaVariant.cs
│ │ │ ├── PickyException.cs
│ │ │ ├── SshCertKeyType.cs
│ │ │ ├── RawSshCertKeyType.cs
│ │ │ ├── EcCurve.cs
│ │ │ ├── BufferTooSmallException.cs
│ │ │ ├── RawEcCurve.cs
│ │ │ ├── AttributeTypeAndValueParametersType.cs
│ │ │ ├── RawAttributeTypeAndValueParametersType.cs
│ │ │ ├── RawEcParameters.cs
│ │ │ ├── KeyKind.cs
│ │ │ ├── RawAesAuthEncParams.cs
│ │ │ ├── RawKeyKind.cs
│ │ │ ├── RawRsassaPssParameters.cs
│ │ │ ├── RawDirectoryNameIterator.cs
│ │ │ ├── RawRsString.cs
│ │ │ ├── RawCertIterator.cs
│ │ │ ├── RawVecU8Iterator.cs
│ │ │ ├── PickyErrorKind.cs
│ │ │ ├── RawSafeBagIterator.cs
│ │ │ ├── RawUTCTimeIterator.cs
│ │ │ ├── RawOidIterator.cs
│ │ │ ├── RawPickyErrorKind.cs
│ │ │ ├── RawAttributeIterator.cs
│ │ │ ├── RawExtensionIterator.cs
│ │ │ ├── RawSignerInfoIterator.cs
│ │ │ ├── RawStringIterator.cs
│ │ │ ├── RawGeneralNameIterator.cs
│ │ │ ├── RawStringNestedIterator.cs
│ │ │ ├── RawMsCounterSignIterator.cs
│ │ │ ├── RawSpcSpOpusInfoIterator.cs
│ │ │ ├── RawRevocationInfoChoice.cs
│ │ │ ├── RawPkcs12AttributeIterator.cs
│ │ │ ├── RawBufferTooSmallError.cs
│ │ │ ├── RawUnsignedAttributeIterator.cs
│ │ │ ├── RawCertificateChoicesIterator.cs
│ │ │ ├── RawIssuerAndSerialNumber.cs
│ │ │ ├── RawRevokedCertificateIterator.cs
│ │ │ ├── RawAlgorithmIdentifierIterator.cs
│ │ │ ├── RawEncapsulatedContentInfo.cs
│ │ │ ├── RawRevocationInfoChoiceIterator.cs
│ │ │ ├── RawAttributeTypeAndValueIterator.cs
│ │ │ ├── RawU8.cs
│ │ │ ├── RawAttributeTypeAndValueNestedIterator.cs
│ │ │ ├── RawOtherName.cs
│ │ │ ├── RawAttribute.cs
│ │ │ ├── RawBasicConstraints.cs
│ │ │ ├── RawSpcSpOpusInfo.cs
│ │ │ ├── RawEdiPartyName.cs
│ │ │ ├── RawMsCounterSign.cs
│ │ │ ├── RawArgon2.cs
│ │ │ ├── RawJwtFfiResultVoidBoxPickyError.cs
│ │ │ ├── RawPemFfiResultVoidBoxPickyError.cs
│ │ │ ├── RawSshFfiResultVoidBoxPickyError.cs
│ │ │ ├── RawX509FfiResultVoidBoxPickyError.cs
│ │ │ └── RawArgon2FfiResultVoidBoxPickyError.cs
│ │ ├── Devolutions.Picky.props
│ │ ├── src
│ │ │ ├── Cert.Addons.cs
│ │ │ └── Pem.Addons.cs
│ │ └── Info.plist
│ └── Devolutions.Picky.Tests
│ │ ├── Argon2Tests.cs
│ │ └── Devolutions.Picky.Tests.csproj
├── wasm
│ ├── .gitignore
│ ├── main.ts
│ ├── publish.ps1
│ ├── run_tests.ps1
│ ├── ava_tests
│ │ ├── package.json
│ │ └── tests
│ │ │ └── putty.mjs
│ ├── src
│ │ ├── lib.rs
│ │ ├── macros.rs
│ │ └── pem.rs
│ ├── vite.config.ts
│ ├── README.md
│ ├── rewrite-location.js
│ └── Cargo.toml
├── dotnet-interop-conf.toml
├── src
│ ├── lib.rs
│ └── signature.rs
└── README.md
├── rust-toolchain.toml
├── rustfmt.toml
├── docs
├── http
│ ├── cert
│ │ ├── post_response.adoc
│ │ └── get_request.adoc
│ └── chain
│ │ └── request.adoc
└── file
│ └── csr
│ └── csr_pem.adoc
├── .dockerignore
├── .cargo
└── config.toml
├── .gitignore
├── .github
├── CODEOWNERS
└── dependabot.yml
├── .gitattributes
├── release-plz.toml
├── release.toml
├── README.md
├── setup-git-hooks.sh
└── LICENSE-MIT
/picky/LICENSE-MIT:
--------------------------------------------------------------------------------
1 | ../LICENSE-MIT
--------------------------------------------------------------------------------
/picky-asn1/LICENSE-MIT:
--------------------------------------------------------------------------------
1 | ../LICENSE-MIT
--------------------------------------------------------------------------------
/picky-krb/LICENSE-MIT:
--------------------------------------------------------------------------------
1 | ../LICENSE-MIT
--------------------------------------------------------------------------------
/picky/LICENSE-APACHE:
--------------------------------------------------------------------------------
1 | ../LICENSE-APACHE
--------------------------------------------------------------------------------
/picky-asn1-der/LICENSE-MIT:
--------------------------------------------------------------------------------
1 | ../LICENSE-MIT
--------------------------------------------------------------------------------
/picky-asn1-x509/LICENSE-MIT:
--------------------------------------------------------------------------------
1 | ../LICENSE-MIT
--------------------------------------------------------------------------------
/picky-asn1/LICENSE-APACHE:
--------------------------------------------------------------------------------
1 | ../LICENSE-APACHE
--------------------------------------------------------------------------------
/picky-krb/LICENSE-APACHE:
--------------------------------------------------------------------------------
1 | ../LICENSE-APACHE
--------------------------------------------------------------------------------
/picky-test-data/LICENSE-MIT:
--------------------------------------------------------------------------------
1 | ../LICENSE-MIT
--------------------------------------------------------------------------------
/ffi/js/main.js:
--------------------------------------------------------------------------------
1 | export * from './api/index.js';
--------------------------------------------------------------------------------
/picky-asn1-der/LICENSE-APACHE:
--------------------------------------------------------------------------------
1 | ../LICENSE-APACHE
--------------------------------------------------------------------------------
/picky-asn1-x509/LICENSE-APACHE:
--------------------------------------------------------------------------------
1 | ../LICENSE-APACHE
--------------------------------------------------------------------------------
/picky-test-data/LICENSE-APACHE:
--------------------------------------------------------------------------------
1 | ../LICENSE-APACHE
--------------------------------------------------------------------------------
/picky/fuzz/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | corpus
3 | artifacts
4 | Cargo.lock
--------------------------------------------------------------------------------
/ffi/js/.gitignore:
--------------------------------------------------------------------------------
1 | wasmpkg/
2 | node_modules/
3 | package-lock.json
4 |
--------------------------------------------------------------------------------
/rust-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "1.85.0"
3 | components = ["rustfmt", "clippy"]
4 |
--------------------------------------------------------------------------------
/rustfmt.toml:
--------------------------------------------------------------------------------
1 | reorder_imports = true
2 | imports_granularity = "Module"
3 | max_width = 120
4 |
--------------------------------------------------------------------------------
/picky-asn1-der/tests/test_vectors/serde_primitive_null.txt:
--------------------------------------------------------------------------------
1 | # Test null
2 | value: ()
3 | der__: 0500
--------------------------------------------------------------------------------
/docs/http/cert/post_response.adoc:
--------------------------------------------------------------------------------
1 | [source,http,options="nowrap"]
2 | ----
3 | HTTP/1.1 200 OK
4 | ----
5 |
--------------------------------------------------------------------------------
/ffi/dotnet/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "msbuild-sdks": {
3 | "MSBuild.Sdk.Extras": "3.0.44"
4 | }
5 | }
--------------------------------------------------------------------------------
/ffi/wasm/.gitignore:
--------------------------------------------------------------------------------
1 | bin/
2 | pkg/
3 | dist/
4 | node_modules/
5 | wasm-pack.log
6 | package-lock.json
7 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | .git
2 | .gitignore
3 | .gitmodules
4 | .DS_Store
5 | Dockerfile
6 | Jenkinsfile
7 | target/
8 |
9 |
--------------------------------------------------------------------------------
/ffi/js/example/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/jose/jwk_ed25519.json:
--------------------------------------------------------------------------------
1 | {"kty":"OKP","crv":"Ed25519","x":"8OfKc1viOe7tfnOLNN-g7vABp29KtvdM7SVBwSfgBzE"}
--------------------------------------------------------------------------------
/picky-test-data/test_assets/jose/jwk_x25519.json:
--------------------------------------------------------------------------------
1 | {"kty":"OKP","crv":"X25519","x":"9yayrZ0Vl_XSK5K4vJHzhVMD8PKiuQb-D-jDKDHnOzE"}
--------------------------------------------------------------------------------
/docs/http/chain/request.adoc:
--------------------------------------------------------------------------------
1 | [source,http,options="nowrap"]
2 | ----
3 | GET /chain HTTP/1.1
4 | Host: ca.contoso.local
5 | ----
6 |
7 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/authroot.stl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky-test-data/test_assets/authroot.stl
--------------------------------------------------------------------------------
/picky-asn1-der/tests/test_vectors/serde_primitive_octet_string.txt:
--------------------------------------------------------------------------------
1 | # Normal data
2 | value: 546573746F6C6F7065
3 | der__: 0409546573746F6C6F7065
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/asset_leaf.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky-test-data/test_assets/pkcs12/asset_leaf.crt
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/asset_root.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky-test-data/test_assets/pkcs12/asset_root.crt
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/certmgr_3des.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky-test-data/test_assets/pkcs12/certmgr_3des.pfx
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_key_ed25519.pub:
--------------------------------------------------------------------------------
1 | ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDKeXB8air8kVbyipmcfbnqvW5iSiDXmefB9o2vpNINr test_ecdsa@picky.com
2 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/certmgr_aes256.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky-test-data/test_assets/pkcs12/certmgr_aes256.pfx
--------------------------------------------------------------------------------
/.cargo/config.toml:
--------------------------------------------------------------------------------
1 | [target.wasm32-unknown-unknown]
2 | rustflags = [
3 | # 20 KiB heap size, to fit in 2 pages.
4 | "-C", "link-args=-z stack-size=20480",
5 | ]
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | target/
3 | database/
4 | dependencies/
5 | package/
6 | **/*.rs.bk
7 | c-api/examples/out
8 | picky_server_conf.yaml
9 | .DS_Store
10 |
--------------------------------------------------------------------------------
/picky-asn1-der/tests/test_vectors/serde_primitive_boolean.txt:
--------------------------------------------------------------------------------
1 | # Test `true`
2 | value: true
3 | der__: 0101FF
4 |
5 | # Test `false`
6 | value: false
7 | der__: 010100
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/openssl_nocrypt.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky-test-data/test_assets/pkcs12/openssl_nocrypt.pfx
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_encrypted_key_ed25519.pub:
--------------------------------------------------------------------------------
1 | ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKNqZ78AFkIyLDzA1R402GcsKrbdJ33EiSy6fj3fvX1y test_ecdsa@picky.com
2 |
--------------------------------------------------------------------------------
/ffi/js/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "es2020",
4 | "target": "es2020",
5 | "moduleResolution": "node"
6 | }
7 | }
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/asset_intermediate.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky-test-data/test_assets/pkcs12/asset_intermediate.crt
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/leaf_empty_password.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky-test-data/test_assets/pkcs12/leaf_empty_password.pfx
--------------------------------------------------------------------------------
/picky-test-data/test_assets/jose/jwk_ec_p256.json:
--------------------------------------------------------------------------------
1 | {"kty":"EC","crv":"P-256","x":"687h9e0T3UFp3qls1nQb_ssTJrxTK4iPC_VqO_tuhpI","y":"JKeFsfjfewc9QIGUf63nn8NtcVrX-DatVQIc6ExLsmI"}
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/leaf_password_is_abc.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky-test-data/test_assets/pkcs12/leaf_password_is_abc.pfx
--------------------------------------------------------------------------------
/picky-asn1-der/tests/test_vectors/serde_primitive_null_err.txt:
--------------------------------------------------------------------------------
1 | # Invalid tag
2 | der__: 0600
3 | error: InvalidData
4 |
5 | # Invalid value
6 | der__: 050100
7 | error: InvalidData
--------------------------------------------------------------------------------
/picky-test-data/test_assets/public_keys/ed25519-pem-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----
2 | MCowBQYDK2VwAyEAMgP+01kif/BzKdwcd73t24eeQm/yNHhIFXOwOs+5shg=
3 | -----END PUBLIC KEY-----
--------------------------------------------------------------------------------
/picky-test-data/test_assets/public_keys/x25519-pem-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----
2 | MCowBQYDK2VuAyEAmc6MIdarIH2vuzpFGJK5cdtQ5tKJX0TPNJX5OSvbnEw=
3 | -----END PUBLIC KEY-----
--------------------------------------------------------------------------------
/picky-asn1-der/tests/pki_tests/mod.rs:
--------------------------------------------------------------------------------
1 | #[macro_use]
2 | mod check_macro;
3 |
4 | pub mod ocsp_request;
5 | pub mod rsa_public_key;
6 | pub mod version;
7 | pub mod x509_v3_certificate;
8 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/jose/jwt_sig_ed25519_private.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MC4CAQAwBQYDK2VwBCIEIFdZWoDdFny5SMnP9Fyfr8bafi/B527EVZh8JJjDTIFO
3 | -----END PRIVATE KEY-----
--------------------------------------------------------------------------------
/picky-test-data/test_assets/private_keys/ed25519-pem-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MC4CAQAwBQYDK2VwBCIEIEhiMti2qAuE3ytUdmgRJcomua0OOl0JSIbydffzL7SX
3 | -----END PRIVATE KEY-----
--------------------------------------------------------------------------------
/picky-test-data/test_assets/private_keys/ed25519-pem-pk_2.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MC4CAQAwBQYDK2VwBCIEIDB4MYM6V0qWTpUWeZXOWhcnNMNENDJH/jH1bQLSQvcO
3 | -----END PRIVATE KEY-----
--------------------------------------------------------------------------------
/picky-test-data/test_assets/private_keys/ed25519-pem-pk_3.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MC4CAQAwBQYDK2VwBCIEIAjXB9YHvQc8V8oSyIoJasXK2w9Brqc13fJtOYM0OYRO
3 | -----END PRIVATE KEY-----
--------------------------------------------------------------------------------
/picky-test-data/test_assets/private_keys/x25519-pem-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MC4CAQAwBQYDK2VuBCIEIKCCo8aGfrOIvVO4KO62QOs3E1SrJuqtzpgoaB3wjrVA
3 | -----END PRIVATE KEY-----
--------------------------------------------------------------------------------
/picky-asn1-der/tests/test_vectors/serde_primitive_octet_string_err.txt:
--------------------------------------------------------------------------------
1 | # Invalid tag
2 | der__: 050107
3 | error: InvalidData
4 |
5 | # Truncated data
6 | der__: 040207
7 | error: TruncatedData
--------------------------------------------------------------------------------
/picky-test-data/test_assets/jose/jwt_sig_ed25519_go_private.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MC4CAQAwBQYDK2VwBCIEIEFMEZrmlYxczXKFxIlNvNGR5JQvDhTkLovJYxwQd3ua
3 | -----END PRIVATE KEY-----
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # File auto-generated and managed by Devops
2 | /.github/ @devolutions/devops @devolutions/architecture-maintainers
3 | /.github/dependabot.yml @devolutions/security-managers
4 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/missing_authority_key_identifier_field.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky-test-data/test_assets/missing_authority_key_identifier_field.crt
--------------------------------------------------------------------------------
/picky-test-data/test_assets/jose/jwt_sig_ed25519_go.txt:
--------------------------------------------------------------------------------
1 | eyJhbGciOiJFRDI1NTE5IiwidHlwIjoiSldUIn0.eyJmb28iOiJiYXIifQ.ESuVzZq1cECrt9Od_gLPVG-_6uRP_8Nq-ajx6CtmlDqRJZqdejro2ilkqaQgSL-siE_3JMTUW7UwAorLaTyFCw
--------------------------------------------------------------------------------
/picky/tests/artifacts_vector/oom-4858a62f60be11cf4a60eef4cdad042ccb30927c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky/tests/artifacts_vector/oom-4858a62f60be11cf4a60eef4cdad042ccb30927c
--------------------------------------------------------------------------------
/picky/tests/artifacts_vector/oom-b4720b734896445daffae45d5e3363f8c61785da:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky/tests/artifacts_vector/oom-b4720b734896445daffae45d5e3363f8c61785da
--------------------------------------------------------------------------------
/docs/http/cert/get_request.adoc:
--------------------------------------------------------------------------------
1 | [source,http,options="nowrap"]
2 | ----
3 | GET /cert/9c3e1ed7c2245dd96f93ae0e56b5d479a4b8802f11b80d69933685618e59e729 HTTP/1.1
4 | Host: ca.contoso.local
5 | ----
6 |
7 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/jose/jwt_sig_ed25519.txt:
--------------------------------------------------------------------------------
1 | eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImthdGFyYXMifQ.U3ChCsJwStNnEdE_wgkh5elQHIKPYfdi4BZoy8CWQNAaFymND_-6fwghDC4bQRrcotXjD6WZDaSrJ_W7uVoBBQ
--------------------------------------------------------------------------------
/picky/tests/artifacts_vector/crash-155f132f5f648ee37fecc1de689fdc7443fb30a9:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky/tests/artifacts_vector/crash-155f132f5f648ee37fecc1de689fdc7443fb30a9
--------------------------------------------------------------------------------
/picky/tests/artifacts_vector/crash-7fd87f0f47cd3de4a7d20a3ba6102f3eb6e82427:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky/tests/artifacts_vector/crash-7fd87f0f47cd3de4a7d20a3ba6102f3eb6e82427
--------------------------------------------------------------------------------
/picky/tests/artifacts_vector/crash-aa736175d07af8e970ad8ba87e299bf065d26f30:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky/tests/artifacts_vector/crash-aa736175d07af8e970ad8ba87e299bf065d26f30
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_key_sk_ed25519.pub:
--------------------------------------------------------------------------------
1 | sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIMFyBNUUF5P5CMHbIRVIAAvq1VCLhuKqMUd2tToZHuLDAAAABHNzaDo= test_ed25519@picky.com
2 |
--------------------------------------------------------------------------------
/picky-krb/src/lib.rs:
--------------------------------------------------------------------------------
1 | pub mod constants;
2 | pub mod credssp;
3 | pub mod crypto;
4 | pub mod data_types;
5 | pub mod gss_api;
6 | pub mod messages;
7 | pub mod negoex;
8 | pub mod pac;
9 | pub mod pkinit;
10 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/jose/jwk_ec_p384.json:
--------------------------------------------------------------------------------
1 | {"kty":"EC","crv":"P-384","x":"wdE_WmMWA4TFirmNSkNiUX2d4dAlgNjTz9uGrY71fv2AfWpKbJl0XkxU16mWI0NL","y":"Vy-LkUmC37vSKqIFYXPm_JZYke9TmES4SC_9jjpMDElXBN3DM-8XuNi_uUiVCDwf"}
--------------------------------------------------------------------------------
/picky-test-data/test_assets/private_keys/ec-nist256-nopublic-der-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN EC PRIVATE KEY-----
2 | MDECAQEEIPKb/5hwhjtdPlAOrgoBHZRVCJRGBO0Yk8cptto2ZsBGoAoGCCqGSM49
3 | AwEH
4 | -----END EC PRIVATE KEY-----
--------------------------------------------------------------------------------
/picky-test-data/test_assets/public_keys/ed448-pem-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----
2 | MEMwBQYDK2VxAzoA+7PzyXvXiN83v9gjk1xBP/OQFMCxkirFKP6iVfhiA+4/Eug5
3 | 3aCSO9UMQ/W4vAc9HF6ypJtyEceA
4 | -----END PUBLIC KEY-----
--------------------------------------------------------------------------------
/picky-test-data/test_assets/public_keys/x448-pem-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----
2 | MEIwBQYDK2VvAzkAss9SKQrcFIZqpAuoMljdV4HtwyRRel4rpvWX1wf1wzKgus+j
3 | Zq7qzm7C4U6uKAu7MNoOhNTeaS4=
4 | -----END PUBLIC KEY-----
--------------------------------------------------------------------------------
/picky/tests/artifacts_vector/slow-unit-4763febe11286919c41b2a8b07ae03e5923f0834:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky/tests/artifacts_vector/slow-unit-4763febe11286919c41b2a8b07ae03e5923f0834
--------------------------------------------------------------------------------
/picky/tests/artifacts_vector/slow-unit-8b8b4392d9590538c156a51eaf100b9d3f014d0f:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky/tests/artifacts_vector/slow-unit-8b8b4392d9590538c156a51eaf100b9d3f014d0f
--------------------------------------------------------------------------------
/picky/tests/artifacts_vector/slow-unit-eee10772d15bae083a6a56283cc6e5295427f61f:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devolutions/picky-rs/HEAD/picky/tests/artifacts_vector/slow-unit-eee10772d15bae083a6a56283cc6e5295427f61f
--------------------------------------------------------------------------------
/ffi/js/index.js:
--------------------------------------------------------------------------------
1 | // Set options as a parameter, environment variable, or rc file.
2 | // eslint-disable-next-line no-global-assign
3 | require = require("esm")(module/* , options */)
4 | module.exports = require("./main.js")
--------------------------------------------------------------------------------
/picky-asn1-der/tests/test_vectors/serde_primitive_utf8_string_err.txt:
--------------------------------------------------------------------------------
1 | # Invalid tag
2 | der__: 0D09546573746F6C6F7065
3 | error: InvalidData
4 |
5 | # Truncated data
6 | der__: 0C09546573746F6C6F70
7 | error: TruncatedData
--------------------------------------------------------------------------------
/picky-test-data/test_assets/private_keys/x448-pem-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MEYCAQAwBQYDK2VvBDoEOID0F463Yxf9Y7jNzq4oF2VXSChH2qpQf18pDYZS9Vdh
3 | 8MwcOq9EIRbYxPim4kFMVdiz8GnSgVP7
4 | -----END PRIVATE KEY-----
--------------------------------------------------------------------------------
/ffi/wasm/main.ts:
--------------------------------------------------------------------------------
1 | // Re-export all exports.
2 | export * from "./pkg/picky";
3 |
4 | // Re-export the default export as default as well.
5 | import { default as _wasm_init } from "./pkg/picky";
6 | export default _wasm_init;
7 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/private_keys/ed448-pem-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MEcCAQAwBQYDK2VxBDsEOQihXFFIxrKx/5M4y9umsdQS1DaKn6ifnhoRvkLHWEEJ
3 | 4x8HBDQdl6kYGiLevCkYySjELpktjIptGQ==
4 | -----END PRIVATE KEY-----
--------------------------------------------------------------------------------
/picky-test-data/test_assets/putty/ed25519:
--------------------------------------------------------------------------------
1 | ---- BEGIN SSH2 PUBLIC KEY ----
2 | Comment: "eddsa-key-20240414"
3 | AAAAC3NzaC1lZDI1NTE5AAAAILd1uFfzk6dLkf9HbdczyiLRnIz5d0fq0mRS5Nvp
4 | e9w7
5 | ---- END SSH2 PUBLIC KEY ----
6 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.rs text eol=lf
2 | *.toml text eol=lf
3 | *.cs text eol=lf
4 | *.js text eol=lf
5 | *.ps1 text eol=lf
6 | *.sln text eol=crlf
7 |
8 | ffi/dotnet/Devolutions.Picky/Generated/** linguist-generated merge=binary
9 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/private_keys/ec-nist384-nopublic-der-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN EC PRIVATE KEY-----
2 | MD4CAQEEMGFjY4J1B2mI1/iBK7yP8yRF7+DnbDw0s/rUyE4l1FCkhsFAO2pqtE4r
3 | PF5SuZ8GnqAHBgUrgQQAIg==
4 | -----END EC PRIVATE KEY-----
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_key_p256.pub:
--------------------------------------------------------------------------------
1 | ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPHvQqIXgctGhw11YiThhgMojjk6yxFfToNwVOXMdp1hB/wPJvb/H9rH7Ln5EcdSJFngDtC86wtvoQEyaddBSNg= test_ecdsa@picky.com
2 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/.gitattributes:
--------------------------------------------------------------------------------
1 | # Don't allow git to mess around with line endings. This line removes text attribute from all files
2 | # in the `test_assets` folder, making them to be treated as binary files.
3 | * -text
4 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_encrypted_key_p256.pub:
--------------------------------------------------------------------------------
1 | ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOTN9DalwD9o5qZ4bSGiAKsB5UMdk4Kat3K8wshl1y9gOFSHQP11i1Il1pklmNQPhN+ZzLYsIzUmOl575AybqvE= test_ecdsa@picky.com
2 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/public_keys/ec-nist256-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----
2 | MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEbTwV6fNOXhlxsBM5ENn9vI/zSvuF
3 | 6gGQUBNMfNOpdF5+CuynUEW4k/M5JYUvCMufOsliU+IHSu/VWMG8Mno2Ig==
4 | -----END PUBLIC KEY-----
5 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/public_keys/ec-secp256k1-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----
2 | MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEBk+u8DbvxEdUhDWXyNdLy7qN9mugdDFB
3 | 06Z+DYU9dEyyXyqSjaZlGmgutsj5OboskTmDUHhuI+gm5MN8R3YHkA==
4 | -----END PUBLIC KEY-----
5 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/private_keys/ec-nist521-nopublic-der-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN EC PRIVATE KEY-----
2 | MFACAQEEQgGGqmEga7Y+aVwRvrEAOGFIKmA9S6UHSzgvao6CiVGBoHHh82Ag0USY
3 | GxLIcmdyxYbxYUS5TMBjL9grPaU/RDHpnaAHBgUrgQQAIw==
4 | -----END EC PRIVATE KEY-----
--------------------------------------------------------------------------------
/picky-asn1-der/tests/test_vectors/serde_primitive_utf8_string.txt:
--------------------------------------------------------------------------------
1 | # Test normal string
2 | value: Testolope
3 | der__: 0C09546573746F6C6F7065
4 |
5 | # Test emoji string
6 | value: Some UTF-8 Emoji 🖖🏽
7 | der__: 0C19536F6D65205554462D3820456D6F6A6920F09F9696F09F8FBD
--------------------------------------------------------------------------------
/picky-test-data/test_assets/jose/jwk_ec_p521.json:
--------------------------------------------------------------------------------
1 | {"kty":"EC","crv":"P-521","x":"ALP4k6QQiVKMbtfw9joWZ4XA4pQ2VIDDjDSO2fEgpCxleHey8vJGc-pll5qBnikRoXD9JPvhWGm9R_QN24rIqBqg","y":"AZTQtIcK0D2c8Og1pVoU0Z-tFMbnzBMvcgKGMeQuATL2mxQXmh8cmKfRHs8FATZtk8oDkFHmn7RtezFFFAAFtgm1"}
--------------------------------------------------------------------------------
/picky-test-data/test_assets/jose/jwt_sig_es256.txt:
--------------------------------------------------------------------------------
1 | eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.-OPushaKBibt52HqLPExVDrbBeyqo5gmxXlAAZqkI-fbJK4DHwlJlRgTs6Rt_arB4M8QxoedlsmlZnVouTOxQQ
--------------------------------------------------------------------------------
/ffi/dotnet-interop-conf.toml:
--------------------------------------------------------------------------------
1 | namespace = "Devolutions.Picky"
2 | native_lib = "DevolutionsPicky"
3 |
4 | [exceptions]
5 | trim_suffix = "Error"
6 | error_message_method = "ToDisplay"
7 |
8 | [properties]
9 | setters_prefix = "set_"
10 | getters_prefix = "get_"
11 |
--------------------------------------------------------------------------------
/ffi/dotnet/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | # Indentation and spacing
4 | indent_size = 4
5 | tab_width = 4
6 |
7 | # New line preferences
8 | end_of_line = lf
9 | insert_final_newline = false
10 |
11 | [src/Picky/Generated/*.cs]
12 | generated_code = true
13 |
--------------------------------------------------------------------------------
/ffi/js/README.md:
--------------------------------------------------------------------------------
1 | # Not (yet) ready
2 |
3 | This is an early attempt at using [Diplomat](https://github.com/rust-diplomat/diplomat) to generate the JavaScript wrapper.
4 |
5 | The idea is to only maintain one common FFI API instead of two different ones in the future.
6 |
7 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_key_p384.pub:
--------------------------------------------------------------------------------
1 | ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBLkc/NcBZLJsCDBAAigxImjtK5TaR19xS6bN8d78us71AHAD1Tx9ezze1vBtPvCxABKFh1BaB1MlZFlSqIzfo22TMeglSdARtnwz6Y7b4gzMoIDVpz1jb0/mOpPvI2qWYw== test_ecdsa@picky.com
2 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_key_sk_ecdsa.pub:
--------------------------------------------------------------------------------
1 | sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBPcKnl5TL/b06dnkgGYSFcNAFjEiqM1m2+eiwMZndaXRcOqF/qZ8r32tkiQJb1IzTtsTQ9EOVpbl0XDdsVGS9GkAAAAEc3NoOg== test_ecdsa@picky.com
2 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/public_keys/ec-nist384-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----
2 | MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEnCEmlRvCx5Q8aTXZhk3xEtMRpu2kdQ9k
3 | hwBXJjGcgSOb9IeL+y6JZh1EMSY1fntm+A9S+QX0PYAVEzHHuSjFjvH9P24/AvFz
4 | nP8LtVXTMdrcPaY/6TnPLn3YdgilpHzG
5 | -----END PUBLIC KEY-----
6 |
--------------------------------------------------------------------------------
/release-plz.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | dependencies_update = true
3 | git_release_enable = false
4 | semver_check = true
5 | pr_branch_prefix = "release-plz/"
6 | pr_name = "chore(release): prepare for publishing"
7 | changelog_config = "cliff.toml"
8 | release_commits = "^(feat|docs|fix|build|perf)"
9 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/jose/jwt_sig_es384.txt:
--------------------------------------------------------------------------------
1 | eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.o2fROF0A2V2YQjg-wZYXeqSTCYsiMaJlZOHv7YbZXVaFHWgEAyC3mxj512CBi9eLstEd3oTe2qSZhFaYyF6tXcwEpK1rDY_kZ-r8h8JdC1_ClN4jXLPlDdMFpBgifv9_
--------------------------------------------------------------------------------
/picky-test-data/test_assets/private_keys/ec-nist256-der-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN EC PRIVATE KEY-----
2 | MHcCAQEEICHio5XUa+RbeFfGtGHfbPWehTFJJtCB4/izKHJ9Vm+goAoGCCqGSM49
3 | AwEHoUQDQgAEh7ZqcI6f0tgqq7nqdcxWM6P4GGCfkWc4q11uXFjtXOKHKCV3LzMY
4 | g8/V1PD/YOh0HodRJAjkjXub8AmYxiTcXw==
5 | -----END EC PRIVATE KEY-----
6 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/private_keys/ec-nist256-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgRLh0MrVnIOTYX+YD
3 | ZvQZNdxefX9qDBFuOisKNS3cHzuhRANCAARtPBXp805eGXGwEzkQ2f28j/NK+4Xq
4 | AZBQE0x806l0Xn4K7KdQRbiT8zklhS8Iy586yWJT4gdK79VYwbwyejYi
5 | -----END PRIVATE KEY-----
--------------------------------------------------------------------------------
/picky-test-data/test_assets/private_keys/ec-nist256-pk_2.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgE/2kMmpr1Efueh/A
3 | GCfZ2KFiFak6lszKWUGJgKEn/TyhRANCAARVyeDeM9bk2L3esPu1I8thBcYhdlrq
4 | LzxcqDbvd0v/NNd1hXvkrAYzuOEc5bPp3XNRj9HXND43OCLGCxgbJ/IY
5 | -----END PRIVATE KEY-----
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_key_p521.pub:
--------------------------------------------------------------------------------
1 | ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAG1LQGJETFX1C3BQoMtI5c63ngB2AIOueExmGojkOrQSxi1cZzORHZX57NVsyWfFI58hlzsMChMzI7e83L5t7cUpwCSZjjkYSnNwXpbilNhQu5mZrbraGi/LCxmQLgSffHsV2hNfhUEFl864nDog2P6uXp3bf/fptdQXhM40FmNvEO8qg== test_ecdsa@picky.com
2 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/jose/jwe_gcm256_ec_p256_ecdh.txt:
--------------------------------------------------------------------------------
1 | eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImVwayI6eyJjcnYiOiJQLTI1NiIsImt0eSI6IkVDIiwieCI6IkMtRkl4WTJpZEZLdVBDcEVLSWY1dXYzQmdYaF8yc3k0WWRnLS0yc05YeFEiLCJ5IjoidEM1dVdzVU1ia2o1U1B4QTFRUnpEczBaRjNmd3dCTE8waVBvczJ3YVdTQSJ9fQ..fm1szAlt0EwQQizb.-uFiiFquTmHbAWWe.ojOTdBQcy4namgGXQdqeaw
--------------------------------------------------------------------------------
/picky-test-data/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "picky-test-data"
3 | version = "0.1.1"
4 | edition = "2024"
5 | description = "Test data for the picky crates"
6 | rust-version = "1.85"
7 | authors = ["Marc-André Lureau "]
8 | license = "MIT OR Apache-2.0"
9 | repository = "https://github.com/Devolutions/picky-rs"
10 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/jose/jwt_sig_es512.txt:
--------------------------------------------------------------------------------
1 | eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.AVkpZPakU6IPunZtJqliftQiogDd1M1v4JuLBa-PvDxRsL63prnYqNeul--0PIpeVGGJ5IzTTuueXZlCYveLuxEmAI6sQJJVEYJz43BgNjotnpL19ostMM68rX0xDnap3sTFSsV-7BbGwhOWSr1V2xeZNOtsC4i0tbKnsgCdlmdr-zx6
--------------------------------------------------------------------------------
/picky-test-data/test_assets/public_keys/ec-nist521-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----
2 | MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQAm4vSJHTZM1soehYR1hObvu/MZPuC
3 | dpKTesFPy09uE/L4XyZrse7bPa1DCKHKrfwrYBH/gqK/pm+ylco2O/AiyeUBOCbK
4 | qSPKAaGCQZx7+WsWKfUMBcqr44dNN5EXF2jKamhOh53uGWLXtbJ693C3Bq0e0Zre
5 | 4yv6V9z4bEbFcwV3Vt4=
6 | -----END PUBLIC KEY-----
7 |
--------------------------------------------------------------------------------
/picky-asn1-der/src/ser/null.rs:
--------------------------------------------------------------------------------
1 | use crate::{Result, Serializer};
2 | use picky_asn1::tag::Tag;
3 |
4 | /// A serializer for the `Null` type
5 | pub struct Null;
6 | impl Null {
7 | /// Serializes a `Null` into `_writer`
8 | pub fn serialize(ser: &mut Serializer) -> Result {
9 | ser.h_write_header(Tag::NULL, 0)
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/private_keys/ec-nist384-der-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN EC PRIVATE KEY-----
2 | MIGkAgEBBDDT8VOfdzHbIRaWOO1F0vgotY2qM2FfYS3zpdKE7Vqbh26hFsUw+iaG
3 | GmGnT+29kg+gBwYFK4EEACKhZANiAAQFvVVUKRdN3/bqaEpDA1aHu8FEd3ujuyS0
4 | AadG6QAiZxH37BGumBcyTTeGHyArqb+GTpsHTUXASbP+P+p5JgkfF9wBMF1SVTvu
5 | ACZOYcqzGbsAXXdMYqewckhc42ye0u0=
6 | -----END EC PRIVATE KEY-----
7 |
--------------------------------------------------------------------------------
/ffi/src/lib.rs:
--------------------------------------------------------------------------------
1 | #![allow(clippy::should_implement_trait)] // FFI consumer can’t use Rust traits
2 |
3 | pub mod argon2;
4 | pub mod date;
5 | pub mod error;
6 | pub mod hash;
7 | pub mod jwt;
8 | pub mod key;
9 | pub mod pem;
10 | pub mod pkcs12;
11 | pub mod pkcs7;
12 | pub mod putty;
13 | pub mod signature;
14 | pub mod ssh;
15 | pub mod utils;
16 | pub mod x509;
17 |
--------------------------------------------------------------------------------
/picky-asn1-der/src/de/utf8_string.rs:
--------------------------------------------------------------------------------
1 | use crate::{Asn1DerError, Result};
2 | use std::str;
3 |
4 | /// A deserializer for UTF-8 strings
5 | pub struct Utf8String;
6 | impl Utf8String {
7 | /// The deserialized string for `data`
8 | pub fn deserialize(data: &[u8]) -> Result<&str> {
9 | str::from_utf8(data).map_err(|_| Asn1DerError::InvalidData)
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/private_keys/ec-nist384-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MIG2AgEAMBAGByqGSM49AgEGBSuBBAAiBIGeMIGbAgEBBDCalIJL9AKD0c1/WJ5L
3 | 8536WBhcZ2x+BhmlkaSZWjm3/FfxJSFvDi13Os6Lagjl9MOhZANiAAScISaVG8LH
4 | lDxpNdmGTfES0xGm7aR1D2SHAFcmMZyBI5v0h4v7LolmHUQxJjV+e2b4D1L5BfQ9
5 | gBUTMce5KMWO8f0/bj8C8XOc/wu1VdMx2tw9pj/pOc8ufdh2CKWkfMY=
6 | -----END PRIVATE KEY-----
7 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/putty/ed25519_v2.ppk:
--------------------------------------------------------------------------------
1 | PuTTY-User-Key-File-2: ssh-ed25519
2 | Encryption: none
3 | Comment: ed25519-key-20240418
4 | Public-Lines: 2
5 | AAAAC3NzaC1lZDI1NTE5AAAAILMyy5tkHvvUqRtQYHzOzkyR4PYwj1P284HBQXHv
6 | rKeh
7 | Private-Lines: 1
8 | AAAAIBwepG2OCCnYICCmTXNuDk6Hl/xdjPbNGY3CQlTLGBo4
9 | Private-MAC: 53075221be556e89770351391573dbb7dba661d2
10 |
--------------------------------------------------------------------------------
/picky/fuzz/README.md:
--------------------------------------------------------------------------------
1 | picky fuzzing
2 | =============
3 |
4 | - [install cargo-fuzz](https://rust-fuzz.github.io/book/cargo-fuzz/setup.html)
5 | - fuzz x509, pem and keys: `cargo fuzz run x509`
6 | - fuzz jose: `cargo fuzz run jose -- -only_ascii=1`
7 | - fuzz http signatures: `cargo fuzz run --release http -- -only_ascii=1` (release is recommended because of heavy crypto operations)
8 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/putty/ed25519.ppk:
--------------------------------------------------------------------------------
1 | PuTTY-User-Key-File-3: ssh-ed25519
2 | Encryption: none
3 | Comment: eddsa-key-20240414
4 | Public-Lines: 2
5 | AAAAC3NzaC1lZDI1NTE5AAAAILd1uFfzk6dLkf9HbdczyiLRnIz5d0fq0mRS5Nvp
6 | e9w7
7 | Private-Lines: 1
8 | AAAAICRy3RnrtQkRZx8kOEI9KHvTFEMmgOfBq2WdFCrRpIE6
9 | Private-MAC: acc8030afe46301f01e7eb8d3cda38ae54ddd219adfefe32548569b4ac107784
10 |
--------------------------------------------------------------------------------
/picky-asn1-der/src/de/null.rs:
--------------------------------------------------------------------------------
1 | use crate::{Asn1DerError, Result};
2 |
3 | /// A deserializer for the `Null` type
4 | pub struct Null;
5 | impl Null {
6 | /// Deserializes `Null` from `data`
7 | pub fn deserialize(data: &[u8]) -> Result<()> {
8 | if !data.is_empty() {
9 | return Err(Asn1DerError::InvalidData);
10 | }
11 | Ok(())
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/putty/ed25519_v2_encrypted.ppk:
--------------------------------------------------------------------------------
1 | PuTTY-User-Key-File-2: ssh-ed25519
2 | Encryption: aes256-cbc
3 | Comment: ed25519-key-20240418
4 | Public-Lines: 2
5 | AAAAC3NzaC1lZDI1NTE5AAAAILMyy5tkHvvUqRtQYHzOzkyR4PYwj1P284HBQXHv
6 | rKeh
7 | Private-Lines: 1
8 | V0RC0FIYqv5YwoJ6C5x30ti+m17qZnscQ1BnlpE5iSO8WZ0Ua6xST9sgei9mPFcd
9 | Private-MAC: 090c79ffeecbc27de3bf32889561a5a290f74287
10 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/SpcStringType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum SpcStringType
15 | {
16 | Unicode = 0,
17 | Ancii = 1,
18 | }
19 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawSpcStringType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum SpcStringType
15 | {
16 | Unicode = 0,
17 | Ancii = 1,
18 | }
19 |
--------------------------------------------------------------------------------
/picky-asn1-der/tests/test_vectors/serde_primitive_boolean_err.txt:
--------------------------------------------------------------------------------
1 | # Invalid tag
2 | der__: 020100
3 | error: InvalidData
4 |
5 | # Truncated data
6 | der__: 0101
7 | error: TruncatedData
8 |
9 | # Invalid value
10 | der__: 010101
11 | error: InvalidData
12 |
13 | # Invalid extended data (`true`)
14 | der__: 01020000
15 | error: InvalidData
16 |
17 | # Invalid extended data (`false`)
18 | der__: 0102FFFF
19 | error: InvalidData
--------------------------------------------------------------------------------
/picky-test-data/test_assets/jose/jwe_gcm128_ec_p384_ecdh_kw192.txt:
--------------------------------------------------------------------------------
1 | eyJhbGciOiJFQ0RILUVTK0ExOTJLVyIsImVuYyI6IkExMjhHQ00iLCJlcGsiOnsiY3J2IjoiUC0zODQiLCJrdHkiOiJFQyIsIngiOiJJS19tbkVhSVdXZFVoOTJQUDA2QWItSkFHc2V4TEhJNHlzTTBHSkdRZW1tMnBDTkVRdnRWbTAtbmVUUDkwX3o3IiwieSI6IjZYZDEwOGRwUWJJWjZweHNrdjhra3BoRGF6bkhEMnN2Y1FoYTc0UmN1bVNvT1hJZGRvaWFCQWVRQzVCZ0d2S0UifX0.EebWQPW8R00CReZ2o48bsYn9k-vjCXU5.v_iV8j4nsYnAnbVy.c1Dr2e7xhg4s_2rH.rh9GZLeM6cjiq5o07Sds7A
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/GetCaResult.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum GetCaResult
15 | {
16 | None = 0,
17 | True = 1,
18 | False = 2,
19 | }
20 |
--------------------------------------------------------------------------------
/picky/fuzz/fuzz_targets/jose.rs:
--------------------------------------------------------------------------------
1 | #![no_main]
2 |
3 | use libfuzzer_sys::fuzz_target;
4 |
5 | use picky::jose::jwe::Jwe;
6 | use picky::jose::jwk::Jwk;
7 | use picky::jose::jws::RawJws;
8 |
9 | fuzz_target!(|data: &[u8]| {
10 | if let Ok(s) = std::str::from_utf8(data) {
11 | let _ = RawJws::decode(s);
12 | let _ = Jwe::decode_direct(s, s.as_bytes());
13 | let _ = Jwk::from_json(s);
14 | }
15 | });
16 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/SpcLinkType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum SpcLinkType
15 | {
16 | Url = 0,
17 | Moniker = 1,
18 | File = 2,
19 | }
20 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawGetCaResult.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum GetCaResult
15 | {
16 | None = 0,
17 | True = 1,
18 | False = 2,
19 | }
20 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawSpcLinkType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum SpcLinkType
15 | {
16 | Url = 0,
17 | Moniker = 1,
18 | File = 2,
19 | }
20 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/private_keys/ec-nist521-der-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN EC PRIVATE KEY-----
2 | MIHcAgEBBEIBhqphIGu2PmlcEb6xADhhSCpgPUulB0s4L2qOgolRgaBx4fNgINFE
3 | mBsSyHJncsWG8WFEuUzAYy/YKz2lP0Qx6Z2gBwYFK4EEACOhgYkDgYYABABwBevJ
4 | w/+Xh6I98ruzoTX3MNTsbgnc+glenJRCbEJkjbJrObFhbfgqP52r1lAy2RxuShGi
5 | NYJJzNPT6vR1abS32QFtvTH7YbYa6OWk9dtGNY/cYxgx1nQyhUuofdW7qbbfu/Ww
6 | TP2oFsPXRAavZCh4AbWUn8bAHmzNRyuJonQBKlQlVQ==
7 | -----END EC PRIVATE KEY-----
8 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/Argon2Algorithm.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum Argon2Algorithm
15 | {
16 | Argon2d = 0,
17 | Argon2i = 1,
18 | Argon2id = 2,
19 | }
20 |
--------------------------------------------------------------------------------
/picky-asn1-der/tests/test_vectors/serde_primitive_integer_err.txt:
--------------------------------------------------------------------------------
1 | # Invalid tag
2 | der__: 030100
3 | error: InvalidData
4 |
5 | # Truncated data
6 | der__: 0201
7 | error: TruncatedData
8 |
9 | # Invalid value
10 | der__: 0202007F
11 | error: InvalidData
12 |
13 | # Unsupported
14 | der__: 0201FF
15 | error: UnsupportedValue
16 |
17 | # Invalid extended data (`false`)
18 | der__: 021200FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
19 | error: UnsupportedValue
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/CertType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum CertType
15 | {
16 | Root = 0,
17 | Intermediate = 1,
18 | Leaf = 2,
19 | Unknown = 3,
20 | }
21 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawArgon2Algorithm.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum Argon2Algorithm
15 | {
16 | Argon2d = 0,
17 | Argon2i = 1,
18 | Argon2id = 2,
19 | }
20 |
--------------------------------------------------------------------------------
/ffi/wasm/publish.ps1:
--------------------------------------------------------------------------------
1 | #!/bin/env pwsh
2 |
3 | $ErrorActionPreference = "Stop"
4 |
5 | npm install
6 |
7 | if ($LastExitCode -ne 0)
8 | {
9 | throw "npm install failed"
10 | }
11 |
12 | npm run build
13 |
14 | if ($LastExitCode -ne 0)
15 | {
16 | throw "npm run build failed"
17 | }
18 |
19 | npm publish --access public
20 |
21 | if ($LastExitCode -ne 0)
22 | {
23 | throw "wasm-pack publish failed"
24 | }
25 |
26 | Write-Host "Success!"
27 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawCertType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum CertType
15 | {
16 | Root = 0,
17 | Intermediate = 1,
18 | Leaf = 2,
19 | Unknown = 3,
20 | }
21 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/UnsignedAttributeValueType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum UnsignedAttributeValueType
15 | {
16 | MsCounterSign = 0,
17 | CounterSign = 1,
18 | }
19 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/Pkcs12AttributeKind.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum Pkcs12AttributeKind
15 | {
16 | FriendlyName = 0,
17 | LocalKeyId = 1,
18 | Custom = 2,
19 | }
20 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawUnsignedAttributeValueType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum UnsignedAttributeValueType
15 | {
16 | MsCounterSign = 0,
17 | CounterSign = 1,
18 | }
19 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/DirectoryStringType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum DirectoryStringType
15 | {
16 | PrintableString = 0,
17 | Utf8String = 1,
18 | BmpString = 2,
19 | }
20 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawPkcs12AttributeKind.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum Pkcs12AttributeKind
15 | {
16 | FriendlyName = 0,
17 | LocalKeyId = 1,
18 | Custom = 2,
19 | }
20 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/SafeBagKind.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum SafeBagKind
15 | {
16 | PrivateKey = 0,
17 | Certificate = 1,
18 | Secret = 2,
19 | Unknown = 3,
20 | }
21 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/private_keys/ec-nist521-pk_1.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MIHuAgEAMBAGByqGSM49AgEGBSuBBAAjBIHWMIHTAgEBBEIAC+Ii5OdcST+DHxTj
3 | lQA0SdRne/HDdxzJpcU4yySrpWQNJeCn1ZU/m6FNasH6c7apIPAvcsptPUUSH1wF
4 | CLJjPn2hgYkDgYYABACbi9IkdNkzWyh6FhHWE5u+78xk+4J2kpN6wU/LT24T8vhf
5 | Jmux7ts9rUMIocqt/CtgEf+Cor+mb7KVyjY78CLJ5QE4JsqpI8oBoYJBnHv5axYp
6 | 9QwFyqvjh003kRcXaMpqaE6Hne4ZYte1snr3cLcGrR7Rmt7jK/pX3PhsRsVzBXdW
7 | 3g==
8 | -----END PRIVATE KEY-----
9 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/CmsVersion.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum CmsVersion
15 | {
16 | V0 = 0,
17 | V1 = 1,
18 | V2 = 2,
19 | V3 = 3,
20 | V4 = 4,
21 | V5 = 5,
22 | }
23 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawDirectoryStringType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum DirectoryStringType
15 | {
16 | PrintableString = 0,
17 | Utf8String = 1,
18 | BmpString = 2,
19 | }
20 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawSafeBagKind.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum SafeBagKind
15 | {
16 | PrivateKey = 0,
17 | Certificate = 1,
18 | Secret = 2,
19 | Unknown = 3,
20 | }
21 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_key_ed25519:
--------------------------------------------------------------------------------
1 | -----BEGIN OPENSSH PRIVATE KEY-----
2 | b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtz
3 | c2gtZWQyNTUxOQAAACAynlwfGoq/JFW8oqZnH256r1uYkog15nnwfaNr6TSDawAA
4 | AJiEhI3bhISN2wAAAAtzc2gtZWQyNTUxOQAAACAynlwfGoq/JFW8oqZnH256r1uY
5 | kog15nnwfaNr6TSDawAAAEDPPxk0WzusULS2vOfmviqP+BPgkjusx8q8IlM5+frg
6 | FzKeXB8air8kVbyipmcfbnqvW5iSiDXmefB9o2vpNINrAAAAFHRlc3RfZWNkc2FA
7 | cGlja3kuY29tAQ==
8 | -----END OPENSSH PRIVATE KEY-----
9 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Devolutions.Picky.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Framework
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawCmsVersion.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum CmsVersion
15 | {
16 | V0 = 0,
17 | V1 = 1,
18 | V2 = 2,
19 | V3 = 3,
20 | V4 = 4,
21 | V5 = 5,
22 | }
23 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/SshCertType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// SSH certificate type.
16 | ///
17 | public enum SshCertType
18 | {
19 | Client = 0,
20 | Host = 1,
21 | }
22 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/AesParametersType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum AesParametersType
15 | {
16 | Null = 0,
17 | InitializationVector = 1,
18 | AuthenticatedEncryptionParameters = 2,
19 | }
20 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawSshCertType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// SSH certificate type.
16 | ///
17 | public enum SshCertType
18 | {
19 | Client = 0,
20 | Host = 1,
21 | }
22 |
--------------------------------------------------------------------------------
/picky/src/jose/mod.rs:
--------------------------------------------------------------------------------
1 | //! JOSE framework subset implementation.
2 | //!
3 | //! A Json Web Token (JWT) comes in two flavors, roughly:
4 | //! - Json Web Encryption (JWE), used to transfer data securely
5 | //! - Json Web Signature (JWS), used to assert one's identity
6 | //!
7 | //! Common part is known as the "JOSE header".
8 | //!
9 | //! JSON Web Key (JWK) are used to represent cryptographic keys using JSON.
10 |
11 | pub mod jwe;
12 | pub mod jwk;
13 | pub mod jws;
14 | pub mod jwt;
15 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/PuttyPpkVersion.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// PuTTY Private Key (PPK) version.
16 | ///
17 | public enum PuttyPpkVersion
18 | {
19 | V2 = 0,
20 | V3 = 1,
21 | }
22 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawAesParametersType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum AesParametersType
15 | {
16 | Null = 0,
17 | InitializationVector = 1,
18 | AuthenticatedEncryptionParameters = 2,
19 | }
20 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/src/Cert.Addons.cs:
--------------------------------------------------------------------------------
1 | using System.Security.Cryptography.X509Certificates;
2 |
3 | namespace Devolutions.Picky;
4 |
5 | public partial class Cert
6 | {
7 | public X509Certificate2 ToX509Certificate2()
8 | {
9 | byte[] rawData = ToPem().ToData();
10 | return new X509Certificate2(rawData);
11 | }
12 |
13 | public static Cert FromX509Certificate2(X509Certificate2 cert)
14 | {
15 | return FromDer(cert.RawData);
16 | }
17 | }
--------------------------------------------------------------------------------
/picky-asn1-x509/src/signature.rs:
--------------------------------------------------------------------------------
1 | use picky_asn1::wrapper::IntegerAsn1;
2 | use serde::{Deserialize, Serialize};
3 |
4 | /// Defined in [RFC 3279](https://tools.ietf.org/html/rfc3279#section-2.2.3)
5 | ///
6 | /// ```not_rust
7 | /// Ecdsa-Sig-Value ::= SEQUENCE {
8 | /// r INTEGER,
9 | /// s INTEGER
10 | /// }
11 | /// ```
12 | #[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
13 | pub struct EcdsaSignatureValue {
14 | pub r: IntegerAsn1,
15 | pub s: IntegerAsn1,
16 | }
17 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawPuttyPpkVersion.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// PuTTY Private Key (PPK) version.
16 | ///
17 | public enum PuttyPpkVersion
18 | {
19 | V2 = 0,
20 | V3 = 1,
21 | }
22 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/jose/jwt_sig_example.txt:
--------------------------------------------------------------------------------
1 | eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.ekfvYsHi-JLCVSDY3QzveVYCnZzeotJ0WS_GO3dxQODWiX5hR2WRkePOm2WKl-5ChXjE4_T4kcukgcKHQtXZ5m68kM6RyRrkRqrk3L6EftR2DAslATNXDLM3JPEzvcLgFI1U1BFeELw9GGo8HHx9j7nAMJmBCIvSHPDWsQxq9Xkoa2jOTwmtn5JX9WMFwbtKSN-POdNaa8gBIn9NJhtjSDPtCqATFai7N6EcBcOhd7p8RWFbgiA_92FAgZW1P6XMxVRT1BHlw3YL9HS80QBrOyyD-daWq5FQZWY-kljVhCALLLvSr43pq4XwO1h66iegyWIVLSFyVfOAWllw7BoYPQ
--------------------------------------------------------------------------------
/picky-test-data/test_assets/jose/jwt_sig_with_exp.txt:
--------------------------------------------------------------------------------
1 | eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NDUyNjQwMDAsIm5iZiI6MTU0NTI2MzAwMCwibXNnIjoiVEhJUyBJUyBUSU1FIFNFTlNJVElWRSBEQVRBIn0.X0ZDfwWChqTgZAmdM4n7qLB1CuY2HabhQ-XteOnfZ0riMdVUhN1M7LGfuZN5kOrFSulRG6A5VZTKiP8QaZSWIOdUXd11cDVpVjH_JNbMVyts4DnuIv2XYeyCAsbUklZsKb0sgRZTG07MQXm_TVbdUUsgvhS5Mwqh_qPkS4NkugyXMNPNodxJUxT_DGPLBDGugyFoaEiHfkjJ7wulq7ldYYiXAPvRv52vgMHUK8K1VhrWgguw8OGqY1r1tc762yNrU1qK1L7_6b5BUEJNW_xIZlT9y9d2pxF5cWbF8bYle_WR_282GyAzrXBIcmaPsO3cVnsJzuS8FAwN-kGaTyrfPg
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/AlgorithmIdentifierParametersType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum AlgorithmIdentifierParametersType
15 | {
16 | None = 0,
17 | Null = 1,
18 | Aes = 2,
19 | Ec = 3,
20 | RsassaPss = 4,
21 | }
22 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/Pbes2Cipher.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// PBES2 cipher algorithm
16 | ///
17 | public enum Pbes2Cipher
18 | {
19 | Aes128Cbc = 0,
20 | Aes192Cbc = 1,
21 | Aes256Cbc = 2,
22 | }
23 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawAlgorithmIdentifierParametersType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum AlgorithmIdentifierParametersType
15 | {
16 | None = 0,
17 | Null = 1,
18 | Aes = 2,
19 | Ec = 3,
20 | RsassaPss = 4,
21 | }
22 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawPbes2Cipher.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// PBES2 cipher algorithm
16 | ///
17 | public enum Pbes2Cipher
18 | {
19 | Aes128Cbc = 0,
20 | Aes192Cbc = 1,
21 | Aes256Cbc = 2,
22 | }
23 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky.Tests/Argon2Tests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Xunit;
4 |
5 | namespace Devolutions.Picky.Tests;
6 |
7 | public class Argon2Tests
8 | {
9 | [Fact]
10 | public void HashPasswordSmoke()
11 | {
12 | Argon2Params parameters = Argon2Params.New();
13 | Argon2 argon2 = Argon2.New(Argon2Algorithm.Argon2id, parameters);
14 | string password_hash = argon2.HashPassword("hunter42");
15 | Assert.Equal("$argon2id$", password_hash.Substring(0, 10));
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_cert_ed25519.crt:
--------------------------------------------------------------------------------
1 | ssh-ed25519-cert-v01@openssh.com AAAAIHNzaC1lZDI1NTE5LWNlcnQtdjAxQG9wZW5zc2guY29tAAAAIGVskwMRgfqUanecoG1BzJC9frP1aTQcwJcIhwj3cwWUAAAAIDKeXB8air8kVbyipmcfbnqvW5iSiDXmefB9o2vpNINrAAAAAAAAAAEAAAACAAAABGFiY2QAAAAWAAAAEnNlcnZlci5leGFtcGxlLmNvbQAAAABkd7cwAAAAAIiEO4UAAAAAAAAAAAAAAAAAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIL7kYXC+ngCRZK6En01ngnk9ycdIA1+mMmQjNWK40nDkAAAAUwAAAAtzc2gtZWQyNTUxOQAAAEA7viJVZcyNLVNfKz5OTOpazksT/uIpk2WJH/fsvN26qsCrLDRBJ7UsXd2LGt92MJapIe64/vl/cZtt1yzp3H4H test_ecdsa@picky.com
2 |
--------------------------------------------------------------------------------
/picky-asn1-der/src/ser/utf8_string.rs:
--------------------------------------------------------------------------------
1 | use crate::misc::WriteExt;
2 | use crate::{Result, Serializer};
3 | use picky_asn1::tag::Tag;
4 |
5 | /// A serializer for UTF-8 strings
6 | pub struct Utf8String;
7 | impl Utf8String {
8 | /// Serializes `value` into `writer`
9 | pub fn serialize(value: &str, ser: &mut Serializer) -> Result {
10 | let mut written = ser.h_write_header(Tag::UTF8_STRING, value.len())?;
11 | written += ser.writer.write_exact(value.as_bytes())?;
12 | Ok(written)
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/Pbes1Cipher.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// Pkcs12Pbe is deprecated and should not be used in general.
16 | ///
17 | public enum Pbes1Cipher
18 | {
19 | ShaAnd40BitRc2Cbc = 0,
20 | ShaAnd3Key3DesCbc = 1,
21 | }
22 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/PuttyArgon2Flavour.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// Argon2 key derivation function flavour.
16 | ///
17 | public enum PuttyArgon2Flavour
18 | {
19 | Argon2d = 0,
20 | Argon2i = 1,
21 | Argon2id = 2,
22 | }
23 |
--------------------------------------------------------------------------------
/ffi/wasm/run_tests.ps1:
--------------------------------------------------------------------------------
1 | #!/bin/env pwsh
2 |
3 | $ErrorActionPreference = "Stop"
4 |
5 | wasm-pack build --target nodejs --scope 'devolutions' --out-name picky
6 |
7 | if ($LastExitCode -ne 0)
8 | {
9 | throw "wasm-pack build failed"
10 | }
11 |
12 | try
13 | {
14 | Push-Location ava_tests
15 |
16 | npm install
17 | npm test
18 |
19 | if ($LastExitCode -ne 0)
20 | {
21 | throw "ava tests failed"
22 | }
23 |
24 | Write-Host "Success!"
25 | }
26 | finally
27 | {
28 | Pop-Location
29 | }
30 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/putty/rsa_pub_empty_comment:
--------------------------------------------------------------------------------
1 | ---- BEGIN SSH2 PUBLIC KEY ----
2 | Comment: ""
3 | AAAAB3NzaC1yc2EAAAADAQABAAABAQCyGmSWzMBocxEQZDgz/ebBcnAwhLzS+ugr
4 | TtqNWX3hWFBaLd1QNGZGy8K68HJ0hGgAke/YIQQ93uCUzLSwpO4HKGa4rbmXwQ8A
5 | 9geYd1deAQFEPEVXlNFmkJC23XI+t5+RgmNYPIJZzwaA6gPZ6VvcT7HtaULEzbHK
6 | F2+lr4OWLFnzm89dfR0q8vz2BZ6N73Abz7MhOSAGUPTS2UdDIc1XdEMtyUVvWpUr
7 | RUZn9CNzjVsUZlu5uelSRrnD5uVcXv6tfaYcFg5tP9lc3h1CphPzQ4QVekNuGVlq
8 | Eu/NXGYFOjurjjTaTwkM9MIj8ZnkxjAnZmIImg5U1Fw7QCSfot6f
9 | ---- END SSH2 PUBLIC KEY ----
10 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawPbes1Cipher.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// Pkcs12Pbe is deprecated and should not be used in general.
16 | ///
17 | public enum Pbes1Cipher
18 | {
19 | ShaAnd40BitRc2Cbc = 0,
20 | ShaAnd3Key3DesCbc = 1,
21 | }
22 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawPuttyArgon2Flavour.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// Argon2 key derivation function flavour.
16 | ///
17 | public enum PuttyArgon2Flavour
18 | {
19 | Argon2d = 0,
20 | Argon2i = 1,
21 | Argon2id = 2,
22 | }
23 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_encrypted_key_ed25519:
--------------------------------------------------------------------------------
1 | -----BEGIN OPENSSH PRIVATE KEY-----
2 | b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABD+
3 | G1kUc8yJosFULTWkVxnZAAAAEAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIKNq
4 | Z78AFkIyLDzA1R402GcsKrbdJ33EiSy6fj3fvX1yAAAAoKY1s6CDjYvaMinCEzIP
5 | cZ6nMvh57DxQS5VPDBzldrVImeI8lmMDur7+ZXzJirEDcMBAOHfFlLH2Em/LWN7N
6 | uzTd/RhiySq6oKgyDiszitLWCa7wks8aFg5xUmDyaoHhjE8Y82DRfwybV3EzI4X+
7 | cpJAFeW8RxJx9qTbnR+Z/HfDeootoieTFrfnFIJ9h6aQRxdPqp496qVAzKJynlMU
8 | Q/E=
9 | -----END OPENSSH PRIVATE KEY-----
10 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/AttributeValueType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum AttributeValueType
15 | {
16 | Extensions = 0,
17 | ContentType = 1,
18 | SpcStatementType = 2,
19 | MessageDigest = 3,
20 | SigningTime = 4,
21 | SpcSpOpusInfo = 5,
22 | Custom = 6,
23 | }
24 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/GeneralNameType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum GeneralNameType
15 | {
16 | OtherName = 0,
17 | Rfc822Name = 1,
18 | DnsName = 2,
19 | DirectoryName = 3,
20 | EdiPartyName = 4,
21 | Uri = 5,
22 | IpAddress = 6,
23 | RegisteredId = 7,
24 | }
25 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/HashAlgorithm.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum HashAlgorithm
15 | {
16 | MD5 = 0,
17 | SHA1 = 1,
18 | SHA2_224 = 2,
19 | SHA2_256 = 3,
20 | SHA2_384 = 4,
21 | SHA2_512 = 5,
22 | SHA3_384 = 6,
23 | SHA3_512 = 7,
24 | Unknown = 8,
25 | }
26 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/putty/ed25519_encrypted.ppk:
--------------------------------------------------------------------------------
1 | PuTTY-User-Key-File-3: ssh-ed25519
2 | Encryption: aes256-cbc
3 | Comment: eddsa-key-20240414
4 | Public-Lines: 2
5 | AAAAC3NzaC1lZDI1NTE5AAAAILd1uFfzk6dLkf9HbdczyiLRnIz5d0fq0mRS5Nvp
6 | e9w7
7 | Key-Derivation: Argon2id
8 | Argon2-Memory: 8192
9 | Argon2-Passes: 34
10 | Argon2-Parallelism: 1
11 | Argon2-Salt: 1bd64491165a5ffff844c1e73b9b736c
12 | Private-Lines: 1
13 | 2p+AZMIN7Zne1yD4FBB1dRDEiZq2Vz9Yys2AN2Fr3qo00SGWecBuUfHKugg7fL8e
14 | Private-MAC: e0afdd77086fee3d602fbae6f9dd7d2dbfb2f4c3f93d110341e30e8d352e15ef
15 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/putty/rsa_pub_escaped_conmment:
--------------------------------------------------------------------------------
1 | ---- BEGIN SSH2 PUBLIC KEY ----
2 | Comment: "test \"with\" escapes\\!"
3 | AAAAB3NzaC1yc2EAAAADAQABAAABAQCyGmSWzMBocxEQZDgz/ebBcnAwhLzS+ugr
4 | TtqNWX3hWFBaLd1QNGZGy8K68HJ0hGgAke/YIQQ93uCUzLSwpO4HKGa4rbmXwQ8A
5 | 9geYd1deAQFEPEVXlNFmkJC23XI+t5+RgmNYPIJZzwaA6gPZ6VvcT7HtaULEzbHK
6 | F2+lr4OWLFnzm89dfR0q8vz2BZ6N73Abz7MhOSAGUPTS2UdDIc1XdEMtyUVvWpUr
7 | RUZn9CNzjVsUZlu5uelSRrnD5uVcXv6tfaYcFg5tP9lc3h1CphPzQ4QVekNuGVlq
8 | Eu/NXGYFOjurjjTaTwkM9MIj8ZnkxjAnZmIImg5U1Fw7QCSfot6f
9 | ---- END SSH2 PUBLIC KEY ----
10 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_key_sk_ed25519:
--------------------------------------------------------------------------------
1 | -----BEGIN OPENSSH PRIVATE KEY-----
2 | b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAASgAAABpz
3 | ay1zc2gtZWQyNTUxOUBvcGVuc3NoLmNvbQAAACDBcgTVFBeT+QjB2yEVSAAL6tVQ
4 | i4biqjFHdrU6GR7iwwAAAARzc2g6AAAAwDXm6/Y15uv2AAAAGnNrLXNzaC1lZDI1
5 | NTE5QG9wZW5zc2guY29tAAAAIMFyBNUUF5P5CMHbIRVIAAvq1VCLhuKqMUd2tToZ
6 | HuLDAAAABHNzaDoBAAAARln/1EfLW1iJcgilIh0I8FS2T54+Wm8Qk73Gy5uqH5Rf
7 | AAHjBhDooWIRWWD+HsIj5lKcn0tugCANy15cMhyK8eKxv/j///8AAAAAAAAAFnRl
8 | c3RfZWQyNTUxOUBwaWNreS5jb20BAgMEBQ==
9 | -----END OPENSSH PRIVATE KEY-----
10 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawAttributeValueType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum AttributeValueType
15 | {
16 | Extensions = 0,
17 | ContentType = 1,
18 | SpcStatementType = 2,
19 | MessageDigest = 3,
20 | SigningTime = 4,
21 | SpcSpOpusInfo = 5,
22 | Custom = 6,
23 | }
24 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawHashAlgorithm.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum HashAlgorithm
15 | {
16 | MD5 = 0,
17 | SHA1 = 1,
18 | SHA2_224 = 2,
19 | SHA2_256 = 3,
20 | SHA2_384 = 4,
21 | SHA2_512 = 5,
22 | SHA3_384 = 6,
23 | SHA3_512 = 7,
24 | Unknown = 8,
25 | }
26 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawGeneralNameType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum GeneralNameType
15 | {
16 | OtherName = 0,
17 | Rfc822Name = 1,
18 | DnsName = 2,
19 | DirectoryName = 3,
20 | EdiPartyName = 4,
21 | Uri = 5,
22 | IpAddress = 6,
23 | RegisteredId = 7,
24 | }
25 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_key_p256:
--------------------------------------------------------------------------------
1 | -----BEGIN OPENSSH PRIVATE KEY-----
2 | b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAaAAAABNl
3 | Y2RzYS1zaGEyLW5pc3RwMjU2AAAACG5pc3RwMjU2AAAAQQTx70KiF4HLRocNdWIk
4 | 4YYDKI45OssRX06DcFTlzHadYQf8Dyb2/x/ax+y5+RHHUiRZ4A7QvOsLb6EBMmnX
5 | QUjYAAAAsC8beUYvG3lGAAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAy
6 | NTYAAABBBPHvQqIXgctGhw11YiThhgMojjk6yxFfToNwVOXMdp1hB/wPJvb/H9rH
7 | 7Ln5EcdSJFngDtC86wtvoQEyaddBSNgAAAAhAO0RAO5pQc5zMKpKRzVasK/Z8Jo6
8 | v0RCmhbOhRIhGqcHAAAAFHRlc3RfZWNkc2FAcGlja3kuY29tAQID
9 | -----END OPENSSH PRIVATE KEY-----
10 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/Pkcs12HashAlgorithm.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// Hashing algorithm used for MAC or KDF in PFX file
16 | ///
17 | public enum Pkcs12HashAlgorithm
18 | {
19 | Sha1 = 0,
20 | Sha224 = 1,
21 | Sha256 = 2,
22 | Sha384 = 3,
23 | Sha512 = 4,
24 | }
25 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawPkcs12HashAlgorithm.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// Hashing algorithm used for MAC or KDF in PFX file
16 | ///
17 | public enum Pkcs12HashAlgorithm
18 | {
19 | Sha1 = 0,
20 | Sha224 = 1,
21 | Sha256 = 2,
22 | Sha384 = 3,
23 | Sha512 = 4,
24 | }
25 |
--------------------------------------------------------------------------------
/ffi/wasm/ava_tests/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "picky-ava-tests",
3 | "version": "0.0.0",
4 | "directories": {
5 | "test": "tests"
6 | },
7 | "scripts": {
8 | "test": "ava",
9 | "format": "rome format . --write",
10 | "check": "rome check .",
11 | "ci": "rome ci ."
12 | },
13 | "optionalDependencies": {
14 | "@devolutions/picky": "file:../pkg"
15 | },
16 | "devDependencies": {
17 | "ava": "^4.3.1",
18 | "rome": "^0.10.1-next"
19 | },
20 | "ava": {
21 | "files": [
22 | "tests/*.mjs"
23 | ],
24 | "timeout": "1m"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_key_rsa.pub:
--------------------------------------------------------------------------------
1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC3MgUfd8ApRyTL/sRI3HufnNtoKw9I7GNbRB2lD2A94GasMaEuXBIgDM+ZN2394yH+Qys9ENj0p8h//T75ZpdeawBORWDay/wpK+xVCT6yRcOmLJSrdgm8fXgq3Fy8wIYR4ISNzzaB3BrTMGwOv8iPSgmmISEahNM9w+RCS65DVi0F+ygwgWunBnXKbuFNkbDbvBmJ6eEXTaV47CECfNUKCSiQXnl0w2JmEUrqSSGdH5nrTq3nZeO/Flw5GZ7O5/z3Nn4huwkrsdIFU7jREk1yQBCeeg7beM9FiMk6u6OLcn7dwnmIjB6ODqwwtvMzVRHeZrDt0gdgBX2gq5PJbPeTlr5eDCqOqKngJiCfCaHx2jIfCFDMEHBKCGKeFe7b07QAV29yubQcN+BlXIpTTM+Efh27smCxjQ+E+TtUvj28DyTdVaMigl6FvMX0n76RuWinkOsfv6Kvy3BH7RhgonI9JPH0DhBSGeaaeO9FQAiKdwafwQN3OZdi3iHhHjPXPRk= test_rsa
2 |
--------------------------------------------------------------------------------
/picky-krb/src/crypto/aes/hmac_sha196_aes_128.rs:
--------------------------------------------------------------------------------
1 | use crate::crypto::{Checksum, ChecksumSuite, KerberosCryptoResult};
2 |
3 | use super::{AesSize, checksum_sha_aes};
4 |
5 | #[derive(Clone, Debug, Default, PartialEq, Eq)]
6 | pub struct HmacSha196Aes128;
7 |
8 | impl Checksum for HmacSha196Aes128 {
9 | fn checksum_type(&self) -> ChecksumSuite {
10 | ChecksumSuite::HmacSha196Aes128
11 | }
12 |
13 | fn checksum(&self, key: &[u8], key_usage: i32, payload: &[u8]) -> KerberosCryptoResult> {
14 | checksum_sha_aes(key, key_usage, payload, &AesSize::Aes128)
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/picky-krb/src/crypto/aes/hmac_sha196_aes_256.rs:
--------------------------------------------------------------------------------
1 | use crate::crypto::{Checksum, ChecksumSuite, KerberosCryptoResult};
2 |
3 | use super::{AesSize, checksum_sha_aes};
4 |
5 | #[derive(Clone, Debug, Default, PartialEq, Eq)]
6 | pub struct HmacSha196Aes256;
7 |
8 | impl Checksum for HmacSha196Aes256 {
9 | fn checksum_type(&self) -> ChecksumSuite {
10 | ChecksumSuite::HmacSha196Aes256
11 | }
12 |
13 | fn checksum(&self, key: &[u8], key_usage: i32, payload: &[u8]) -> KerberosCryptoResult> {
14 | checksum_sha_aes(key, key_usage, payload, &AesSize::Aes256)
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/Version.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// TODO: this could be lifted in future diplomat-tool, Diplomat does not allow Option wrapped enums, so we have to use a None variant
16 | ///
17 | public enum Version
18 | {
19 | None = 0,
20 | V1 = 1,
21 | V2 = 2,
22 | V3 = 3,
23 | }
24 |
--------------------------------------------------------------------------------
/picky/fuzz/fuzz_targets/x509.rs:
--------------------------------------------------------------------------------
1 | #![no_main]
2 | use libfuzzer_sys::fuzz_target;
3 | use picky::{
4 | key::{PrivateKey, PublicKey},
5 | pem::{parse_pem, Pem},
6 | x509::{certificate::Cert, csr::Csr},
7 | };
8 |
9 | fuzz_target!(|data: &[u8]| {
10 | // pem
11 | let _ = parse_pem(data);
12 | let pem = Pem::new("HEADER", data);
13 | let _ = parse_pem(&pem.to_string());
14 |
15 | // keys
16 | let _ = PrivateKey::from_pkcs8(data);
17 | let _ = PublicKey::from_der(data);
18 |
19 | // x509
20 | let _ = Csr::from_der(data);
21 | let _ = Cert::from_der(data);
22 | });
23 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawVersion.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// TODO: this could be lifted in future diplomat-tool, Diplomat does not allow Option wrapped enums, so we have to use a None variant
16 | ///
17 | public enum Version
18 | {
19 | None = 0,
20 | V1 = 1,
21 | V2 = 2,
22 | V3 = 3,
23 | }
24 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_key_sk_ed25519_enc:
--------------------------------------------------------------------------------
1 | -----BEGIN OPENSSH PRIVATE KEY-----
2 | b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABCe
3 | o4ZL2FU2iChvPsRYnAHfAAAAGAAAAAEAAABKAAAAGnNrLXNzaC1lZDI1NTE5QG9w
4 | ZW5zc2guY29tAAAAIJESlWqzFaHQeHtmWdj11Fl+g00Rq3gncN7mAnEaEfLnAAAA
5 | BHNzaDoAAADAdSmXW0TS0UFnhsRzegg4j9Uhv3sSUfImVi5wAfc8pMQ+82pVXj0g
6 | wZXaqWx/c74lKBvuPttnW4IHOrDNXzOmXNNN2ALdzvM35r9w7C05nue8ysDYlrxE
7 | OU9FHyf18rRn/GF6izLTz4geR17T28z7uR1uHGCc4QSQfM3qZXBIX/DFg4Qna9du
8 | r1EVP0h1eqTkkURjPmIJ39SCa4ukn6zquSaGS+rB2tRbM74cYTfEJhrl/niJqmBG
9 | d0pJSby/G/7k
10 | -----END OPENSSH PRIVATE KEY-----
11 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/ExtensionViewType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum ExtensionViewType
15 | {
16 | AuthorityKeyIdentifier = 0,
17 | SubjectKeyIdentifier = 1,
18 | KeyUsage = 2,
19 | SubjectAltName = 3,
20 | IssuerAltName = 4,
21 | BasicConstraints = 5,
22 | ExtendedKeyUsage = 6,
23 | Generic = 7,
24 | CrlNumber = 8,
25 | }
26 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_encrypted_key_p256:
--------------------------------------------------------------------------------
1 | -----BEGIN OPENSSH PRIVATE KEY-----
2 | b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABBf
3 | EFvZOZCWk/4wgptdm2u3AAAAEAAAAAEAAABoAAAAE2VjZHNhLXNoYTItbmlzdHAy
4 | NTYAAAAIbmlzdHAyNTYAAABBBOTN9DalwD9o5qZ4bSGiAKsB5UMdk4Kat3K8wshl
5 | 1y9gOFSHQP11i1Il1pklmNQPhN+ZzLYsIzUmOl575AybqvEAAACwyEDq9SCD4tiy
6 | 3mp2IeNKOD4f2MJkSBIqGHVZgZru0PC9zbt5F+exROgwOPrflTnm4G5AqkDGxAVV
7 | 5HkdWWCBZtLq2xDpjW+gMs8H7wz+L7j7kKXkDMKNJ9n21C43woGhZi6fr50Y1hmL
8 | 53o37IFzfii0BYzozOrnynSmMW45U44XEN4voElJL0G4ug/vSRxCDOZ0WPQpmtk0
9 | coqUulQef1YpUWLI/8WX6PepASvkLuA=
10 | -----END OPENSSH PRIVATE KEY-----
11 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/PuttyPpkKeyAlgorithm.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// PuTTY Private Key (PPK) algorithm.
16 | ///
17 | public enum PuttyPpkKeyAlgorithm
18 | {
19 | Rsa = 0,
20 | Dss = 1,
21 | EcdsaSha2Nistp256 = 2,
22 | EcdsaSha2Nistp384 = 3,
23 | EcdsaSha2Nistp521 = 4,
24 | Ed25519 = 5,
25 | Ed448 = 6,
26 | }
27 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawExtensionViewType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum ExtensionViewType
15 | {
16 | AuthorityKeyIdentifier = 0,
17 | SubjectKeyIdentifier = 1,
18 | KeyUsage = 2,
19 | SubjectAltName = 3,
20 | IssuerAltName = 4,
21 | BasicConstraints = 5,
22 | ExtendedKeyUsage = 6,
23 | Generic = 7,
24 | CrlNumber = 8,
25 | }
26 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawPuttyPpkKeyAlgorithm.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// PuTTY Private Key (PPK) algorithm.
16 | ///
17 | public enum PuttyPpkKeyAlgorithm
18 | {
19 | Rsa = 0,
20 | Dss = 1,
21 | EcdsaSha2Nistp256 = 2,
22 | EcdsaSha2Nistp384 = 3,
23 | EcdsaSha2Nistp521 = 4,
24 | Ed25519 = 5,
25 | Ed448 = 6,
26 | }
27 |
--------------------------------------------------------------------------------
/picky-asn1-der/src/ser/boolean.rs:
--------------------------------------------------------------------------------
1 | use crate::misc::WriteExt;
2 | use crate::{Result, Serializer};
3 | use picky_asn1::tag::Tag;
4 |
5 | /// A serializer for booleans
6 | pub struct Boolean;
7 | impl Boolean {
8 | /// Serializes `value` into `writer`
9 | pub fn serialize(value: bool, ser: &mut Serializer) -> Result {
10 | let mut written = ser.h_write_header(Tag::BOOLEAN, 1)?;
11 |
12 | // Serialize the value
13 | written += if value {
14 | ser.writer.write_one(0xff)?
15 | } else {
16 | ser.writer.write_one(0x00)?
17 | };
18 |
19 | Ok(written)
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_p256_key_sk_ed25519-cert.pub:
--------------------------------------------------------------------------------
1 | sk-ssh-ed25519-cert-v01@openssh.com AAAAI3NrLXNzaC1lZDI1NTE5LWNlcnQtdjAxQG9wZW5zc2guY29tAAAAIL/Dzlfmf7mvT03EgO/rOGWCm/qopC+CVrx55HWX9zOgAAAAIMFyBNUUF5P5CMHbIRVIAAvq1VCLhuKqMUd2tToZHuLDAAAABHNzaDoAAAAAAAAAAQAAAAIAAAAEYWJjZAAAABYAAAASc2VydmVyLmV4YW1wbGUuY29tAAAAAGYMdvgAAAAAihj7XgAAAAAAAAAAAAAAAAAAAGgAAAATZWNkc2Etc2hhMi1uaXN0cDI1NgAAAAhuaXN0cDI1NgAAAEEE8e9CoheBy0aHDXViJOGGAyiOOTrLEV9Og3BU5cx2nWEH/A8m9v8f2sfsufkRx1IkWeAO0LzrC2+hATJp10FI2AAAAGQAAAATZWNkc2Etc2hhMi1uaXN0cDI1NgAAAEkAAAAhAPHypbeSMeZwPBep5R+X3lvvUDG18gCQ7z6as6JPsYekAAAAIA1GXWi9162NoaBLr0wcxe2RO84wgZEWUXRXVhdbHHjS test_ed25519@picky.com
2 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/NameAttr.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum NameAttr
15 | {
16 | CommonName = 0,
17 | Surname = 1,
18 | SerialNumber = 2,
19 | CountryName = 3,
20 | LocalityName = 4,
21 | StateOrProvinceName = 5,
22 | StreetName = 6,
23 | OrganizationName = 7,
24 | OrganizationalUnitName = 8,
25 | GivenName = 9,
26 | Phone = 10,
27 | }
28 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawNameAttr.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum NameAttr
15 | {
16 | CommonName = 0,
17 | Surname = 1,
18 | SerialNumber = 2,
19 | CountryName = 3,
20 | LocalityName = 4,
21 | StateOrProvinceName = 5,
22 | StreetName = 6,
23 | OrganizationName = 7,
24 | OrganizationalUnitName = 8,
25 | GivenName = 9,
26 | Phone = 10,
27 | }
28 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_sk_ed25519_key_p256-cert.pub:
--------------------------------------------------------------------------------
1 | ecdsa-sha2-nistp256-cert-v01@openssh.com AAAAKGVjZHNhLXNoYTItbmlzdHAyNTYtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgJdtCaDTeVq+pdyXyllljbtBXyhjxh3hrem6X+qG83jwAAAAIbmlzdHAyNTYAAABBBPHvQqIXgctGhw11YiThhgMojjk6yxFfToNwVOXMdp1hB/wPJvb/H9rH7Ln5EcdSJFngDtC86wtvoQEyaddBSNgAAAAAAAAAAQAAAAIAAAAEYWJjZAAAABYAAAASc2VydmVyLmV4YW1wbGUuY29tAAAAAGYMX4gAAAAAihjj2QAAAAAAAAAAAAAAAAAAAEoAAAAac2stc3NoLWVkMjU1MTlAb3BlbnNzaC5jb20AAAAgwXIE1RQXk/kIwdshFUgAC+rVUIuG4qoxR3a1Ohke4sMAAAAEc3NoOgAAAGcAAAAac2stc3NoLWVkMjU1MTlAb3BlbnNzaC5jb20AAABA9ryRtw3qC7pMQ6TnnaVU2dt2LZ1YfkfYbvCMnZQv7GzUPDQWdms2ukjZy4YC+Om8S3SQX//iEK/ZjYG2yfpODgEAAAAS test_ecdsa@picky.com
2 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/EdAlgorithm.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// Known Edwards curve-based algorithm name
16 | ///
17 | public enum EdAlgorithm
18 | {
19 | ///
20 | /// Ed25519 signing algorithm
21 | ///
22 | Ed25519 = 0,
23 | ///
24 | /// X25519 key agreement algorithm
25 | ///
26 | X25519 = 1,
27 | }
28 |
--------------------------------------------------------------------------------
/picky/src/putty/mod.rs:
--------------------------------------------------------------------------------
1 | //! PuTTY key format described in [Appendix C][1] of the PuTTY User Manual.
2 | //!
3 | //! Both private([`Ppk`]) and public([`PuttyPublicKey`]) keys are supported.
4 | //!
5 | //! [1]: https://the.earth.li/~sgtatham/putty/0.75/htmldoc/AppendixC.html#ppk
6 |
7 | mod error;
8 | mod key_value;
9 | mod ppk;
10 | mod private_key;
11 | mod public_key;
12 |
13 | pub use error::PuttyError;
14 | pub use key_value::{
15 | Argon2FlavourValue as Argon2Flavour, PpkKeyAlgorithmValue as PpkKeyAlgorithm, PpkVersionKey as PpkVersion,
16 | };
17 | pub use ppk::{Argon2Params, Ppk, PpkEncryptionConfig, PpkEncryptionConfigBuilder};
18 | pub use public_key::PuttyPublicKey;
19 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawEdAlgorithm.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// Known Edwards curve-based algorithm name
16 | ///
17 | public enum EdAlgorithm
18 | {
19 | ///
20 | /// Ed25519 signing algorithm
21 | ///
22 | Ed25519 = 0,
23 | ///
24 | /// X25519 key agreement algorithm
25 | ///
26 | X25519 = 1,
27 | }
28 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/ShaVariant.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum ShaVariant
15 | {
16 | MD5 = 0,
17 | SHA1 = 1,
18 | SHA2_224 = 2,
19 | SHA2_256 = 3,
20 | SHA2_384 = 4,
21 | SHA2_512 = 5,
22 | SHA2_512_224 = 6,
23 | SHA2_512_256 = 7,
24 | SHA3_224 = 8,
25 | SHA3_256 = 9,
26 | SHA3_384 = 10,
27 | SHA3_512 = 11,
28 | SHAKE128 = 12,
29 | SHAKE256 = 13,
30 | }
31 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_cert_p256.crt:
--------------------------------------------------------------------------------
1 | ecdsa-sha2-nistp256-cert-v01@openssh.com AAAAKGVjZHNhLXNoYTItbmlzdHAyNTYtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgVF7iYJazCstaIF6fPB2mdiu1tp7Qp9zy1lsSqWk4bUMAAAAIbmlzdHAyNTYAAABBBPHvQqIXgctGhw11YiThhgMojjk6yxFfToNwVOXMdp1hB/wPJvb/H9rH7Ln5EcdSJFngDtC86wtvoQEyaddBSNgAAAAAAAAAAQAAAAIAAAAEYWJjZAAAABYAAAASc2VydmVyLmV4YW1wbGUuY29tAAAAAGRmayQAAAAAiHLvgAAAAAAAAAAAAAAAAAAAAGgAAAATZWNkc2Etc2hhMi1uaXN0cDI1NgAAAAhuaXN0cDI1NgAAAEEEsvfm6M59MaOdu1TxBxwDK9E7b9CfMy+UNGD2D/hZwsGbRzSd21+wwjsU1ptmuLnCrqZNMqycCnu+8D3HrYpZCQAAAGQAAAATZWNkc2Etc2hhMi1uaXN0cDI1NgAAAEkAAAAhAN6d/alUsrsM9eg2U4EomCkvnQhT+nzsb7mZE8QnFLalAAAAIDwWv0/MDaf0Fc6/zAqKzW5nBgpTe7mEhvU0YmM4jfPJ test_ecdsa@picky.com
2 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawShaVariant.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum ShaVariant
15 | {
16 | MD5 = 0,
17 | SHA1 = 1,
18 | SHA2_224 = 2,
19 | SHA2_256 = 3,
20 | SHA2_384 = 4,
21 | SHA2_512 = 5,
22 | SHA2_512_224 = 6,
23 | SHA2_512_256 = 7,
24 | SHA3_224 = 8,
25 | SHA3_256 = 9,
26 | SHA3_384 = 10,
27 | SHA3_512 = 11,
28 | SHAKE128 = 12,
29 | SHAKE256 = 13,
30 | }
31 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_key_p384:
--------------------------------------------------------------------------------
1 | -----BEGIN OPENSSH PRIVATE KEY-----
2 | b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAiAAAABNl
3 | Y2RzYS1zaGEyLW5pc3RwMzg0AAAACG5pc3RwMzg0AAAAYQS5HPzXAWSybAgwQAIo
4 | MSJo7SuU2kdfcUumzfHe/LrO9QBwA9U8fXs83tbwbT7wsQAShYdQWgdTJWRZUqiM
5 | 36NtkzHoJUnQEbZ8M+mO2+IMzKCA1ac9Y29P5jqT7yNqlmMAAADgEBNIyxATSMsA
6 | AAATZWNkc2Etc2hhMi1uaXN0cDM4NAAAAAhuaXN0cDM4NAAAAGEEuRz81wFksmwI
7 | MEACKDEiaO0rlNpHX3FLps3x3vy6zvUAcAPVPH17PN7W8G0+8LEAEoWHUFoHUyVk
8 | WVKojN+jbZMx6CVJ0BG2fDPpjtviDMyggNWnPWNvT+Y6k+8japZjAAAAMAZd/uVj
9 | w6bg3hcMWZ6zMJ1ZaddIX7RHaacl67zUFTfJVkRSR7JFeiz/ibVzR33vXQAAABR0
10 | ZXN0X2VjZHNhQHBpY2t5LmNvbQECAwQ=
11 | -----END OPENSSH PRIVATE KEY-----
12 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/PickyException.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public partial class PickyException : Exception
15 | {
16 | private PickyError _inner;
17 |
18 | public PickyException(PickyError inner) : base(inner.ToDisplay())
19 | {
20 | _inner = inner;
21 | }
22 |
23 | public PickyError Inner
24 | {
25 | get
26 | {
27 | return _inner;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/picky-asn1-der/tests/test_vectors/serde_primitive_integer.txt:
--------------------------------------------------------------------------------
1 | # Test zero
2 | value: 0
3 | der__: 020100
4 |
5 | # Test normal integer
6 | value: 7
7 | der__: 020107
8 |
9 |
10 | # Test leading-one integer
11 | value: 128
12 | der__: 02020080
13 |
14 | # Test all-one integer
15 | value: 255
16 | der__: 020200FF
17 |
18 |
19 | # Test u128 integer
20 | value: 169853733957366961371495358725388383073
21 | der__: 02107FC8A3A53249CCF273B3E94DE1B63361
22 |
23 | # Test u128 integer
24 | value: 171182961953151877244399165785668727649
25 | der__: 02110080C8A3A53249CCF273B3E94DE1B63361
26 |
27 | # Test u128 integer
28 | value: 340282366920938463463374607431768211455
29 | der__: 021100FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/leaf.csr:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE REQUEST-----
2 | MIIBmTCCAQICAQAwWTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUx
3 | ITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDESMBAGA1UEAwwJUGlj
4 | a3lMZWFmMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMHvAjdh9RMxDzgIwW
5 | r5BAQfbdTFGMhSv+y2K6yYXvBJB4fay1nWt5zT1FuQYk3CA6mgcGLqnH0b6azyjE
6 | uCgtQYtkzqOr3+8z2V2Mrce8sCZV+wB3W9lmY9W4O2PT8byBJ9Br/1RhtY9PNM7/
7 | 00Zkk/63tiPyYPKVvwY8/MYg9wIDAQABoAAwDQYJKoZIhvcNAQELBQADgYEARnDl
8 | OA0KpqLwf3LU4YKuVGNKgSPIauuXvgKhAKvbx+OB9ljeOGFzcCM6m30PmhiZR8Gd
9 | ny7yPNubX8aGF9JLlTSO4yocQlXqakJ0vpTauyQK13+pfTnnf3vbpK4+UOMxb2s3
10 | 1xUPyVUUljWXg9sOnW4lHFwSdK569p+Kek4oHX8=
11 | -----END CERTIFICATE REQUEST-----
12 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/ca.csr:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE REQUEST-----
2 | MIIBnjCCAQcCAQAwXjELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUx
3 | ITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAwwOUGlj
4 | a3lBdXRob3JpdHkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOY6dDK51FqL
5 | 1UXhQD2vs2Igk8S0jm2gBDJ56DU5yXkY1Ln2znXq7ntILwYUhE91uk8BR4vsycxa
6 | xzRSxvePj6BdhWnYuceaSfwyJ20g1yBn0C5mHcN/fvSqaH7Np9Ax2U+N36QiWJu0
7 | ERDfOtkQVTEubg/Mf9gE+74yDjWiUcIrAgMBAAGgADANBgkqhkiG9w0BAQsFAAOB
8 | gQC+yC5QxP78Rg5UBc7tB2uXDgdOCdTvWguX4ThlV8iNgLtOumgR0UyrRaB0i/Ae
9 | fh6pQbhuxWHV2niuqa1UxVd0pn/HxFi5j88Hn8IR98zDDnYXTpV2/85d8pVVmphM
10 | iknXqjIuqz0XQoD8UohCqjv7rnnqTmsM5TkZSsYVfEogqg==
11 | -----END CERTIFICATE REQUEST-----
12 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_key_sk_ecdsa:
--------------------------------------------------------------------------------
1 | -----BEGIN OPENSSH PRIVATE KEY-----
2 | b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAfwAAACJz
3 | ay1lY2RzYS1zaGEyLW5pc3RwMjU2QG9wZW5zc2guY29tAAAACG5pc3RwMjU2AAAA
4 | QQT3Cp5eUy/29OnZ5IBmEhXDQBYxIqjNZtvnosDGZ3Wl0XDqhf6mfK99rZIkCW9S
5 | M07bE0PRDlaW5dFw3bFRkvRpAAAABHNzaDoAAADwIoN2MSKDdjEAAAAic2stZWNk
6 | c2Etc2hhMi1uaXN0cDI1NkBvcGVuc3NoLmNvbQAAAAhuaXN0cDI1NgAAAEEE9wqe
7 | XlMv9vTp2eSAZhIVw0AWMSKozWbb56LAxmd1pdFw6oX+pnyvfa2SJAlvUjNO2xND
8 | 0Q5WluXRcN2xUZL0aQAAAARzc2g6AQAAAEY8RxoD1v/Au/bjlJm2y882b2yH9h8T
9 | ArqPmzmKpeoKqAAB4wYQ6KFiEVlg/h7CI+ZSnJ9LboAgDcteXDIcivHisb/5////
10 | AAAAAAAAABR0ZXN0X2VjZHNhQHBpY2t5LmNvbQEC
11 | -----END OPENSSH PRIVATE KEY-----
12 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_p256_key_sk_ecdsa-cert.pub:
--------------------------------------------------------------------------------
1 | sk-ecdsa-sha2-nistp256-cert-v01@openssh.com AAAAK3NrLWVjZHNhLXNoYTItbmlzdHAyNTYtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgtyyLGUKDA2vb6SHTdPKidPZ6sNBZIR+Vq6boVC035qsAAAAIbmlzdHAyNTYAAABBBPcKnl5TL/b06dnkgGYSFcNAFjEiqM1m2+eiwMZndaXRcOqF/qZ8r32tkiQJb1IzTtsTQ9EOVpbl0XDdsVGS9GkAAAAEc3NoOgAAAAAAAAABAAAAAgAAAARhYmNkAAAAFgAAABJzZXJ2ZXIuZXhhbXBsZS5jb20AAAAAZgx2+AAAAACKGPtrAAAAAAAAAAAAAAAAAAAAaAAAABNlY2RzYS1zaGEyLW5pc3RwMjU2AAAACG5pc3RwMjU2AAAAQQTx70KiF4HLRocNdWIk4YYDKI45OssRX06DcFTlzHadYQf8Dyb2/x/ax+y5+RHHUiRZ4A7QvOsLb6EBMmnXQUjYAAAAYwAAABNlY2RzYS1zaGEyLW5pc3RwMjU2AAAASAAAACBPMvHB/GFmw441WnOv5QExT9qZyT/jTlL8awaZhKxSGgAAACASSekPJXu6RyRMU45W1zDV6k8xkCul+PnlEawxiCG3sg== test_ecdsa@picky.com
2 |
--------------------------------------------------------------------------------
/picky-krb/src/crypto/des/hmac_sha1_des3_kd.rs:
--------------------------------------------------------------------------------
1 | use crate::crypto::common::hmac_sha1;
2 | use crate::crypto::utils::usage_ki;
3 | use crate::crypto::{Checksum, ChecksumSuite, KerberosCryptoResult};
4 |
5 | use super::{DES3_MAC_SIZE, derive_key};
6 |
7 | #[derive(Debug, Clone, Default, PartialEq, Eq)]
8 | pub struct HmacSha1Des3Kd;
9 |
10 | impl Checksum for HmacSha1Des3Kd {
11 | fn checksum_type(&self) -> ChecksumSuite {
12 | ChecksumSuite::HmacSha1Des3Kd
13 | }
14 |
15 | fn checksum(&self, key: &[u8], key_usage: i32, payload: &[u8]) -> KerberosCryptoResult> {
16 | let ki = derive_key(key, &usage_ki(key_usage))?;
17 |
18 | Ok(hmac_sha1(&ki, payload, DES3_MAC_SIZE))
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/intermediate.csr:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE REQUEST-----
2 | MIIBoTCCAQoCAQAwYTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUx
3 | ITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEaMBgGA1UEAwwRUGlj
4 | a3lJbnRlcm1lZGlhdGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKdfvuoa
5 | 30QaMksLFcAaytY83Nsc4WQirYe0WixegLiroKNOBAQkWMhzsCXWmSj1rydyf4Qu
6 | JRtL9idlFUV1EL8eAJvwxDhRF6o7U4t9y7kPjCBvqkVi1SGDnk6cEOwJBF/XE7cj
7 | UbwxvAFCgWO0H9ihB1sB0ZUzD0SByK9Q8TybAgMBAAGgADANBgkqhkiG9w0BAQsF
8 | AAOBgQCY3miTxEpS1ioMYuL4BWHfo8rK1fG1J+c5qeeKl8jt2Etk3dUkth9lnmjn
9 | eJrGXoo5WLpsmFFGb2xI5H52OG646QPRacR3WmZvAwmTkS0GUT3Gygldfn73NJa2
10 | TaQVWQKrXug5rr62/nK2UcvKWWC7nsOpP6MPb6DDKhhoerudXg==
11 | -----END CERTIFICATE REQUEST-----
12 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_cert_p384.crt:
--------------------------------------------------------------------------------
1 | ecdsa-sha2-nistp384-cert-v01@openssh.com AAAAKGVjZHNhLXNoYTItbmlzdHAzODQtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgBZcupV45Mf3ddEuKgptvKAvoZp9sfIkfpRCvd2bUEpEAAAAIbmlzdHAzODQAAABhBLkc/NcBZLJsCDBAAigxImjtK5TaR19xS6bN8d78us71AHAD1Tx9ezze1vBtPvCxABKFh1BaB1MlZFlSqIzfo22TMeglSdARtnwz6Y7b4gzMoIDVpz1jb0/mOpPvI2qWYwAAAAAAAAABAAAAAgAAAARhYmNkAAAAFgAAABJzZXJ2ZXIuZXhhbXBsZS5jb20AAAAAZGZrJAAAAACIcu+FAAAAAAAAAAAAAAAAAAAAaAAAABNlY2RzYS1zaGEyLW5pc3RwMjU2AAAACG5pc3RwMjU2AAAAQQSy9+bozn0xo527VPEHHAMr0Ttv0J8zL5Q0YPYP+FnCwZtHNJ3bX7DCOxTWm2a4ucKupk0yrJwKe77wPcetilkJAAAAZAAAABNlY2RzYS1zaGEyLW5pc3RwMjU2AAAASQAAACEAkU2YweMaMa3z9hSAVCnQqZSvEi9joq0nJXoj+gE9XggAAAAgGuaPBnk/W74zPYGtKAZ0MWOd+dSEARqqx0JYnganCtI= test_ecdsa@picky.com
2 |
--------------------------------------------------------------------------------
/picky/fuzz/Cargo.toml:
--------------------------------------------------------------------------------
1 |
2 | [package]
3 | name = "picky-fuzz"
4 | version = "0.0.0"
5 | authors = ["Automatically generated"]
6 | publish = false
7 | edition = "2024"
8 |
9 | [package.metadata]
10 | cargo-fuzz = true
11 |
12 | [dependencies]
13 | picky = { path = "../" }
14 | picky-test-data = { path = "../../picky-test-data", version = "0.1" }
15 | libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" }
16 |
17 | # Prevent this from interfering with workspaces
18 | [workspace]
19 | members = ["."]
20 |
21 | [[bin]]
22 | name = "x509"
23 | path = "fuzz_targets/x509.rs"
24 |
25 | [[bin]]
26 | name = "jose"
27 | path = "fuzz_targets/jose.rs"
28 |
29 | [[bin]]
30 | name = "http"
31 | path = "fuzz_targets/http.rs"
32 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/SshCertKeyType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// SSH key type.
16 | ///
17 | public enum SshCertKeyType
18 | {
19 | SshRsaV01 = 0,
20 | SshDssV01 = 1,
21 | RsaSha2_256V01 = 2,
22 | RsaSha2_512v01 = 3,
23 | EcdsaSha2Nistp256V01 = 4,
24 | EcdsaSha2Nistp384V01 = 5,
25 | EcdsaSha2Nistp521V01 = 6,
26 | SshEd25519V01 = 7,
27 | SkSshSha2Nistp256V01 = 8,
28 | SkSshEd25519V01 = 9,
29 | }
30 |
--------------------------------------------------------------------------------
/ffi/wasm/src/lib.rs:
--------------------------------------------------------------------------------
1 | #[macro_use]
2 | mod macros;
3 |
4 | pub mod jwt;
5 | pub mod key;
6 | pub mod pem;
7 | pub mod putty;
8 | pub mod ssh;
9 |
10 | use wasm_bindgen::prelude::*;
11 |
12 | #[wasm_bindgen(start)]
13 | pub fn init_picky() -> Result<(), JsValue> {
14 | // When the `console_error_panic_hook` feature is enabled, we can call the
15 | // `set_panic_hook` function at least once during initialization, and then
16 | // we will get better error messages if our code ever panics.
17 | //
18 | // For more details see
19 | // https://github.com/rustwasm/console_error_panic_hook#readme
20 | #[cfg(feature = "console_error_panic_hook")]
21 | console_error_panic_hook::set_once();
22 |
23 | Ok(())
24 | }
25 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawSshCertKeyType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// SSH key type.
16 | ///
17 | public enum SshCertKeyType
18 | {
19 | SshRsaV01 = 0,
20 | SshDssV01 = 1,
21 | RsaSha2_256V01 = 2,
22 | RsaSha2_512v01 = 3,
23 | EcdsaSha2Nistp256V01 = 4,
24 | EcdsaSha2Nistp384V01 = 5,
25 | EcdsaSha2Nistp521V01 = 6,
26 | SshEd25519V01 = 7,
27 | SkSshSha2Nistp256V01 = 8,
28 | SkSshEd25519V01 = 9,
29 | }
30 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/EcCurve.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// Known elliptic curve name used for ECDSA arithmetic operations
16 | ///
17 | public enum EcCurve
18 | {
19 | ///
20 | /// NIST P-256
21 | ///
22 | NistP256 = 0,
23 | ///
24 | /// NIST P-384
25 | ///
26 | NistP384 = 1,
27 | ///
28 | /// NIST P-521
29 | ///
30 | NistP521 = 2,
31 | }
32 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/BufferTooSmallException.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public partial class BufferTooSmallException : Exception
15 | {
16 | private BufferTooSmallError _inner;
17 |
18 | public BufferTooSmallException(BufferTooSmallError inner) : base(inner.ToDisplay())
19 | {
20 | _inner = inner;
21 | }
22 |
23 | public BufferTooSmallError Inner
24 | {
25 | get
26 | {
27 | return _inner;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawEcCurve.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// Known elliptic curve name used for ECDSA arithmetic operations
16 | ///
17 | public enum EcCurve
18 | {
19 | ///
20 | /// NIST P-256
21 | ///
22 | NistP256 = 0,
23 | ///
24 | /// NIST P-384
25 | ///
26 | NistP384 = 1,
27 | ///
28 | /// NIST P-521
29 | ///
30 | NistP521 = 2,
31 | }
32 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/AttributeTypeAndValueParametersType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | public enum AttributeTypeAndValueParametersType
15 | {
16 | CommonName = 0,
17 | Surname = 1,
18 | SerialNumber = 2,
19 | CountryName = 3,
20 | LocalityName = 4,
21 | StateOrProvinceName = 5,
22 | StreetName = 6,
23 | OrganizationName = 7,
24 | OrganizationalUnitName = 8,
25 | EmailAddress = 9,
26 | GivenName = 10,
27 | Phone = 11,
28 | Custom = 12,
29 | }
30 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_sk_ecdsa_key_p256-cert.pub:
--------------------------------------------------------------------------------
1 | ecdsa-sha2-nistp256-cert-v01@openssh.com AAAAKGVjZHNhLXNoYTItbmlzdHAyNTYtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgLQ+pgshQDc9mkmFL3PTcjESclC2FTt3sMu0bDTHTmREAAAAIbmlzdHAyNTYAAABBBPHvQqIXgctGhw11YiThhgMojjk6yxFfToNwVOXMdp1hB/wPJvb/H9rH7Ln5EcdSJFngDtC86wtvoQEyaddBSNgAAAAAAAAAAQAAAAIAAAAEYWJjZAAAABYAAAASc2VydmVyLmV4YW1wbGUuY29tAAAAAGYMX0wAAAAAihjjmAAAAAAAAAAAAAAAAAAAAH8AAAAic2stZWNkc2Etc2hhMi1uaXN0cDI1NkBvcGVuc3NoLmNvbQAAAAhuaXN0cDI1NgAAAEEE9wqeXlMv9vTp2eSAZhIVw0AWMSKozWbb56LAxmd1pdFw6oX+pnyvfa2SJAlvUjNO2xND0Q5WluXRcN2xUZL0aQAAAARzc2g6AAAAeQAAACJzay1lY2RzYS1zaGEyLW5pc3RwMjU2QG9wZW5zc2guY29tAAAASgAAACEAsTUHdoqr5to8xZpCUBaGNHeFHPadkNd8DM/pTDMy1JUAAAAhAM9uiZS1GWbaWEwbeaHdm0D/kqW+6F3+GB8hhUqkdJ7mAQAAABA= test_ecdsa@picky.com
2 |
--------------------------------------------------------------------------------
/ffi/wasm/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { resolve } from "path";
2 | import { defineConfig } from "vite";
3 | import topLevelAwait from "vite-plugin-top-level-await";
4 | import wasm from "vite-plugin-wasm";
5 | import { viteStaticCopy } from "vite-plugin-static-copy";
6 |
7 | // https://vitejs.dev/config/
8 | export default defineConfig({
9 | build: {
10 | lib: {
11 | entry: resolve(__dirname, "main.ts"),
12 | name: "Picky",
13 | fileName: "picky",
14 | formats: ["es", "umd"],
15 | },
16 | },
17 | plugins: [
18 | wasm(),
19 | topLevelAwait(),
20 | viteStaticCopy({
21 | targets: [
22 | {
23 | src: "./pkg/picky.d.ts",
24 | dest: "./",
25 | },
26 | ],
27 | }),
28 | ],
29 | });
30 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_key_sk_ecdsa_enc:
--------------------------------------------------------------------------------
1 | -----BEGIN OPENSSH PRIVATE KEY-----
2 | b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABBZ
3 | xXIeJ3A/hd0EWiDvdgi8AAAAGAAAAAEAAAB/AAAAInNrLWVjZHNhLXNoYTItbmlz
4 | dHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBNJfxBsDYHSit56ezO1k
5 | ff7YppzMUdQlpCmg4FFaeuz/NwDhIYj/NyYmVjDwdwmQxmPclwjAfTtvi785KArq
6 | MeIAAAAEc3NoOgAAAPBuGyAycr0vZvNt7Jb+IrFNhhm059bVkeaanN5Ez4jhLKBh
7 | NhCfnPHKbpNmT1gxtv51yKNfAa0YIcBGdiTWWp6jItprayQyy664/F34AK341NmW
8 | 5y7SRXY8SMVPnBmDTnx1m+6kz9UBxUw/pLCGXXTRXem6d0ehSuQJff+4sipYR1Up
9 | W/VnL/QqOG4LylJchoTRD0ZJNzq2uE0JsW94+xrYLQZBm3zH7VO3XSuLKGmfX07x
10 | 7GLqTBsFeMntEvTWw9W5TyklUhCZJ+k24SJwRM/Y1YQjdHWNRl5bYTb/kmDUlP0P
11 | 7XRYAF3A79loYtRcC80=
12 | -----END OPENSSH PRIVATE KEY-----
13 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawAttributeTypeAndValueParametersType.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | public enum AttributeTypeAndValueParametersType
15 | {
16 | CommonName = 0,
17 | Surname = 1,
18 | SerialNumber = 2,
19 | CountryName = 3,
20 | LocalityName = 4,
21 | StateOrProvinceName = 5,
22 | StreetName = 6,
23 | OrganizationName = 7,
24 | OrganizationalUnitName = 8,
25 | EmailAddress = 9,
26 | GivenName = 10,
27 | Phone = 11,
28 | Custom = 12,
29 | }
30 |
--------------------------------------------------------------------------------
/picky-asn1/README.md:
--------------------------------------------------------------------------------
1 | [](https://crates.io/crates/picky-asn1)
2 | [](https://docs.rs/picky-asn1)
3 | 
4 |
5 | Compatible with rustc 1.85.
6 | Minimal rustc version bumps happen [only with minor number bumps in this project](https://github.com/Devolutions/picky-rs/issues/89#issuecomment-868303478).
7 |
8 | # picky-asn1
9 |
10 | Defines wrappers for ASN.1 types:
11 | - Integer (as big integer)
12 | - Bit String
13 | - Object Identifier
14 | - Utf8 String
15 | - Numeric String
16 | - Printable String
17 | - IA5 String
18 | - Generalized Time
19 | - UTC Time
20 | - Application Tags from 0 to 15
21 | - Context Tags from 0 to 15
22 |
23 |
--------------------------------------------------------------------------------
/picky-krb/src/crypto/utils.rs:
--------------------------------------------------------------------------------
1 | /// usage | 0xAA
2 | pub fn usage_ke(usage: i32) -> [u8; 5] {
3 | key_usage(usage, 0xAA)
4 | }
5 |
6 | /// usage | 0x99
7 | pub fn usage_kc(usage: i32) -> [u8; 5] {
8 | key_usage(usage, 0x99)
9 | }
10 |
11 | /// usage | 0x55
12 | pub fn usage_ki(usage: i32) -> [u8; 5] {
13 | key_usage(usage, 0x55)
14 | }
15 |
16 | /// https://www.rfc-editor.org/rfc/rfc3961#section-5.3
17 | /// the key usage number, expressed as four octets in big-endian order, followed by one octet
18 | fn key_usage(usage: i32, well_known_constant: u8) -> [u8; 5] {
19 | // 5 = 4 /* usage */ + 1 /* known constant */
20 | let mut result = [0; 5];
21 |
22 | result[0..4].copy_from_slice(&usage.to_be_bytes());
23 | result[4] = well_known_constant;
24 |
25 | result
26 | }
27 |
--------------------------------------------------------------------------------
/picky-krb/src/crypto/common.rs:
--------------------------------------------------------------------------------
1 | use cbc::cipher::Array;
2 | use hmac::digest::crypto_common::KeySizeUser;
3 | use hmac::{Hmac, KeyInit, Mac};
4 | use sha1::Sha1;
5 |
6 | //= [Checksum Profiles Based on Simplified Profile](https://datatracker.ietf.org/doc/html/rfc3961#section-5.4) =//
7 | pub fn hmac_sha1(key: &[u8], payload: &[u8], mac_size: usize) -> Vec {
8 | let mut key = key.to_vec();
9 |
10 | // this Hmac implementation requires 64-byte key
11 | key.resize(Hmac::::key_size(), 0);
12 |
13 | let key = Array::try_from(key.as_slice()).expect("`key` is the right size");
14 | let mut hmacker = Hmac::::new(&key);
15 |
16 | hmacker.update(payload);
17 |
18 | let mut hmac = hmacker.finalize().into_bytes().to_vec();
19 | hmac.resize(mac_size, 0);
20 |
21 | hmac
22 | }
23 |
--------------------------------------------------------------------------------
/ffi/wasm/src/macros.rs:
--------------------------------------------------------------------------------
1 | macro_rules! define_error {
2 | ($name:ident, $ty:ty) => {
3 | #[derive(Debug)]
4 | #[::wasm_bindgen::prelude::wasm_bindgen]
5 | pub struct $name(pub(crate) $ty);
6 |
7 | #[::wasm_bindgen::prelude::wasm_bindgen]
8 | impl $name {
9 | /// Returns the error as a string.
10 | pub fn to_display(&self) -> String {
11 | self.0.to_string()
12 | }
13 |
14 | /// Returns the debug string representation of the error.
15 | pub fn to_debug(&self) -> String {
16 | format!("{self:?}")
17 | }
18 | }
19 |
20 | impl From<$ty> for $name {
21 | fn from(e: $ty) -> Self {
22 | Self(e)
23 | }
24 | }
25 | };
26 | }
27 |
--------------------------------------------------------------------------------
/picky/src/lib.rs:
--------------------------------------------------------------------------------
1 | //! [](https://crates.io/crates/picky)
2 | //! [](https://docs.rs/picky)
3 | //! 
4 | //! # picky
5 | //!
6 | //! Portable X.509, PKI, JOSE and HTTP signature implementation.
7 |
8 | #[cfg(feature = "http_signature")]
9 | pub mod http;
10 |
11 | #[cfg(feature = "jose")]
12 | pub mod jose;
13 |
14 | #[cfg(feature = "x509")]
15 | pub mod x509;
16 |
17 | #[cfg(feature = "ssh")]
18 | pub mod ssh;
19 |
20 | #[cfg(feature = "pkcs12")]
21 | pub mod pkcs12;
22 |
23 | #[cfg(feature = "putty")]
24 | pub mod putty;
25 |
26 | pub mod hash;
27 | pub mod key;
28 | pub mod pem;
29 | pub mod signature;
30 |
31 | pub use picky_asn1_x509::{AlgorithmIdentifier, oid, oids};
32 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawEcParameters.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct EcParameters
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "EcParameters_destroy", ExactSpelling = true)]
24 | public static unsafe extern void Destroy(EcParameters* self);
25 | }
26 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/ssh/ssh_key_p521:
--------------------------------------------------------------------------------
1 | -----BEGIN OPENSSH PRIVATE KEY-----
2 | b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAArAAAABNl
3 | Y2RzYS1zaGEyLW5pc3RwNTIxAAAACG5pc3RwNTIxAAAAhQQBtS0BiRExV9QtwUKD
4 | LSOXOt54AdgCDrnhMZhqI5Dq0EsYtXGczkR2V+ezVbMlnxSOfIZc7DAoTMyO3vNy
5 | +be3FKcAkmY45GEpzcF6W4pTYULuZma262hovywsZkC4En3x7FdoTX4VBBZfOuJw
6 | 6INj+rl6d23/36bXUF4TONBZjbxDvKoAAAEY44LPrOOCz6wAAAATZWNkc2Etc2hh
7 | Mi1uaXN0cDUyMQAAAAhuaXN0cDUyMQAAAIUEAbUtAYkRMVfULcFCgy0jlzreeAHY
8 | Ag654TGYaiOQ6tBLGLVxnM5Edlfns1WzJZ8UjnyGXOwwKEzMjt7zcvm3txSnAJJm
9 | OORhKc3BeluKU2FC7mZmtutoaL8sLGZAuBJ98exXaE1+FQQWXzricOiDY/q5endt
10 | /9+m11BeEzjQWY28Q7yqAAAAQWPJxvMrkumHLZkUy4zKac2b6pzUMSLXSR5YwMF5
11 | 62r6XVKgCUBavSxL99N9uvu9PC6Z4FK7NPBc+0OKZMAFlOL/AAAAFHRlc3RfZWNk
12 | c2FAcGlja3kuY29tAQIDBAUGBw==
13 | -----END OPENSSH PRIVATE KEY-----
14 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/KeyKind.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// Known key kinds
16 | ///
17 | public enum KeyKind
18 | {
19 | ///
20 | /// RSA (Rivest–Shamir–Adleman)
21 | ///
22 | Rsa = 0,
23 | ///
24 | /// Elliptic-curve
25 | ///
26 | Ec = 1,
27 | ///
28 | /// Edwards-curve
29 | ///
30 | Ed = 2,
31 | ///
32 | /// MLDSA (Module-Lattice-Based Digital Signature Algorithm)
33 | ///
34 | Mldsa = 3,
35 | }
36 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawAesAuthEncParams.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct AesAuthEncParams
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "AesAuthEncParams_destroy", ExactSpelling = true)]
24 | public static unsafe extern void Destroy(AesAuthEncParams* self);
25 | }
26 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawKeyKind.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// Known key kinds
16 | ///
17 | public enum KeyKind
18 | {
19 | ///
20 | /// RSA (Rivest–Shamir–Adleman)
21 | ///
22 | Rsa = 0,
23 | ///
24 | /// Elliptic-curve
25 | ///
26 | Ec = 1,
27 | ///
28 | /// Edwards-curve
29 | ///
30 | Ed = 2,
31 | ///
32 | /// MLDSA (Module-Lattice-Based Digital Signature Algorithm)
33 | ///
34 | Mldsa = 3,
35 | }
36 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawRsassaPssParameters.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct RsassaPssParameters
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "RsassaPssParameters_destroy", ExactSpelling = true)]
24 | public static unsafe extern void Destroy(RsassaPssParameters* self);
25 | }
26 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawDirectoryNameIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct DirectoryNameIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "DirectoryNameIterator_destroy", ExactSpelling = true)]
24 | public static unsafe extern void Destroy(DirectoryNameIterator* self);
25 | }
26 |
--------------------------------------------------------------------------------
/picky-asn1-der/src/de/boolean.rs:
--------------------------------------------------------------------------------
1 | use crate::{Asn1DerError, Result};
2 |
3 | /// A deserializer for booleans
4 | pub struct Boolean;
5 | impl Boolean {
6 | /// The deserialized boolean for `data`
7 | pub fn deserialize(data: &[u8]) -> Result {
8 | // Check lengths
9 | if data.is_empty() {
10 | return Err(Asn1DerError::TruncatedData);
11 | }
12 | if data.len() > 1 {
13 | return Err(Asn1DerError::InvalidData);
14 | }
15 |
16 | // Parse the boolean
17 | Ok(match data[0] {
18 | 0x00 => {
19 | debug_log!("false!");
20 | false
21 | }
22 | 0xff => {
23 | debug_log!("true!");
24 | true
25 | }
26 | _ => return Err(Asn1DerError::InvalidData),
27 | })
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/picky/README.md:
--------------------------------------------------------------------------------
1 | [](https://crates.io/crates/picky)
2 | [](https://docs.rs/picky)
3 | 
4 |
5 | Compatible with rustc 1.85.
6 | Minimal rustc version bumps happen [only with minor number bumps in this project](https://github.com/Devolutions/picky-rs/issues/89#issuecomment-868303478).
7 |
8 | # picky
9 |
10 | Portable X.509, PKI, JOSE and HTTP signature implementation.
11 |
12 | ## X.509 / PKI
13 |
14 | [See doc](https://docs.rs/picky/latest/picky/x509/index.html) for tested examples.
15 |
16 | ## HTTP signature
17 |
18 | [See doc](https://docs.rs/picky/latest/picky/http/index.html) for tested examples.
19 |
20 | ## JOSE
21 |
22 | Doc doesn't have example yet, but [tests](https://github.com/Devolutions/picky-rs/blob/master/picky/src/jose/jwt.rs#L438) are good reference.
23 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 |
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 |
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 |
21 | CFBundleShortVersionString
22 | 1.0.0.0
23 | CSResourcesFileMapped
24 |
25 | MinimumOSVersion
26 | 12.1
27 |
28 |
29 |
--------------------------------------------------------------------------------
/picky-test-data/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to this project will be documented in this file.
4 |
5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7 |
8 | ## [Unreleased]
9 |
10 | ### Changed
11 |
12 | - Bump minimal rustc version to 1.85.
13 |
14 | ## [[0.1.1](https://github.com/Devolutions/picky-rs/compare/picky-test-data-v0.1.0...picky-test-data-v0.1.1)] - 2025-01-16
15 |
16 | ### Bug Fixes
17 |
18 | - Symlinks to license files in packages (#339) ([1834c04f39](https://github.com/Devolutions/picky-rs/commit/1834c04f3930fb1bbf040deb6525b166e378b8aa))
19 |
20 | Use symlinks instead of copying files to avoid a “dirty” state during
21 | cargo publish and preserve VCS info. With #337 merged, CI handles
22 | publishing consistently, so developer environments no longer matter.
23 |
24 |
25 |
--------------------------------------------------------------------------------
/ffi/wasm/ava_tests/tests/putty.mjs:
--------------------------------------------------------------------------------
1 | import test from "ava";
2 | import { PuttyPpk } from "@devolutions/picky";
3 |
4 | function key_roundtrip(t, original) {
5 | const original_str = original.to_repr();
6 |
7 | let encrypted = original.encrypt("test");
8 |
9 | let encrypted_str = encrypted.to_repr();
10 |
11 | let encryted_parsed = PuttyPpk.parse(encrypted_str);
12 | let decrypted = encryted_parsed.decrypt("test");
13 |
14 | let after_roundtrip = decrypted.to_repr();
15 |
16 | t.is(after_roundtrip, original_str);
17 | }
18 |
19 | // NOTE: We test only ED25519 case because inner key generation is based on ssh module code
20 | // internally.
21 |
22 | test("Generate and parse ED25519 PuTTY key", (t) => {
23 | try {
24 | const key = PuttyPpk.generate_ed25519("test", "test@picky.com");
25 | key_roundtrip(t, key);
26 | } catch (e) {
27 | if (typeof e.to_display === "undefined") {
28 | throw e;
29 | } else {
30 | throw e.to_display();
31 | }
32 | }
33 | });
34 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/leaf.key:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PRIVATE KEY-----
2 | MIICXwIBAAKBgQDMHvAjdh9RMxDzgIwWr5BAQfbdTFGMhSv+y2K6yYXvBJB4fay1
3 | nWt5zT1FuQYk3CA6mgcGLqnH0b6azyjEuCgtQYtkzqOr3+8z2V2Mrce8sCZV+wB3
4 | W9lmY9W4O2PT8byBJ9Br/1RhtY9PNM7/00Zkk/63tiPyYPKVvwY8/MYg9wIDAQAB
5 | AoGBAMGvEZn0eZ7o38rOTR8xk6UFcqNlyXOW4boxbwtiMW4tXJCYX4stRlAbCWrh
6 | OA09um8gvE2HdZ6fTUdEDqErRSKKX0+7byvgzHBVoilwjFoAMt1DtFGPw7boEeO9
7 | AqgCoXXxS28FmbvobSE9tBX8WJfM92QWPfG46FPTrrkwWOBxAkEA5WzQrLR1hTVm
8 | 4z0AAJWg4Hvy5QR8xCbnMVEb3x9WHO+jGkfK8lPuZYcyu5bhXA1QTLdht7pULmCx
9 | p8r4cNQETQJBAOPDxb5lxo29CBwQf47Qw2hEddB/FO5GKNSKAz2nflg7TJUqG9jf
10 | izBP/4NqNkqSMDUzloUq/KWuK2h54QA5rFMCQQCp+tEw5BMeOs6cFhnmVPX43Fy9
11 | 6XE3M0ufcmSgD2uRzMqfMgnfOOgsONsRuVwHA6Y28LdplJfCNMnrc6pWjf8RAkEA
12 | sddXO8d0NY/4GRG4x+ax7WQnKdlQmowlrW7mAOobeQE0VvQ+MiS6JcsRE6eHJMro
13 | 4WGakfhytVs9gaJI0Ug3CQJBANGwkg84BOwJQMlwiki7EjJDtLy4GSKfSPUGdwd5
14 | fRvAaodhCe8HKJekQn7R1vXlY25pvxtwMdB/bcbU8cmRBv8=
15 | -----END RSA PRIVATE KEY-----
16 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/intermediate.key:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PRIVATE KEY-----
2 | MIICXAIBAAKBgQCnX77qGt9EGjJLCxXAGsrWPNzbHOFkIq2HtFosXoC4q6CjTgQE
3 | JFjIc7Al1pko9a8ncn+ELiUbS/YnZRVFdRC/HgCb8MQ4UReqO1OLfcu5D4wgb6pF
4 | YtUhg55OnBDsCQRf1xO3I1G8MbwBQoFjtB/YoQdbAdGVMw9EgcivUPE8mwIDAQAB
5 | AoGAAzPbzVLyTrVJnRH7Oo/IrczAVRj6XxYix+P1jb/JKr9t9XH6tbGUWVGNX0v5
6 | 5kS9Mz4Hnpnbb+hGL37Jp2iUB2w4vzbUQ6dFJjdAhJP84nJC0GUBP6cegnMovNX0
7 | VR4ASyUxim+Ik+uOtHo785v72PH7+ulq3wQXuDslt0FWATECQQDVJ98YD7MsA9b9
8 | 4LZvybz+FEBQE4BgHqzn7UyecA/mdKgHF6UVBHfxK4t89KySikqw6C5w4gNPKLs/
9 | YYk9odftAkEAyQQhyBJUPqLVMxdowPMyi7Lxt4wFCZ7cymcbkmq/E/uuhsKTrINF
10 | 25aTyy2dbAEnfZxWVccPcqcvQgFmx4TFpwJAKaXJtETVCEOTzTUL0FnFgItqaXr1
11 | +VHlDMfT0Z0priia8A/RpIKkAM42SerwkQ1OPLSQ5mNyrBPUSjT/gLhPnQJBALt3
12 | 3wl4DplbwvmjG07XgIxIlqVXMFuIjOE2x8AFTa6VSm7jiFWbF8ty4uLZ57aSXQII
13 | i3vz6bRDtw8Xv4LTkIECQDz9U8xans+U2dajgil1t8aiO4QVzgS+9N6eyxrQW0jc
14 | ubFY1ebqLMnd5vrHk5zj5fFccjOS7NSb975R/MywwhA=
15 | -----END RSA PRIVATE KEY-----
16 |
--------------------------------------------------------------------------------
/docs/file/csr/csr_pem.adoc:
--------------------------------------------------------------------------------
1 | ----
2 | -----BEGIN CERTIFICATE REQUEST-----
3 | MIICYjCCAUoCAQAwHTEbMBkGA1UEAxMSdGVzdC5jb250b3NvLmxvY2FsMIIBIjAN
4 | BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAym0At2TvEqP0mYVLJzGVpNXjugu/
5 | kBpuKvXt/Vax4Bxnj3YzHTCpwkyZPytUC6zJ+q+uGh0e7gYQsYHJKjgoKEsS6gQ4
6 | ZM3D/AQy0zqPUT0ruSKDWKK4f2d/2ijDs5R2LHj7DtNZBanCXU16Qp1O28su0QZK
7 | OYbXzsJSpHp80dhqD6JUxXlSZzlVBp28CC9ryrE6w+kOQ38TZ1/mBJPsfmDeKBpm
8 | 3FRrfHtWt43eok/T6FhCLIzsqyCZ0UCQqkcLr+TfoftJe2nOHQ1sfk4keJ9iwA/f
9 | hYv5rqUB3RUztSIhExwtYDwd+YovenhsL4sW/kjR29RTLUFPPXAelG9XPwIDAQAB
10 | oAAwDQYJKoZIhvcNAQELBQADggEBAKrCf4sFDBFZQ6CPYdaxe3InMp7KFaueMIB8
11 | /YK73rJ+JGB6fQfltCCkToTE1y0Q3UqTlqHmaqdoh0KMWue6jCFvBat4/TUqUG7W
12 | tRLDP67eMulolcIzLqwTjR38DVJvnwrd2pey43q3UHBjlStxT/gI4ysQHn4qrzHB
13 | 6OK9O6ypqTtwXxnm3TJF9dctLwvbh7NZSaamSlxI0/ajKZOP9k1KZEOPtaiiMPe2
14 | yr+QvwY2ov66MRG5PPRZELQWBaPZOuFwmCsFOLXJMpvhoAgklBCFZmiQMgApGIC1
15 | FIDgjm2ZhQQIRMnTsAV6f7BclRTaUkc0sPl17YB9GfNfOm1oL7o=
16 | -----END CERTIFICATE REQUEST-----
17 | ----
18 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/certification_request.csr:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE REQUEST-----
2 | MIICYjCCAUoCAQAwHTEbMBkGA1UEAxMSdGVzdC5jb250b3NvLmxvY2FsMIIBIjAN
3 | BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAym0At2TvEqP0mYVLJzGVpNXjugu/
4 | kBpuKvXt/Vax4Bxnj3YzHTCpwkyZPytUC6zJ+q+uGh0e7gYQsYHJKjgoKEsS6gQ4
5 | ZM3D/AQy0zqPUT0ruSKDWKK4f2d/2ijDs5R2LHj7DtNZBanCXU16Qp1O28su0QZK
6 | OYbXzsJSpHp80dhqD6JUxXlSZzlVBp28CC9ryrE6w+kOQ38TZ1/mBJPsfmDeKBpm
7 | 3FRrfHtWt43eok/T6FhCLIzsqyCZ0UCQqkcLr+TfoftJe2nOHQ1sfk4keJ9iwA/f
8 | hYv5rqUB3RUztSIhExwtYDwd+YovenhsL4sW/kjR29RTLUFPPXAelG9XPwIDAQAB
9 | oAAwDQYJKoZIhvcNAQELBQADggEBAKrCf4sFDBFZQ6CPYdaxe3InMp7KFaueMIB8
10 | /YK73rJ+JGB6fQfltCCkToTE1y0Q3UqTlqHmaqdoh0KMWue6jCFvBat4/TUqUG7W
11 | tRLDP67eMulolcIzLqwTjR38DVJvnwrd2pey43q3UHBjlStxT/gI4ysQHn4qrzHB
12 | 6OK9O6ypqTtwXxnm3TJF9dctLwvbh7NZSaamSlxI0/ajKZOP9k1KZEOPtaiiMPe2
13 | yr+QvwY2ov66MRG5PPRZELQWBaPZOuFwmCsFOLXJMpvhoAgklBCFZmiQMgApGIC1
14 | FIDgjm2ZhQQIRMnTsAV6f7BclRTaUkc0sPl17YB9GfNfOm1oL7o=
15 | -----END CERTIFICATE REQUEST-----
--------------------------------------------------------------------------------
/release.toml:
--------------------------------------------------------------------------------
1 | enable-all-features = true
2 |
3 | tag-prefix = "{{crate_name}}-"
4 | tag-name = "{{prefix}}{{version}}"
5 | tag-message = "{{crate_name}} v{{version}} release"
6 |
7 | pre-release-commit-message = "{{crate_name}}: bump to {{version}}"
8 | pre-release-replacements = [
9 | { file = "CHANGELOG.md", search = "Unreleased", replace = "{{version}}", exactly = 1 },
10 | { file = "CHANGELOG.md", search = "\\.\\.\\.HEAD", replace = "...{{tag_name}}", exactly = 1 },
11 | { file = "CHANGELOG.md", search = "ReleaseDate", replace = "{{date}}", exactly = 1 },
12 | { file = "CHANGELOG.md", search = "", replace = "\n\n## [Unreleased] – ReleaseDate", exactly = 1 },
13 | { file = "CHANGELOG.md", search = "", replace = "\n[Unreleased]: https://github.com/Devolutions/picky-rs/compare/{{tag_name}}...HEAD", exactly = 1 },
14 | ]
15 |
16 | post-release-commit-message = "{{crate_name}}: start next iteration {{next_version}}"
17 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/ca.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAOY6dDK51FqL1UXh
3 | QD2vs2Igk8S0jm2gBDJ56DU5yXkY1Ln2znXq7ntILwYUhE91uk8BR4vsycxaxzRS
4 | xvePj6BdhWnYuceaSfwyJ20g1yBn0C5mHcN/fvSqaH7Np9Ax2U+N36QiWJu0ERDf
5 | OtkQVTEubg/Mf9gE+74yDjWiUcIrAgMBAAECgYB8J52uFUSNJ8d1jclk+rFUA5ls
6 | hKoiOB7LUa6FtYoOwfNF7fDc6jp9RSoGr13CtAwqutfof2M7zuCKOPGPY13h6XNF
7 | 9D36BFlsRCCHrdJjpG6/Pa5OZpoz5yuMjwKhfJ3YvEMsUAkFhk+b1YnTBfZAzfEe
8 | eCsvm2J/8sDg8l1dsQJBAPSz/TrCmzJ7IMHzoVjtdkIxlWomE4w1l/akeo6LIZH5
9 | iIphvTWA9Lumuqd292+ANn8bhkwE94ZogyMfaNEtdwcCQQDw22VKRkkAIOg7zAqb
10 | yOnTbo+fXqzFZt5WJ5LEBZJdpPNJAEulBUZnn7wgKxUwZ0riL9Z2SJvOsAG5YYoU
11 | rY69AkEAw7oD3rAx+trJhNkeQUcOxDtsy47RK+DiQAGnlcRrgZsaP7WV5enT1xSx
12 | T6m0mJbxABJABSYj5npKChnheQ7omQJAP7VYon/a2Vza8M401CYdq15oQPhy7Lgc
13 | AV/wU0dCAuEZtOqOF7VAfTJkOYIL1cTMqu2KZbko9U/a9OUW+Ac8ZQJBAJ/aGre2
14 | Efg2qwN3WGK2Ed+OmPgjyiVwozXR6kQ5dn9WEAq3CL+j8Z8JhOet2WuKdsFEKFsd
15 | tp0MPY1cZDhRf3s=
16 | -----END PRIVATE KEY-----
17 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawRsString.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct RsString
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "RsString_from_string", ExactSpelling = true)]
24 | public static unsafe extern RsString* FromString(byte* s, nuint sSz);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "RsString_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(RsString* self);
28 | }
29 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # picky-rs
2 |
3 | Collection of crates related to cryptographic primitives, ASN.1 and PKI.
4 | See each folder for individual description.
5 |
6 | ## Release workflow
7 |
8 | - Create a new branch
9 | - Make sure dependencies are up to date (`cargo upgrade` from [cargo-edit](https://crates.io/crates/cargo-edit#cargo-upgrade) companion will help)
10 | - Make sure CHANGELOG.md files are up to date
11 | - Open Pull Request for review
12 | - Once CI is green and PR is approved, use [cargo-release](https://github.com/crate-ci/cargo-release) for each crate to release
13 | - `cargo release -rc.` to release a new candidate version (do not finalize changelog)
14 | - `cargo release`, `cargo release patch`, `cargo release minor`, or `cargo release major` as appropriate otherwise. Refer to cargo-release's [reference](https://github.com/crate-ci/cargo-release/blob/master/docs/reference.md)
15 | - Merge PR _using merge_ commit to _preserve commits hash_
16 |
17 | (TODO: move the last two steps to GitHub Actions)
18 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawCertIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct CertIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "CertIterator_next", ExactSpelling = true)]
24 | public static unsafe extern Cert* Next(CertIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "CertIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(CertIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawVecU8Iterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct VecU8Iterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "VecU8Iterator_next", ExactSpelling = true)]
24 | public static unsafe extern VecU8* Next(VecU8Iterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "VecU8Iterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(VecU8Iterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/PickyErrorKind.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// Kind associated to a Picky Error
16 | ///
17 | public enum PickyErrorKind
18 | {
19 | ///
20 | /// Generic Picky error
21 | ///
22 | Generic = 0,
23 | ///
24 | /// Token or certificate not yet valid
25 | ///
26 | NotYetValid = 1,
27 | ///
28 | /// Token or certificate expired
29 | ///
30 | Expired = 2,
31 | ///
32 | /// Bad signature for token or certificate
33 | ///
34 | BadSignature = 3,
35 | ///
36 | /// MAC validation failed (wrong password or corrupted data)
37 | ///
38 | Pkcs12MacValidation = 4,
39 | }
40 |
--------------------------------------------------------------------------------
/ffi/wasm/README.md:
--------------------------------------------------------------------------------
1 | # Picky WASM
2 |
3 | JavaScript bindings to [`picky`](https://github.com/Devolutions/picky-rs/tree/master/picky) using wasm-bindgen.
4 |
5 | ## Build & publish
6 |
7 | This should be run in the CI.
8 |
9 | 1. Install [`wasm-pack`](https://rustwasm.github.io/wasm-pack/installer/).
10 |
11 | 2. Build the package:
12 |
13 | ```
14 | $ npm run build
15 | ```
16 |
17 | 3. Publish to npm:
18 |
19 | ```
20 | $ npm publish
21 | ```
22 |
23 | ## Testing
24 |
25 | Some tests can be in Firefox in headless mode:
26 |
27 | ```
28 | $ wasm-pack test --headless --firefox
29 | ```
30 |
31 | Other tests are run using `nodejs` and the `ava` testing framework.
32 | For these, you need to build the npm package targeting `nodejs`:
33 |
34 | ```
35 | $ wasm-pack build --target nodejs --scope @devolutions --out-name picky
36 | ```
37 |
38 | Rename `@devolutions/picky-wasm` to `@devolutions/picky` in `pkg/package.json`.
39 |
40 | Run the `ava` tests
41 |
42 | ```
43 | cd ava_tests
44 | npm install
45 | npm test
46 | ```
47 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawSafeBagIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct SafeBagIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SafeBagIterator_next", ExactSpelling = true)]
24 | public static unsafe extern SafeBag* Next(SafeBagIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SafeBagIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(SafeBagIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawUTCTimeIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct UTCTimeIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "UTCTimeIterator_next", ExactSpelling = true)]
24 | public static unsafe extern UTCTime* Next(UTCTimeIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "UTCTimeIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(UTCTimeIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/picky-krb/src/crypto/des/mod.rs:
--------------------------------------------------------------------------------
1 | pub(crate) mod decrypt;
2 | pub(crate) mod des3_cbc_sha1_kd;
3 | pub(crate) mod encrypt;
4 | pub(crate) mod hmac_sha1_des3_kd;
5 | mod key_derivation;
6 |
7 | /// [Triple-DES Based Encryption](https://datatracker.ietf.org/doc/html/rfc3961#section-6.3)
8 | /// message block size = 8 bytes
9 | pub const DES3_BLOCK_SIZE: usize = 8;
10 | /// [Triple-DES Based Encryption](https://datatracker.ietf.org/doc/html/rfc3961#section-6.3)
11 | /// protocol key format = 24 bytes
12 | pub const DES3_KEY_SIZE: usize = 24;
13 | /// [Triple-DES Based Encryption](https://datatracker.ietf.org/doc/html/rfc3961#section-6.3)
14 | /// HMAC output size = 160 bits
15 | pub const DES3_MAC_SIZE: usize = 20;
16 | /// [Triple-DES Based Encryption](https://datatracker.ietf.org/doc/html/rfc3961#section-6.3)
17 | /// key-generation seed length = 21 bytes
18 | pub const DES3_SEED_LEN: usize = 21;
19 |
20 | pub use des3_cbc_sha1_kd::Des3CbcSha1Kd;
21 | pub use hmac_sha1_des3_kd::HmacSha1Des3Kd;
22 | pub use key_derivation::{derive_key, derive_key_from_password};
23 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawOidIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct OidIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OidIterator_next", ExactSpelling = true)]
24 | public static unsafe extern IntPtr Next(OidIterator* self, DiplomatWriteable* writable);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OidIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(OidIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawPickyErrorKind.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// Kind associated to a Picky Error
16 | ///
17 | public enum PickyErrorKind
18 | {
19 | ///
20 | /// Generic Picky error
21 | ///
22 | Generic = 0,
23 | ///
24 | /// Token or certificate not yet valid
25 | ///
26 | NotYetValid = 1,
27 | ///
28 | /// Token or certificate expired
29 | ///
30 | Expired = 2,
31 | ///
32 | /// Bad signature for token or certificate
33 | ///
34 | BadSignature = 3,
35 | ///
36 | /// MAC validation failed (wrong password or corrupted data)
37 | ///
38 | Pkcs12MacValidation = 4,
39 | }
40 |
--------------------------------------------------------------------------------
/picky-asn1-x509/src/lib.rs:
--------------------------------------------------------------------------------
1 | #[macro_use]
2 | mod macros;
3 |
4 | pub mod algorithm_identifier;
5 | pub mod attribute;
6 | pub mod attribute_type_and_value;
7 | pub mod certificate;
8 | pub mod certification_request;
9 | pub mod directory_string;
10 | pub mod extension;
11 | pub mod name;
12 | pub mod oids;
13 | #[cfg(feature = "pkcs12")]
14 | pub mod pkcs12;
15 | #[cfg(feature = "pkcs7")]
16 | pub mod pkcs7;
17 | pub mod private_key_info;
18 | pub mod signature;
19 | pub mod subject_public_key_info;
20 | pub mod validity;
21 | pub mod version;
22 |
23 | pub use algorithm_identifier::*;
24 | pub use attribute::*;
25 | pub use attribute_type_and_value::*;
26 | pub use certificate::*;
27 | pub use certification_request::*;
28 | pub use directory_string::*;
29 | pub use extension::*;
30 | pub use name::*;
31 | #[cfg(feature = "pkcs7")]
32 | pub use pkcs7::*;
33 | pub use private_key_info::*;
34 | pub use subject_public_key_info::*;
35 | pub use validity::*;
36 | pub use version::*;
37 |
38 | // Re-export `oid` crate as we use it in crate public API
39 | pub use oid;
40 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawAttributeIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct AttributeIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "AttributeIterator_next", ExactSpelling = true)]
24 | public static unsafe extern Attribute* Next(AttributeIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "AttributeIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(AttributeIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawExtensionIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct ExtensionIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "ExtensionIterator_next", ExactSpelling = true)]
24 | public static unsafe extern Extension* Next(ExtensionIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "ExtensionIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(ExtensionIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawSignerInfoIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct SignerInfoIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SignerInfoIterator_next", ExactSpelling = true)]
24 | public static unsafe extern SignerInfo* Next(SignerInfoIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SignerInfoIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(SignerInfoIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawStringIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct StringIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "StringIterator_next", ExactSpelling = true)]
24 | public static unsafe extern IntPtr Next(StringIterator* self, DiplomatWriteable* writable);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "StringIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(StringIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/setup-git-hooks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | PRE_COMMIT_HOOK=./.git/hooks/pre-commit
4 |
5 | if test -f "$PRE_COMMIT_HOOK"; then
6 | echo "$(tput setaf 1)$PRE_COMMIT_HOOK already exists"
7 | exit 1
8 | fi
9 |
10 | echo "#!/bin/sh
11 | git stash -q --keep-index
12 |
13 | ret=0
14 |
15 | cargo +stable fmt --all -- --check 2> /dev/null
16 |
17 | if ! [ \$? -eq 0 ] ; then
18 | ret=1
19 | printf \"\n\$(tput setaf 3)Bad formatting, please run 'cargo +stable fmt' and stage modifications\n\n\"
20 | fi
21 |
22 | cargo clippy -- -D warnings
23 |
24 | if ! [ \$? -eq 0 ] ; then
25 | ret=1
26 | printf \"\n\$(tput setaf 3)Fix clippy lints and stage modifications\n\n\"
27 | fi
28 |
29 | if ! [ \$ret -eq 0 ] ; then
30 | printf \"\$(tput setaf 1)Git pre-commit hook failed.\$(tput sgr0)\n\"
31 | printf \"Alternatively, \\\`--no-verify\\\` or \\\`-n\\\` option may be used to bypass the pre-commit hook.\n\"
32 | fi
33 |
34 | git stash pop -q
35 |
36 | exit \$ret" > "$PRE_COMMIT_HOOK"
37 | chmod +x "$PRE_COMMIT_HOOK"
38 | echo "$(tput setaf 2)$PRE_COMMIT_HOOK created"
39 |
40 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawGeneralNameIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct GeneralNameIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "GeneralNameIterator_next", ExactSpelling = true)]
24 | public static unsafe extern GeneralName* Next(GeneralNameIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "GeneralNameIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(GeneralNameIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawStringNestedIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct StringNestedIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "StringNestedIterator_next", ExactSpelling = true)]
24 | public static unsafe extern StringIterator* Next(StringNestedIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "StringNestedIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(StringNestedIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawMsCounterSignIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct MsCounterSignIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "MsCounterSignIterator_next", ExactSpelling = true)]
24 | public static unsafe extern MsCounterSign* Next(MsCounterSignIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "MsCounterSignIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(MsCounterSignIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawSpcSpOpusInfoIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct SpcSpOpusInfoIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SpcSpOpusInfoIterator_next", ExactSpelling = true)]
24 | public static unsafe extern SpcSpOpusInfo* Next(SpcSpOpusInfoIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SpcSpOpusInfoIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(SpcSpOpusInfoIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawRevocationInfoChoice.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct RevocationInfoChoice
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "RevocationInfoChoice_get_crl", ExactSpelling = true)]
24 | public static unsafe extern CertificateList* GetCrl(RevocationInfoChoice* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "RevocationInfoChoice_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(RevocationInfoChoice* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawPkcs12AttributeIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct Pkcs12AttributeIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "Pkcs12AttributeIterator_next", ExactSpelling = true)]
24 | public static unsafe extern Pkcs12Attribute* Next(Pkcs12AttributeIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "Pkcs12AttributeIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(Pkcs12AttributeIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/LICENSE-MIT:
--------------------------------------------------------------------------------
1 | Permission is hereby granted, free of charge, to any
2 | person obtaining a copy of this software and associated
3 | documentation files (the "Software"), to deal in the
4 | Software without restriction, including without
5 | limitation the rights to use, copy, modify, merge,
6 | publish, distribute, sublicense, and/or sell copies of
7 | the Software, and to permit persons to whom the Software
8 | is furnished to do so, subject to the following
9 | conditions:
10 |
11 | The above copyright notice and this permission notice
12 | shall be included in all copies or substantial portions
13 | of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
16 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
17 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
18 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
19 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
22 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 | DEALINGS IN THE SOFTWARE.
24 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawBufferTooSmallError.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct BufferTooSmallError
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "BufferTooSmallError_to_display", ExactSpelling = true)]
24 | public static unsafe extern void ToDisplay(BufferTooSmallError* self, DiplomatWriteable* writeable);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "BufferTooSmallError_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(BufferTooSmallError* self);
28 | }
29 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/leaf.cer:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIICyDCCAjGgAwIBAgIGASNFZwmsMA0GCSqGSIb3DQEBCwUAMGExCzAJBgNVBAYT
3 | AkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRn
4 | aXRzIFB0eSBMdGQxGjAYBgNVBAMMEVBpY2t5SW50ZXJtZWRpYXRlMB4XDTIyMDIx
5 | NDIwMDQyM1oXDTIzMDIxNDIwMDQyM1owWTELMAkGA1UEBhMCQVUxEzARBgNVBAgM
6 | ClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDES
7 | MBAGA1UEAwwJUGlja3lMZWFmMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDM
8 | HvAjdh9RMxDzgIwWr5BAQfbdTFGMhSv+y2K6yYXvBJB4fay1nWt5zT1FuQYk3CA6
9 | mgcGLqnH0b6azyjEuCgtQYtkzqOr3+8z2V2Mrce8sCZV+wB3W9lmY9W4O2PT8byB
10 | J9Br/1RhtY9PNM7/00Zkk/63tiPyYPKVvwY8/MYg9wIDAQABo4GSMIGPMHUGA1Ud
11 | IwRuMGyhYqRgMF4xCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw
12 | HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxFzAVBgNVBAMMDlBpY2t5
13 | QXV0aG9yaXR5ggYBI0VnCaswCQYDVR0TBAIwADALBgNVHQ8EBAMCBPAwDQYJKoZI
14 | hvcNAQELBQADgYEAcJ6HvO8QkEYEzaEiMoLQXTmLBSkPvzd2171OjlsUuKAyRG0R
15 | KwFx7xxa3ciPX7m5Lb6neRqWUty5YrqFCgyiKtaz+Au71B8+Iv/8URVGSTP62CTW
16 | wArZBon9z/2I07k20f+oXznMUR6bgkyawwQpxWmGxyAbni7vnZYE7qu4MoQ=
17 | -----END CERTIFICATE-----
18 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawUnsignedAttributeIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct UnsignedAttributeIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "UnsignedAttributeIterator_next", ExactSpelling = true)]
24 | public static unsafe extern UnsignedAttribute* Next(UnsignedAttributeIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "UnsignedAttributeIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(UnsignedAttributeIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawCertificateChoicesIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct CertificateChoicesIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "CertificateChoicesIterator_next", ExactSpelling = true)]
24 | public static unsafe extern CertificateChoices* Next(CertificateChoicesIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "CertificateChoicesIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(CertificateChoicesIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawIssuerAndSerialNumber.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct IssuerAndSerialNumber
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "IssuerAndSerialNumber_get_issuer", ExactSpelling = true)]
24 | public static unsafe extern IntPtr GetIssuer(IssuerAndSerialNumber* self, DiplomatWriteable* writable);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "IssuerAndSerialNumber_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(IssuerAndSerialNumber* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawRevokedCertificateIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct RevokedCertificateIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "RevokedCertificateIterator_next", ExactSpelling = true)]
24 | public static unsafe extern RevokedCertificate* Next(RevokedCertificateIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "RevokedCertificateIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(RevokedCertificateIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawAlgorithmIdentifierIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct AlgorithmIdentifierIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "AlgorithmIdentifierIterator_next", ExactSpelling = true)]
24 | public static unsafe extern AlgorithmIdentifier* Next(AlgorithmIdentifierIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "AlgorithmIdentifierIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(AlgorithmIdentifierIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/picky-asn1/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "picky-asn1"
3 | version = "0.10.1"
4 | edition = "2024"
5 | rust-version = "1.85"
6 | authors = [
7 | "Benoît CORTIER ",
8 | "Alexandr Yusuk ",
9 | "Brian Maher",
10 | ]
11 | keywords = ["serde", "asn1", "serialize", "deserialize"]
12 | categories = ["encoding"]
13 | description = "Provide ASN.1 simple types"
14 | license = "MIT OR Apache-2.0"
15 | repository = "https://github.com/Devolutions/picky-rs"
16 | readme = "README.md"
17 |
18 | [dependencies]
19 | serde = { version = "1", default-features = false, features = ["derive"] }
20 | oid = { version = "0.2", default-features = false, features = ["serde_support"] }
21 | serde_bytes = "0.11"
22 | chrono = { version = "0.4", default-features = false, optional = true }
23 | time = { version = "0.3", optional = true }
24 | zeroize = { version = "1.8", optional = true }
25 |
26 | [dev-dependencies]
27 | picky-asn1-der = { path = "../picky-asn1-der", version = "0.5" }
28 |
29 | [features]
30 | chrono_conversion = ["chrono"]
31 | time_conversion = ["time"]
32 | zeroize = ["dep:zeroize"]
33 |
--------------------------------------------------------------------------------
/picky-krb/README.md:
--------------------------------------------------------------------------------
1 | [](https://crates.io/crates/picky-krb)
2 | [](https://docs.rs/picky-krb)
3 | 
4 |
5 | Compatible with rustc 1.85.
6 | Minimal rustc version bumps happen [only with minor number bumps in this project](https://github.com/Devolutions/picky-rs/issues/89#issuecomment-868303478).
7 |
8 | # picky-krb
9 |
10 | Provides implementation for types defined in [RFC 4120](https://www.rfc-editor.org/rfc/rfc4120.txt).
11 |
12 | ## Serializing and deserializing Kerberos structures
13 |
14 | Use `picky_asn1_der::from_bytes` for deserialization from binary, for example:
15 |
16 | ```rust
17 | use picky_krb::messages::AsRep;
18 | let as_rep: AsRep = picky_asn1_der::from_bytes(&raw).unwrap();
19 | ```
20 |
21 | And `picky_asn1_der::to_vec` for serialization to binary, for example:
22 |
23 | ```rust
24 | use picky_krb::messages::TgsReq;
25 | let tgs_req: TgsReq = picky_asn1_der::from_bytes(&raw).unwrap();
26 | let tgs_req_encoded = picky_asn1_der::to_vec(&tgs_req).unwrap();
27 | ```
28 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawEncapsulatedContentInfo.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct EncapsulatedContentInfo
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "EncapsulatedContentInfo_content_type", ExactSpelling = true)]
24 | public static unsafe extern IntPtr ContentType(EncapsulatedContentInfo* self, DiplomatWriteable* writable);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "EncapsulatedContentInfo_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(EncapsulatedContentInfo* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawRevocationInfoChoiceIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct RevocationInfoChoiceIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "RevocationInfoChoiceIterator_next", ExactSpelling = true)]
24 | public static unsafe extern RevocationInfoChoice* Next(RevocationInfoChoiceIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "RevocationInfoChoiceIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(RevocationInfoChoiceIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky.Tests/Devolutions.Picky.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6
5 | latest
6 | enable
7 | false
8 |
9 |
10 |
11 |
12 |
13 |
14 | runtime; build; native; contentfiles; analyzers; buildtransitive
15 | all
16 |
17 |
18 | runtime; build; native; contentfiles; analyzers; buildtransitive
19 | all
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawAttributeTypeAndValueIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct AttributeTypeAndValueIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "AttributeTypeAndValueIterator_next", ExactSpelling = true)]
24 | public static unsafe extern AttributeTypeAndValue* Next(AttributeTypeAndValueIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "AttributeTypeAndValueIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(AttributeTypeAndValueIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/intermediate.cer:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIC3DCCAkWgAwIBAgIGASNFZwmrMA0GCSqGSIb3DQEBCwUAMF4xCzAJBgNVBAYT
3 | AkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRn
4 | aXRzIFB0eSBMdGQxFzAVBgNVBAMMDlBpY2t5QXV0aG9yaXR5MB4XDTIyMDIxNDIw
5 | MDMwNFoXDTIzMDIxNDIwMDMwNFowYTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNv
6 | bWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEaMBgG
7 | A1UEAwwRUGlja3lJbnRlcm1lZGlhdGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ
8 | AoGBAKdfvuoa30QaMksLFcAaytY83Nsc4WQirYe0WixegLiroKNOBAQkWMhzsCXW
9 | mSj1rydyf4QuJRtL9idlFUV1EL8eAJvwxDhRF6o7U4t9y7kPjCBvqkVi1SGDnk6c
10 | EOwJBF/XE7cjUbwxvAFCgWO0H9ihB1sB0ZUzD0SByK9Q8TybAgMBAAGjgaEwgZ4w
11 | gYMGA1UdIwR8MHqhYqRgMF4xCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0
12 | YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxFzAVBgNVBAMM
13 | DlBpY2t5QXV0aG9yaXR5ghRHtCBm8a+AbXk/+4biE8XTV3pZDjAJBgNVHRMEAjAA
14 | MAsGA1UdDwQEAwIE8DANBgkqhkiG9w0BAQsFAAOBgQBDy1PtXZVaOaILbwj316eX
15 | 9LVKPJOykEy7Y+vXe7VxzVgJyAUi9+4kRO8QHGh60bmzAHpaL8CW6DfKW9CunCM3
16 | ls/j021RFa/1a/F7HBoHUZjFUfXItYUqQ4576/l8BzqIXYH7nmAAn/4xOKv5HSkA
17 | xu3MRYxJ/iM1O3oJrknwTw==
18 | -----END CERTIFICATE-----
19 |
--------------------------------------------------------------------------------
/ffi/js/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@devolutions/picky",
3 | "version": "0.0.0",
4 | "description": "Picky JavaScript bindings via WebAssembly",
5 | "author": "Devolutions Inc. Developers",
6 | "license": "MIT OR Apache-2.0",
7 | "repository": {
8 | "type": "git",
9 | "url": "git+https://github.com/Devolutions/picky-rs.git"
10 | },
11 | "bugs": {
12 | "url": "https://github.com/Devolutions/picky-rs/issues"
13 | },
14 | "homepage": "https://github.com/Devolutions/picky-rs#readme",
15 | "keywords": [
16 | "x509",
17 | "jwt",
18 | "signature",
19 | "jose",
20 | "pki"
21 | ],
22 | "type": "module",
23 | "main": "index.js",
24 | "module": "main.js",
25 | "directories": {
26 | "doc": "docs",
27 | "example": "example",
28 | "lib": "api",
29 | "test": "tests"
30 | },
31 | "scripts": {
32 | "build": "tsc",
33 | "test": "ava"
34 | },
35 | "devDependencies": {
36 | "ava": "^3.15.0",
37 | "esm": "^3.2.25",
38 | "typescript": "^4.7.4"
39 | },
40 | "ava": {
41 | "files": [
42 | "tests/*.mjs"
43 | ],
44 | "require": [
45 | "esm"
46 | ]
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawU8.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | ///
15 | /// TODO: this could be fixed with future diplomat-tool Diplomat disallow Opion where T is a primitive type, so we need to wrap it in a pointer
16 | ///
17 | [StructLayout(LayoutKind.Sequential)]
18 | public partial struct U8
19 | {
20 | #if __IOS__
21 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
22 | #else
23 | private const string NativeLib = "DevolutionsPicky";
24 | #endif
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "U8_get_value", ExactSpelling = true)]
27 | public static unsafe extern byte GetValue(U8* self);
28 |
29 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "U8_destroy", ExactSpelling = true)]
30 | public static unsafe extern void Destroy(U8* self);
31 | }
32 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/pkcs12/ca.cer:
--------------------------------------------------------------------------------
1 | -----BEGIN TRUSTED CERTIFICATE-----
2 | MIIC6jCCAlOgAwIBAgIUR7QgZvGvgG15P/uG4hPF01d6WQ4wDQYJKoZIhvcNAQEL
3 | BQAwXjELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
4 | GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAwwOUGlja3lBdXRob3Jp
5 | dHkwHhcNMjIwMjE0MTkyOTEwWhcNMjMwMjE0MTkyOTEwWjBeMQswCQYDVQQGEwJB
6 | VTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0
7 | cyBQdHkgTHRkMRcwFQYDVQQDDA5QaWNreUF1dGhvcml0eTCBnzANBgkqhkiG9w0B
8 | AQEFAAOBjQAwgYkCgYEA5jp0MrnUWovVReFAPa+zYiCTxLSObaAEMnnoNTnJeRjU
9 | ufbOderue0gvBhSET3W6TwFHi+zJzFrHNFLG94+PoF2Fadi5x5pJ/DInbSDXIGfQ
10 | LmYdw39+9Kpofs2n0DHZT43fpCJYm7QREN862RBVMS5uD8x/2AT7vjIONaJRwisC
11 | AwEAAaOBpDCBoTCBgwYDVR0jBHwweqFipGAwXjELMAkGA1UEBhMCQVUxEzARBgNV
12 | BAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0
13 | ZDEXMBUGA1UEAwwOUGlja3lBdXRob3JpdHmCFEe0IGbxr4BteT/7huITxdNXelkO
14 | MAwGA1UdEwQFMAMBAf8wCwYDVR0PBAQDAgTwMA0GCSqGSIb3DQEBCwUAA4GBAIcC
15 | X22rqn454gf4uEchfI89ZqjEAq0hFIhRFoqrrMGS/K5StvHStkVOf5ddS+Wmr8NG
16 | Ahj0WpxvAVrWvngQa7Q/UWCpcb3hYtlLmHNPmg7GApIGgFjbJHTdlqYyV9w56uoJ
17 | mE5yvna01aCDJ87iUswr4T3FwLA4gWoQQa6Kw3QB
18 | -----END TRUSTED CERTIFICATE-----
19 |
--------------------------------------------------------------------------------
/picky-asn1-der/tests/pki_tests/check_macro.rs:
--------------------------------------------------------------------------------
1 | macro_rules! check {
2 | ($item:ident: $type:ident in $encoded:ident[$start:literal..$end:literal]) => {
3 | let encoded = &$encoded[$start..$end];
4 | check!($item: $type in encoded);
5 | };
6 | ($item:ident: $type:ident in $encoded:ident) => {
7 | let encoded = &$encoded[..];
8 |
9 | println!(concat!(stringify!($item), " check..."));
10 |
11 | let serialized = picky_asn1_der::to_vec(&$item).expect(concat!(
12 | "failed ",
13 | stringify!($item),
14 | " serialization"
15 | ));
16 | pretty_assertions::assert_eq!(
17 | serialized, encoded,
18 | concat!("serialized ", stringify!($item), " doesn't match")
19 | );
20 |
21 | let deserialized: $type = picky_asn1_der::from_bytes(encoded).expect(concat!(
22 | "failed ",
23 | stringify!($item),
24 | " deserialization"
25 | ));
26 | pretty_assertions::assert_eq!(
27 | deserialized, $item,
28 | concat!("deserialized ", stringify!($item), " doesn't match")
29 | );
30 | };
31 | }
32 |
--------------------------------------------------------------------------------
/ffi/README.md:
--------------------------------------------------------------------------------
1 | # Picky FFI
2 |
3 | This crate exposes a C-compatible API. Bindings are auto-generated.
4 |
5 | ## Native library build
6 |
7 | Build is as simple as:
8 |
9 | ```
10 | $ cargo build -p picky-ffi
11 | ```
12 |
13 | or
14 |
15 | ```
16 | $ cargo build -p picky-ffi --release
17 | ```
18 |
19 | Binary will be generated inside `target` folder located at workspace root.
20 |
21 | ## C# .NET bindings
22 |
23 | C# .NET bindings are located in the `./dotnet/` folder.
24 | [`Diplomat`](https://github.com/rust-diplomat/diplomat) is used to generate most of the code.
25 |
26 | ## Justfile
27 |
28 | A [justfile](https://github.com/casey/just) is provided to run common commands useful at developement time.
29 |
30 | The appropriate version of `Diplomat`'s tool can be installed with:
31 |
32 | ```
33 | $ just diplomat-install
34 | ```
35 |
36 | Commands for generating the bindings are issued with:
37 |
38 | ```
39 | $ just bindings
40 | ```
41 |
42 | Sanity tests are run with:
43 |
44 | ```
45 | $ just test
46 | ```
47 |
48 | On Windows, run `just` with `--shell powershell.exe --shell-arg -c`.
49 | For instance:
50 | ```
51 | $ just --shell powershell.exe --shell-arg -c test
52 | ```
53 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawAttributeTypeAndValueNestedIterator.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct AttributeTypeAndValueNestedIterator
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "AttributeTypeAndValueNestedIterator_next", ExactSpelling = true)]
24 | public static unsafe extern AttributeTypeAndValueIterator* Next(AttributeTypeAndValueNestedIterator* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "AttributeTypeAndValueNestedIterator_destroy", ExactSpelling = true)]
27 | public static unsafe extern void Destroy(AttributeTypeAndValueNestedIterator* self);
28 | }
29 |
--------------------------------------------------------------------------------
/picky-asn1-der/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "picky-asn1-der"
3 | version = "0.5.4"
4 | edition = "2024"
5 | rust-version = "1.85"
6 | authors = [
7 | "KizzyCode Software Labs./Keziah Biermann ",
8 | "Benoît CORTIER ",
9 | "Alexandr Yusuk ",
10 | ]
11 | keywords = ["serde", "asn1", "asn1-der", "serialize", "deserialize"]
12 | categories = ["encoding"]
13 | description = "An ASN.1-DER subset for serde"
14 | license = "MIT OR Apache-2.0"
15 | repository = "https://github.com/Devolutions/picky-rs"
16 | readme = "README.md"
17 | include = ["src/**/*", "README.md", "CHANGELOG.md", "LICENSE-*"]
18 |
19 | [dependencies]
20 | picky-asn1 = { version = "0.10", path = "../picky-asn1" }
21 | serde = { version = "1", default-features = false, features = ["derive"] }
22 | serde_bytes = "0.11"
23 |
24 | [dev-dependencies]
25 | base64 = "0.22"
26 | pretty_assertions = "1.4"
27 | serde_bytes = "0.11"
28 | crypto-bigint = { version = "0.7.0-rc.8", default-features = false, features = ["alloc"] }
29 | oid = { version = "0.2", default-features = false, features = ["serde_support"] }
30 |
31 | [features]
32 | debug_log = []
33 |
--------------------------------------------------------------------------------
/picky-asn1-x509/src/pkcs12/safe_bag/key.rs:
--------------------------------------------------------------------------------
1 | use crate::pkcs12::Pkcs12EncryptionAlgorithm;
2 | use picky_asn1::wrapper::OctetStringAsn1;
3 | use picky_asn1_der::Asn1RawDer;
4 | use serde::{Deserialize, Serialize};
5 |
6 | /// PKCS12 SafeBag with `PrivateKeyInfo` ASN.1 structure encapsualted inside
7 | pub type KeyBag = Asn1RawDer;
8 |
9 | /// [PKCS #12: Personal Information Exchange Syntax Standard Version](https://tools.ietf.org/html/rfc7292#section-4.2.2)
10 | ///
11 | /// PKCS8ShroudedKeyBag ::= EncryptedPrivateKeyInfo
12 | ///
13 | /// [PKCS #8: Private-Key Information Syntax Standard](https://tools.ietf.org/html/rfc5208#section-6)
14 | /// ```not_rust
15 | /// EncryptedPrivateKeyInfo ::= SEQUENCE {
16 | /// encryptionAlgorithm EncryptionAlgorithmIdentifier,
17 | /// encryptedData EncryptedData }
18 | ///
19 | /// EncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
20 | ///
21 | /// EncryptedData ::= OCTET STRING
22 | /// ```
23 | #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
24 | pub struct EncryptedKeyBag {
25 | pub algorithm: Pkcs12EncryptionAlgorithm,
26 | /// After decryption this will contain `PrivateKeyInfo` ASN.1 structure
27 | pub encrypted_data: OctetStringAsn1,
28 | }
29 |
--------------------------------------------------------------------------------
/ffi/wasm/src/pem.rs:
--------------------------------------------------------------------------------
1 | use wasm_bindgen::prelude::*;
2 |
3 | define_error!(PemError, picky::pem::PemError);
4 |
5 | /// PEM object.
6 | #[wasm_bindgen]
7 | pub struct Pem(pub(crate) picky::pem::Pem<'static>);
8 |
9 | #[wasm_bindgen]
10 | impl Pem {
11 | /// Creates a PEM object with the given label and data.
12 | pub fn new(label: &str, data: &[u8]) -> Result {
13 | let data = data.to_owned();
14 | let pem = picky::pem::Pem::new(label, data);
15 | Ok(Pem(pem))
16 | }
17 |
18 | /// Parses a PEM-encoded string representation.
19 | pub fn parse(input: &str) -> Result {
20 | let pem = picky::pem::parse_pem(input)?;
21 | Ok(Pem(pem))
22 | }
23 |
24 | /// Returns the data contained by this PEM object.
25 | pub fn data(&self) -> Vec {
26 | self.0.data().to_vec()
27 | }
28 |
29 | /// Returns the label of this PEM object.
30 | pub fn get_label(&self) -> Result {
31 | Ok(self.0.label().to_owned())
32 | }
33 |
34 | /// Returns the string representation of this PEM object.
35 | pub fn to_repr(&self) -> Result {
36 | Ok(format!("{}", self.0))
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/picky-asn1/src/lib.rs:
--------------------------------------------------------------------------------
1 | pub mod bit_string;
2 | pub mod date;
3 | pub mod restricted_string;
4 | pub mod tag;
5 | pub mod wrapper;
6 |
7 | use tag::Tag;
8 |
9 | pub trait Asn1Type {
10 | const TAG: Tag;
11 | const NAME: &'static str;
12 | }
13 |
14 | impl Asn1Type for () {
15 | const TAG: Tag = Tag::NULL;
16 | const NAME: &'static str = "()";
17 | }
18 |
19 | impl Asn1Type for String {
20 | const TAG: Tag = Tag::UTF8_STRING;
21 | const NAME: &'static str = "String";
22 | }
23 |
24 | impl Asn1Type for bool {
25 | const TAG: Tag = Tag::BOOLEAN;
26 | const NAME: &'static str = "bool";
27 | }
28 |
29 | impl Asn1Type for u8 {
30 | const TAG: Tag = Tag::INTEGER;
31 | const NAME: &'static str = "u8";
32 | }
33 |
34 | impl Asn1Type for u16 {
35 | const TAG: Tag = Tag::INTEGER;
36 | const NAME: &'static str = "u16";
37 | }
38 |
39 | impl Asn1Type for u32 {
40 | const TAG: Tag = Tag::INTEGER;
41 | const NAME: &'static str = "u32";
42 | }
43 |
44 | impl Asn1Type for u64 {
45 | const TAG: Tag = Tag::INTEGER;
46 | const NAME: &'static str = "u64";
47 | }
48 |
49 | impl Asn1Type for u128 {
50 | const TAG: Tag = Tag::INTEGER;
51 | const NAME: &'static str = "u128";
52 | }
53 |
--------------------------------------------------------------------------------
/ffi/src/signature.rs:
--------------------------------------------------------------------------------
1 | #[diplomat::bridge]
2 | pub mod ffi {
3 | use crate::error::ffi::PickyError;
4 | use crate::hash::ffi::HashAlgorithm;
5 | use crate::key::ffi::PublicKey;
6 |
7 | #[diplomat::opaque]
8 | pub struct SignatureAlgorithm(pub picky::signature::SignatureAlgorithm);
9 |
10 | impl SignatureAlgorithm {
11 | pub fn new_rsa_pkcs_1v15(hash_algorithm: HashAlgorithm) -> Result, Box> {
12 | let algo = picky::hash::HashAlgorithm::try_from(hash_algorithm).map_err(|()| "invalid hash algorithm")?;
13 | Ok(Box::new(Self(picky::signature::SignatureAlgorithm::RsaPkcs1v15(algo))))
14 | }
15 |
16 | pub fn new_ecdsa(hash_algorithm: HashAlgorithm) -> Result, Box> {
17 | let algo = picky::hash::HashAlgorithm::try_from(hash_algorithm).map_err(|()| "invalid hash algorithm")?;
18 | Ok(Box::new(Self(picky::signature::SignatureAlgorithm::Ecdsa(algo))))
19 | }
20 |
21 | pub fn verify(&self, public_key: &PublicKey, msg: &[u8], signature: &[u8]) -> Result<(), Box> {
22 | self.0.verify(&public_key.0, msg, signature)?;
23 | Ok(())
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: "cargo"
4 | directories:
5 | - "/"
6 | - "/ffi/wasm/"
7 | schedule:
8 | interval: "weekly"
9 | assignees:
10 | - "CBenoit"
11 | open-pull-requests-limit: 3
12 | groups:
13 | crypto:
14 | patterns:
15 | - "*x509*"
16 | - "*crypto*"
17 | - "*tls*"
18 | - "*rand*"
19 | - "*dalek*"
20 | - "*pbkdf*"
21 | - "*bigint*"
22 | - "sha*"
23 | - "pkcs*"
24 | - "aes*"
25 | - "rsa"
26 | - "digest"
27 | - "md-5"
28 | - "md5"
29 | - "md4"
30 | - "p256"
31 | - "p384"
32 | - "p521"
33 | - "der"
34 | - "argon2"
35 | - "ctr"
36 | - "cbc"
37 | - "des"
38 | - "rc2"
39 | - "hmac"
40 | - "zeroize"
41 | - "ring"
42 | windows:
43 | patterns:
44 | - "windows*"
45 | - "winreg"
46 | - "winapi"
47 | patch:
48 | dependency-type: "production"
49 | update-types:
50 | - "patch"
51 | dev:
52 | dependency-type: "development"
53 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawOtherName.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct OtherName
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OtherName_get_type_id", ExactSpelling = true)]
24 | public static unsafe extern IntPtr GetTypeId(OtherName* self, DiplomatWriteable* writable);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OtherName_get_value", ExactSpelling = true)]
27 | public static unsafe extern VecU8* GetValue(OtherName* self);
28 |
29 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "OtherName_destroy", ExactSpelling = true)]
30 | public static unsafe extern void Destroy(OtherName* self);
31 | }
32 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawAttribute.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct Attribute
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "Attribute_get_type", ExactSpelling = true)]
24 | public static unsafe extern IntPtr GetType(Attribute* self, DiplomatWriteable* writable);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "Attribute_get_values", ExactSpelling = true)]
27 | public static unsafe extern AttributeValues* GetValues(Attribute* self);
28 |
29 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "Attribute_destroy", ExactSpelling = true)]
30 | public static unsafe extern void Destroy(Attribute* self);
31 | }
32 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/src/Pem.Addons.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | using Devolutions.Picky.Diplomat;
5 |
6 | namespace Devolutions.Picky;
7 |
8 | public partial class Pem
9 | {
10 | // FIXME: maybe this should be part of the Diplomat namespace in DiplomatRuntime.cs
11 | #if __IOS__
12 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
13 | #else
14 | private const string NativeLib = "DevolutionsPicky";
15 | #endif
16 |
17 | /// Returned data should not be modified!
18 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "Pem_peek_data", ExactSpelling = true)]
19 | internal static unsafe extern IntPtr PeekData(Raw.Pem* self, out nuint len);
20 |
21 | public byte[] ToData()
22 | {
23 | unsafe
24 | {
25 | if (_inner == null)
26 | {
27 | throw new ObjectDisposedException("Pem");
28 | }
29 |
30 | nuint dataLen;
31 | IntPtr dataPtr = PeekData(_inner, out dataLen);
32 |
33 | byte[] retVal = new byte[dataLen];
34 | Marshal.Copy(dataPtr, retVal, 0, (int)dataLen);
35 |
36 | return retVal;
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/picky-asn1-x509/README.md:
--------------------------------------------------------------------------------
1 | [](https://crates.io/crates/picky-asn1-x509)
2 | [](https://docs.rs/picky-asn1-x509)
3 | 
4 |
5 | Compatible with rustc 1.85.
6 | Minimal rustc version bumps happen [only with minor number bumps in this project](https://github.com/Devolutions/picky-rs/issues/89#issuecomment-868303478).
7 |
8 | # picky-asn1-x509
9 |
10 | Provide implementation for types defined in [X.509 RFC](https://tools.ietf.org/html/rfc5280) and related RFC ([PKCS#8](https://tools.ietf.org/html/rfc5208), [PKCS#10](https://tools.ietf.org/html/rfc2986)).
11 |
12 | This crate doesn't provide an easy to use API to create, read and validate X.509 certificates.
13 | This is a low-level library providing only raw types for serialization and deserialization purposes.
14 | These types are implementing `serde`'s `Serialize` and `Deserialize` and are to be used with [picky-asn1-der](https://crates.io/crates/picky-asn1-der).
15 | If you're looking for a higher level API, you may be interested by the [picky crate](https://crates.io/crates/picky) which uses
16 | this library internally and provides a nicer API.
17 |
18 |
--------------------------------------------------------------------------------
/ffi/wasm/rewrite-location.js:
--------------------------------------------------------------------------------
1 | /***********
2 | This is a workaround for this issue: https://github.com/vitejs/vite/issues/8427
3 | Actually, I’m not even sure we are really working around the exact same issue.
4 | Indeed, this dance is only required when bundling using vite 5, but wasn’t required when using vite 4.
5 | ***********/
6 |
7 | import { readFile, writeFile } from "fs";
8 | import path from "path";
9 | import { fileURLToPath } from 'url';
10 |
11 | const rootDir = path.dirname(fileURLToPath(import.meta.url));
12 | const preBundledPickyJs = path.join(rootDir, './dist/picky.js');
13 |
14 | readFile(preBundledPickyJs, 'utf8', (err, data) => {
15 | if (err) {
16 | console.error('Error reading the file:', err);
17 | return;
18 | }
19 |
20 | // Replace all instances of 'import.meta.url' with 'self.location'.
21 | const modifiedData = data.replace(/import\.meta\.url/g, 'self.location');
22 |
23 | // Write the modified content back to the file.
24 | writeFile(preBundledPickyJs, modifiedData, 'utf8', (err) => {
25 | if (err) {
26 | console.error('Error writing to the file:', err);
27 | return;
28 | }
29 |
30 | console.log('File has been modified successfully.');
31 | });
32 | });
33 |
34 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawBasicConstraints.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct BasicConstraints
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "BasicConstraints_get_ca", ExactSpelling = true)]
24 | public static unsafe extern GetCaResult GetCa(BasicConstraints* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "BasicConstraints_get_pathlen", ExactSpelling = true)]
27 | public static unsafe extern U8* GetPathlen(BasicConstraints* self);
28 |
29 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "BasicConstraints_destroy", ExactSpelling = true)]
30 | public static unsafe extern void Destroy(BasicConstraints* self);
31 | }
32 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawSpcSpOpusInfo.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct SpcSpOpusInfo
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SpcSpOpusInfo_get_program_name", ExactSpelling = true)]
24 | public static unsafe extern SpcString* GetProgramName(SpcSpOpusInfo* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SpcSpOpusInfo_get_more_info", ExactSpelling = true)]
27 | public static unsafe extern SpcLink* GetMoreInfo(SpcSpOpusInfo* self);
28 |
29 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SpcSpOpusInfo_destroy", ExactSpelling = true)]
30 | public static unsafe extern void Destroy(SpcSpOpusInfo* self);
31 | }
32 |
--------------------------------------------------------------------------------
/ffi/wasm/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "picky"
3 | version = "0.0.0"
4 | authors = ["Benoît CORTIER "]
5 | edition = "2024"
6 | publish = false
7 | description = "Portable X.509, PKI, JOSE and HTTP signature implementation."
8 | keywords = ["x509", "jwt", "signature", "jose", "pki"]
9 | license = "MIT OR Apache-2.0"
10 | repository = "https://github.com/Devolutions/picky-rs"
11 |
12 | [workspace]
13 | members = ["."]
14 |
15 | [lib]
16 | crate-type = ["cdylib", "rlib"]
17 |
18 | [profile.release]
19 | lto = "fat"
20 | opt-level = "s"
21 | strip = "debuginfo"
22 |
23 | [features]
24 | default = ["console_error_panic_hook"]
25 |
26 | [dependencies]
27 | picky = { path = "../../picky/", default-features = false, features = ["jose", "ssh", "putty"] }
28 |
29 | wasm-bindgen = "0.2"
30 | serde_json = "1"
31 |
32 | # The `console_error_panic_hook` crate provides better debugging of panics by
33 | # logging them with `console.error`. This is great for development, but requires
34 | # all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
35 | # code size when deploying.
36 | console_error_panic_hook = { version = "0.1", optional = true }
37 |
38 | getrandom = { version = "0.2", features = ["js"] }
39 |
40 | [dev-dependencies]
41 | wasm-bindgen-test = "0.3"
42 |
--------------------------------------------------------------------------------
/picky-test-data/test_assets/intermediate_ca.crt:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIDPzCCAiegAwIBAgIBATANBgkqhkiG9w0BAQUFADA7MQswCQYDVQQGEwJOTDER
3 | MA8GA1UECgwIUG9sYXJTU0wxGTAXBgNVBAMMEFBvbGFyU1NMIFRlc3QgQ0EwHhcN
4 | MTEwMjEyMTQ0NDA2WhcNMjEwMjEyMTQ0NDA2WjA8MQswCQYDVQQGEwJOTDERMA8G
5 | A1UECgwIUG9sYXJTU0wxGjAYBgNVBAMMEVBvbGFyU1NMIFNlcnZlciAxMIIBIjAN
6 | BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqQIfPUBq1VVTi/027oJlLhVhXom/
7 | uOhFkNvuiBZS0/FDUEeWEllkh2v9K+BG+XO+3c+S4ZFb7Wagb4kpeUWA0INq1UFD
8 | d185fAkER4KwVzlw7aPsFRkeqDMIR8EFQqn9TMO0390GH00QUUBncxMPQPhtgSVf
9 | CrFTxjB+FTms+Vruf5KepgVb5xOXhbUjktnUJAbVCSWJdQfdphqPPwkZvq1lLGTr
10 | lZvc/kFeF6babFtpzAK6FCwWJJxK3M3Q91Jnc/EtoCP9fvQxyi1wyokLBNsupk9w
11 | bp7OvViJ4lNZnm5akmXiiD8MlBmj3eXonZUT7Snbq3AS3FrKaxerUoJUsQIDAQAB
12 | o00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQfdNY/KcF0dEU7BRIsPai9Q1kCpjAf
13 | BgNVHSMEGDAWgBS0WuSls97SUva51aaVD+s+vMf9/zANBgkqhkiG9w0BAQUFAAOC
14 | AQEAm9GKWy4Z6eS483GoR5omwx32meCStm/vFuW+nozRwqwTG5d2Etx4TPnz73s8
15 | fMtM1QB0QbfBDDHxfGymEsKwICmCkJszKE7c03j3mkddrrvN2eIYiL6358S3yHMj
16 | iLVCraRUoEm01k7iytjxrcKb//hxFvHoxD1tdMqbuvjMlTS86kJSrkUMDw68UzfL
17 | jvo3oVjiexfasjsICXFNoncjthKtS7v4zrsgXNPz92h58NgXnDtQU+Eb9tVA9kUs
18 | Ln/az3v5DdgrNoAO60zK1zYAmekLil7pgba/jBLPeAQ2fZVgFxttKv33nUnUBzKA
19 | Od8i323fM5dQS1qQpBjBc/5fPw==
20 | -----END CERTIFICATE-----
--------------------------------------------------------------------------------
/picky-test-data/test_assets/root_ca.crt:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/
3 | MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT
4 | DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow
5 | PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD
6 | Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
7 | AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O
8 | rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq
9 | OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b
10 | xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw
11 | 7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40dutolucbY38EVAjqr2m7xPi71XAicPNaD
12 | aeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
13 | HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQMA0GCSqG
14 | SIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69
15 | ikugdB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXr
16 | AvHRAosZy5Q6XkjEGB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZz
17 | R8srzJmwN0jP41ZL9c8PDHIyh8bwRLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5
18 | JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubSfZGL+T0yjWW06XyxV3bqxbYo
19 | Ob8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
20 | -----END CERTIFICATE-----
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawEdiPartyName.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct EdiPartyName
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "EdiPartyName_get_name_assigner", ExactSpelling = true)]
24 | public static unsafe extern DirectoryString* GetNameAssigner(EdiPartyName* self);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "EdiPartyName_get_party_name", ExactSpelling = true)]
27 | public static unsafe extern DirectoryString* GetPartyName(EdiPartyName* self);
28 |
29 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "EdiPartyName_destroy", ExactSpelling = true)]
30 | public static unsafe extern void Destroy(EdiPartyName* self);
31 | }
32 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawMsCounterSign.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct MsCounterSign
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "MsCounterSign_get_oid", ExactSpelling = true)]
24 | public static unsafe extern IntPtr GetOid(MsCounterSign* self, DiplomatWriteable* writable);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "MsCounterSign_get_signed_data", ExactSpelling = true)]
27 | public static unsafe extern SignedData* GetSignedData(MsCounterSign* self);
28 |
29 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "MsCounterSign_destroy", ExactSpelling = true)]
30 | public static unsafe extern void Destroy(MsCounterSign* self);
31 | }
32 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawArgon2.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct Argon2
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "Argon2_new", ExactSpelling = true)]
24 | public static unsafe extern IntPtr New(Argon2Algorithm algorithm, Argon2Params* parameters);
25 |
26 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "Argon2_hash_password", ExactSpelling = true)]
27 | public static unsafe extern IntPtr HashPassword(Argon2* self, byte* password, nuint passwordSz, DiplomatWriteable* writeable);
28 |
29 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "Argon2_destroy", ExactSpelling = true)]
30 | public static unsafe extern void Destroy(Argon2* self);
31 | }
32 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawJwtFfiResultVoidBoxPickyError.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct JwtFfiResultVoidBoxPickyError
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [StructLayout(LayoutKind.Explicit)]
24 | private unsafe struct InnerUnion
25 | {
26 | [FieldOffset(0)]
27 | internal PickyError* err;
28 | }
29 |
30 | private InnerUnion _inner;
31 |
32 | [MarshalAs(UnmanagedType.U1)]
33 | public bool isOk;
34 |
35 | public unsafe PickyError* Err
36 | {
37 | get
38 | {
39 | return _inner.err;
40 | }
41 | }
42 |
43 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "result_unit_box_PickyError_destroy", ExactSpelling = true)]
44 | public static unsafe extern void Destroy(IntPtr self);
45 | }
46 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawPemFfiResultVoidBoxPickyError.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct PemFfiResultVoidBoxPickyError
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [StructLayout(LayoutKind.Explicit)]
24 | private unsafe struct InnerUnion
25 | {
26 | [FieldOffset(0)]
27 | internal PickyError* err;
28 | }
29 |
30 | private InnerUnion _inner;
31 |
32 | [MarshalAs(UnmanagedType.U1)]
33 | public bool isOk;
34 |
35 | public unsafe PickyError* Err
36 | {
37 | get
38 | {
39 | return _inner.err;
40 | }
41 | }
42 |
43 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "result_unit_box_PickyError_destroy", ExactSpelling = true)]
44 | public static unsafe extern void Destroy(IntPtr self);
45 | }
46 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawSshFfiResultVoidBoxPickyError.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct SshFfiResultVoidBoxPickyError
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [StructLayout(LayoutKind.Explicit)]
24 | private unsafe struct InnerUnion
25 | {
26 | [FieldOffset(0)]
27 | internal PickyError* err;
28 | }
29 |
30 | private InnerUnion _inner;
31 |
32 | [MarshalAs(UnmanagedType.U1)]
33 | public bool isOk;
34 |
35 | public unsafe PickyError* Err
36 | {
37 | get
38 | {
39 | return _inner.err;
40 | }
41 | }
42 |
43 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "result_unit_box_PickyError_destroy", ExactSpelling = true)]
44 | public static unsafe extern void Destroy(IntPtr self);
45 | }
46 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawX509FfiResultVoidBoxPickyError.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct X509FfiResultVoidBoxPickyError
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [StructLayout(LayoutKind.Explicit)]
24 | private unsafe struct InnerUnion
25 | {
26 | [FieldOffset(0)]
27 | internal PickyError* err;
28 | }
29 |
30 | private InnerUnion _inner;
31 |
32 | [MarshalAs(UnmanagedType.U1)]
33 | public bool isOk;
34 |
35 | public unsafe PickyError* Err
36 | {
37 | get
38 | {
39 | return _inner.err;
40 | }
41 | }
42 |
43 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "result_unit_box_PickyError_destroy", ExactSpelling = true)]
44 | public static unsafe extern void Destroy(IntPtr self);
45 | }
46 |
--------------------------------------------------------------------------------
/ffi/dotnet/Devolutions.Picky/Generated/RawArgon2FfiResultVoidBoxPickyError.cs:
--------------------------------------------------------------------------------
1 | // by Diplomat
2 |
3 | #pragma warning disable 0105
4 | using System;
5 | using System.Runtime.InteropServices;
6 |
7 | using Devolutions.Picky.Diplomat;
8 | #pragma warning restore 0105
9 |
10 | namespace Devolutions.Picky.Raw;
11 |
12 | #nullable enable
13 |
14 | [StructLayout(LayoutKind.Sequential)]
15 | public partial struct Argon2FfiResultVoidBoxPickyError
16 | {
17 | #if __IOS__
18 | private const string NativeLib = "libDevolutionsPicky.framework/libDevolutionsPicky";
19 | #else
20 | private const string NativeLib = "DevolutionsPicky";
21 | #endif
22 |
23 | [StructLayout(LayoutKind.Explicit)]
24 | private unsafe struct InnerUnion
25 | {
26 | [FieldOffset(0)]
27 | internal PickyError* err;
28 | }
29 |
30 | private InnerUnion _inner;
31 |
32 | [MarshalAs(UnmanagedType.U1)]
33 | public bool isOk;
34 |
35 | public unsafe PickyError* Err
36 | {
37 | get
38 | {
39 | return _inner.err;
40 | }
41 | }
42 |
43 | [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "result_unit_box_PickyError_destroy", ExactSpelling = true)]
44 | public static unsafe extern void Destroy(IntPtr self);
45 | }
46 |
--------------------------------------------------------------------------------