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.
This commit is contained in:
Wolfgang Profer 2014-09-16 18:18:01 +02:00 committed by Norman Maurer
parent 43d097d25a
commit c9a1356e20

View File

@ -190,6 +190,7 @@ public final class FingerprintTrustManagerFactory extends SimpleTrustManagerFact
int strIdx = i << 1; int strIdx = i << 1;
farr[i] = (byte) Integer.parseInt(f.substring(strIdx, strIdx + 2), 16); farr[i] = (byte) Integer.parseInt(f.substring(strIdx, strIdx + 2), 16);
} }
list.add(farr);
} }
return list.toArray(new byte[list.size()][]); return list.toArray(new byte[list.size()][]);