microsoft/referencesource

How to get key alias in a certificate

leonard520 opened this issue · 1 comments

I am able to parse the key alias from a certificate by keytool. However I don't know how to get it from X509Certificate2. Any one can suggest? Thanks.

─ keytool -list -v -keystore abc.pfx -storetype PKCS12
Enter keystore password:

***************** WARNING WARNING WARNING *****************

  • The integrity of the information stored in your keystore *
  • has NOT been verified! In order to verify its integrity, *
  • you must provide your keystore password. *
    ***************** WARNING WARNING WARNING *****************

Keystore type: PKCS12
Keystore provider: SUN

Your keystore contains 1 entry

Alias name: xxxxx <-- This is the information I want
Creation date: Nov 19, 2021
Entry type: PrivateKeyEntry

Use another library to achieve it.