Skip to content

Commit

Permalink
Upstream fix: s2k salts must be 8 octets, not 10
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Apr 15, 2015
1 parent cdfd6b6 commit 21b508f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions framework/Pgp/bundle/CHANGED
Expand Up @@ -17,3 +17,5 @@ List of changes from upstream sources:

Added support for using the openssl extension to parse CAST128 data
(OpenPGP_Crypt_Symmetric::getCipher()).
Fix setting salt size in S2K object when symmetrically encrypting
(OpenPGP_Crypt_Symmetric::encrypt()).
Expand Up @@ -36,7 +36,7 @@ public static function encrypt($passphrases_and_keys, $message, $symmetric_algor
$esk = pack('n', OpenPGP::bitlength($esk)) . $esk;
array_unshift($encrypted, new OpenPGP_AsymmetricSessionKeyPacket($pass->algorithm, $pass->fingerprint(), $esk));
} else if(is_string($pass)) {
$s2k = new OpenPGP_S2K(crypt_random_string(10));
$s2k = new OpenPGP_S2K(crypt_random_string(8));
$cipher->setKey($s2k->make_key($pass, $key_bytes));
$esk = $cipher->encrypt(chr($symmetric_algorithm) . $key);
array_unshift($encrypted, new OpenPGP_SymmetricSessionKeyPacket($s2k, $esk, $symmetric_algorithm));
Expand Down

0 comments on commit 21b508f

Please sign in to comment.