INNER CODE UNIT · Python
iteration_count
kurtbrose/pyjks · jks/bks.py:168
iteration_count = b4.unpack_from(data, pos)[0]; pos += 4
encrypted_blob = data[pos:]
# The intention of the BKS entry decryption routine in BcKeyStoreSpi.StoreEntry.getObject(char[] password) appears to be:
# - try to decrypt with "PBEWithSHAAnd3-KeyTripleDES-CBC" first (1.2.840.113549.1.12.1.3);
# - if that fails, try again with "BrokenPBEWithSHAAnd3-KeyTripleDES-CBC";
# - if that still fails, try again with "OldPBEWithSHAAnd3-KeyTripleDES-CBC"
# - give up with an UnrecoverableKeyException
#
# However, at the time of writing (bcprov-jdk15on-1.53 and 1.54), the second and third cases can never successfully execute
# because their implementation requests non-existent SecretKeyFactory objects for the Broken/Old algorithm names.
# Inquiry through the BC developer mailing list tells us that this is indeed old functionality that has been retired long ago
# and is not expected to be operational anymore, and should be cleaned up.
#
# So in practice, the real behaviour is:
# - try to decrypt with "PBEWithSHAAnd3-KeyTripleDES-CBC" (1.2.840.113549.1.12.1.3);
# - give up with an UnrecoverableKeyException
#