Rakesh Kumar
Rakesh Kumar

Reputation: 157

How to get key usage of a digital certificate in java

How to get key usage of a digital certificate in java. I want to know the use of purpose of a certificate like digital signature or key-encipherment.

Upvotes: 0

Views: 3821

Answers (2)

Thorsten Laux
Thorsten Laux

Reputation: 100

If you want to see basic information about a certificate, keytool would do the trick:

keytool -printcert -file <mycert.cer>

Upvotes: 1

Robby Cornelissen
Robby Cornelissen

Reputation: 97120

You can get that information by calling the X509Certificate.getKeyUsage() method.

Extended key usage information can be obtained from X509Certificate.getExtendedKeyUsage().

Upvotes: 4

Related Questions