From c9a1356e20fcb6f6f14b0cac2d4366d62e3651fa Mon Sep 17 00:00:00 2001 From: Wolfgang Profer Date: Tue, 16 Sep 2014 18:18:01 +0200 Subject: [PATCH] Fixed FingerprintTrustManagerFactory constructor Motivation: When constructing a FingerprintTrustManagerFactory from an Iterable of Strings, the fingerprints were correctly parsed but never added to the result array. The constructed FingerprintTrustManagerFactory consequently fails to validate any certificate. Modifications: I added a line to add each converted SHA-1 certificate fingerprint to the result array which then gets passed on to the next constructor. Result: Certificate fingerprints passed to the constructor are now correctly added to the array of valid fingerprints. The resulting FingerprintTrustManagerFactory object correctly validates certificates against the list of specified fingerprints. --- .../netty/handler/ssl/util/FingerprintTrustManagerFactory.java | 1 + 1 file changed, 1 insertion(+) diff --git a/handler/src/main/java/io/netty/handler/ssl/util/FingerprintTrustManagerFactory.java b/handler/src/main/java/io/netty/handler/ssl/util/FingerprintTrustManagerFactory.java index 6439528ebe..a209db79f3 100644 --- a/handler/src/main/java/io/netty/handler/ssl/util/FingerprintTrustManagerFactory.java +++ b/handler/src/main/java/io/netty/handler/ssl/util/FingerprintTrustManagerFactory.java @@ -190,6 +190,7 @@ public final class FingerprintTrustManagerFactory extends SimpleTrustManagerFact int strIdx = i << 1; farr[i] = (byte) Integer.parseInt(f.substring(strIdx, strIdx + 2), 16); } + list.add(farr); } return list.toArray(new byte[list.size()][]);