Kratika Kapoor
Kratika Kapoor

Reputation: 3

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

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

Upvotes: -1

Views: 150

Answers (1)

Esta Nagy
Esta Nagy

Reputation: 319

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.

Upvotes: 0

Related Questions