Better hash algorithm in FingerprintTrustManagerFactory
See original GitHub issueFingerprintTrustManagerFactory
checks if a certificate is trusted by comparing its SHA-1 hash to a list of pre-configured ones:
Unfortunately, nowadays SHA-1 is considered insecure. The issue was reported by LGTM.
I see the following ways to fix it:
- Update
FingerprintTrustManagerFactory
to use a stronger algorithm such as SHA-512. Unfortunately, most likely it’ll break applications that pass a SHA-1 hash to the class. - Deprecate
FingerprintTrustManagerFactory
and add a new implementation that use a stronger algorithm. - Updated
FingerprintTrustManagerFactory
to determine a hash algorithm based on a length of a hash passed to the constructor. If a caller passes a SHA-1 hash, the class can also print a warning.
Please let me know if one of the options above is fine (or, you see a better option), and I’ll open a pull request.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
netty/FingerprintTrustManagerFactory.java at 4.1 - GitHub
* It is recommended to specify a stronger hash algorithm, such as SHA-256,. * by calling {@link FingerprintTrustManagerFactory#builder(String)} method.
Read more >FingerprintTrustManagerFactory (Netty API Reference (4.1.85 ...
Creates a builder for FingerprintTrustManagerFactory . Parameters: algorithm - a hash algorithm; Returns: a builder. engineInit. protected ...
Read more >Frequently Asked Questions - BetterHash
How does BetterHash work? BetterHash is a smart interface for the most popular cryptocurrency miners on the market. What it does:.
Read more >Certificate encryption and hash algorithm [duplicate]
I was creating self-signed certificate with OpenSSL and had to choose encryption and hash algorithm. Are those algorithms used for ...
Read more >XAMPP SSL Certificate better hash security - Stack Overflow
I get a lot of SHA-1 warnings in the firebug console and I think it's because of using SSL which has sha1 as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I like the idea with a builder and deprecating only the public constructor suggested by @trustin
If no objections, I’ll implement this logic then.
I don’t see a reason to introduce a new
TrustManagerFactory
implementation class. We could deprecate the public constructors in favor of builders and static factory methods. e.g.The public constructors could call the internal constructor that passes the message digest function, e.g.
We could also consider implementing more versatile
TrustManagerFactory
by extracting the verification logic out of theTrustManagerFactory
, e.g.