I'm creating SSLContext in standard way:
- take .p12 certificate file,
- create KeyStore and load certificate into it,
- create KeyManagerFactory, init it with KeyStore, and get KeyManagers,
- create TrustManagerFactory, init it with null, and get TrustManagers.
- create SSLContext and init it with KeyManagers and TrustManagers.
The question is - how can I extract KeyStore and certificate data back from SSLContext? The task is to obtain fingerprint hash from certficate.
Is it even possible or I have to get it separately, reading certificate from file?
Certificate cert = keystore.getCertificate(alias);, but you have to know alias (name) of this certificate before you use that. And then Get Fingerprint is also easyorg.apache.commons.codec.binary.Hex.encodeHexString(cert.getFingerprint());- Krzysiek