Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jks/jks.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ def decrypt(self, key_password):

encrypted_info = decoder.decode(self._encrypted, asn1Spec=rfc5208.EncryptedPrivateKeyInfo())[0]
algo_id = encrypted_info['encryptionAlgorithm']['algorithm'].asTuple()
algo_params = encrypted_info['encryptionAlgorithm']['parameters'].asOctets()
encrypted_private_key = encrypted_info['encryptedData'].asOctets()

plaintext = None
Expand All @@ -206,6 +205,7 @@ def decrypt(self, key_password):
if self.store_type != "jceks":
raise UnexpectedAlgorithmException("Encountered JCEKS private key protection algorithm in JKS keystore")
# see RFC 2898, section A.3: PBES1 and definitions of AlgorithmIdentifier and PBEParameter
algo_params = encrypted_info['encryptionAlgorithm']['parameters'].asOctets()
params = decoder.decode(algo_params, asn1Spec=rfc2898.PBEParameter())[0]
salt = params['salt'].asOctets()
iteration_count = int(params['iterationCount'])
Expand Down