How to access private key as PrivateKey object from a pfx certificate stored in Azure key vault using Java?

134 Views Asked by At

CertificateClient certificateClient = new CertificateClientBuilder().vaultUrl().credential(new DefaultAzureCredentialBuilder().build()).buildClient(); KeyVaultCertificateWithPolicy certificate = certificateClient.getCertificate("certificateName")

1

There are 1 best solutions below

0
Esta Nagy On BEST ANSWER

This is an example dealing with exactly the case you mentioned: https://github.com/nagyesta/lowkey-vault-example/blob/main/src/main/java/com/github/nagyesta/lowkeyvault/example/impl/AzureCertificateRepositoryImpl.java#L38-L59

The example is dealing with an EC key, but you can simply cast it to the RSA specific class the same way.