feat: Adding Azure Key Vault keys and cryptography - #287
Conversation
|
| Filename | Overview |
|---|---|
| src/main/java/io/floci/az/services/keyvault/KeyVaultKeys.java | Implements key CRUD, versioning, lifecycle, backup and restore, rotation policies, and flavor-scoped Key Vault and Managed HSM storage. |
| src/main/java/io/floci/az/services/keyvault/KeyVaultCrypto.java | Implements RSA, EC, and AES cryptography while withholding private and symmetric key material from responses and validating GCM key sizes. |
| src/main/java/io/floci/az/services/keyvault/KeyVaultHandler.java | Adds Key Vault keys, cryptography, RNG, and Managed HSM data-plane dispatch. |
| src/main/java/io/floci/az/core/AzureRoutingFilter.java | Extends routing to recognize the new Key Vault and Managed HSM endpoint forms. |
| src/main/java/io/floci/az/core/tls/CertificateGenerator.java | Replaces the CA-as-leaf certificate with a CA-signed server certificate and appropriate SAN coverage. |
| compatibility-tests/sdk-test-node/tests/keyvault-keys.test.ts | Uses an Azure-shaped key identifier and a per-call policy to redirect Node cryptography requests to the emulator. |
| Makefile | Adds a bounded native-image cryptography smoke gate with runner cleanup. |
Reviews (4): Last reviewed commit: "fix(keyvault): build host-based crypto k..." | Re-trigger Greptile
|
Thank you for this, and sorry about the conflict: merging #228 changed (blocking) Your CI has run now, and Worth saying: the Java suite is green because the Java SDK has no local OAEP-256 path (RsaOaep.java#L64 is SHA-1 only), so both halves of that round trip go through the emulator and agree. Easy thing to be caught by. The rebase and that padding change unblock this. |
…ility
- Never expose symmetric (oct) key material in key responses; it stays
server-side for AES-GCM crypto (Get Key REST API parity).
- Scope key storage per flavor so {account}-keyvault and
{account}-managedhsm keys no longer share state.
- Return 409 Conflict when recreating a soft-deleted key name.
- Reject AES-GCM operations when the key size does not match the
algorithm (400 BadParameter).
- Accept PATCH /keys/{name} (empty version) for az keyvault key
set-attributes instead of 405.
- Bound the smoke-native-crypto readiness wait and always clean up the
native runner.
- Repair crypto compatibility tests across Java/Python/Node: build
host-based key identifiers (the only shape the SDK parsers accept) and
rewrite requests onto the path-based emulator route; assert symmetric
key material is absent; fix TypeScript null-safety and the GCM decrypt
parameter shape; replace the non-existent assert_not_empty BATS helper.
SunJCE's OAEPWithSHA-256AndMGF1Padding defaults MGF to SHA-1 without an explicit OAEPParameterSpec, so decrypt rejected ciphertext from SDKs that encrypt locally with MGF1 SHA-256. Pass an explicit OAEPParameterSpec for both OAEP variants.
Decrypt ciphertext produced by an independent JDK encryptor using an explicit OAEPParameterSpec (SHA-256 + MGF1 SHA-256), the convention the Python/Node/az SDKs use when encrypting locally.
579df06 to
017270f
Compare
|
@hectorvent
|
Summary
Adds Azure Key Vault keys and cryptography to floci-az (as requested in #194 ), plus a Managed HSM flavor, and fixes the self-signed TLS certificate so strict X.509 validators (e.g. Rust's rustls-platform-verifier) can trust floci-az's HTTPS endpoint.
Two parts:
feat(keyvault)— key CRUD (RSA/EC/oct, including-HSMvariants), versions, soft-delete/recover/purge, backup/restore, key rotation + rotation policy, encrypt/decrypt/sign/verify/wrap/unwrap (RSA-OAEP,RSA-OAEP-256,RSA1_5, AES-GCM;RS*/PS*/ES*), and/rng. The same data plane is served under the/{account}-managedhsm/suffix, with ARMMicrosoft.KeyVault/managedHSMsCRUD.fix(tls)— the self-signed HTTPS certificate was a single, CA-flagged certificate presented in the leaf/end-entity position, which strict path validators reject (CaUsedAsEndEntity). floci-az now generates a proper CA → leaf chain and serves the CA atGET /_floci/tls-certas the trust anchor. This also closes a SAN gap by adding*.managedhsm.azure.net.Type of change
fix:)feat:)feat!:orfix!:)Azure Compatibility
azure-security-keyvault-keys+ cryptography), Python (azure-keyvault-keys≥ 4.7.0), JavaScript (@azure/keyvault-keys^4.9.0), and theaz keyvault keyCLI (crypto ops, rotation policy, soft-delete lifecycle). Wire protocol follows the Key Vault REST API (api-version=7.4); intentional deviations are documented indocs/services/key-vault.md.openssl verifyandopenssl s_client -verify_hostnamereturningVerify return code: 0against the CA served at/_floci/tls-cert.Checklist
./mvnw testpasses locally