Skip to content

calculated thumbrint is different from Java calculated thumbprint#2

Open
sius wants to merge 2 commits intoleandrob:masterfrom
sius:master
Open

calculated thumbrint is different from Java calculated thumbprint#2
sius wants to merge 2 commits intoleandrob:masterfrom
sius:master

Conversation

@sius
Copy link
Copy Markdown

@sius sius commented Jan 4, 2018

Hello,
compared to the Java implementation, the binary string produces a different result.
Using the buffer directly yields the same result as the Java (1.8) implementation.

Java Implementation Example:

public String calculate(java.security.cert.X509Certificate cert)  throws CertificateEncodingException {
  MessageDigest md = MessageDigest.getInstance("SHA-1");
  byte[] der = cert.getEncoded();
  md.update(der);
  byte[] digest = md.digest();
  return DatatypeConverter.printHexBinary(digest).toLowerCase();
}

This Java Implementation returns the same thumbprint (fingerprint) hexstrings as the Java keytool when listing a keystore.

Best regards

sius added 2 commits January 4, 2018 14:00
using buffer directly (not the binary string) creates the correct thumprint compared to the Java Implementation
@wurmr
Copy link
Copy Markdown

wurmr commented Oct 17, 2018

This is true for the way windows exports the fingerprints as well. Removing that toString call seems like the correct thing to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants