Whitespace and proper padAmount
This commit is contained in:
parent
04b89decd1
commit
3afd401688
@ -104,9 +104,8 @@ class OpenPGP_Crypt_AES_TripleDES {
|
|||||||
if(!$cipher) return NULL;
|
if(!$cipher) return NULL;
|
||||||
$cipher->setKey($key);
|
$cipher->setKey($key);
|
||||||
|
|
||||||
$padAmount = $key_block_bytes - (strlen($epacket->data) % $key_block_bytes);
|
|
||||||
|
|
||||||
if($epacket instanceof OpenPGP_IntegrityProtectedDataPacket) {
|
if($epacket instanceof OpenPGP_IntegrityProtectedDataPacket) {
|
||||||
|
$padAmount = $key_block_bytes - (strlen($epacket->data) % $key_block_bytes);
|
||||||
$data = substr($cipher->decrypt($epacket->data . str_repeat("\0", $padAmount)), 0, strlen($epacket->data));
|
$data = substr($cipher->decrypt($epacket->data . str_repeat("\0", $padAmount)), 0, strlen($epacket->data));
|
||||||
$prefix = substr($data, 0, $key_block_bytes + 2);
|
$prefix = substr($data, 0, $key_block_bytes + 2);
|
||||||
$mdc = substr(substr($data, -22, 22), 2);
|
$mdc = substr(substr($data, -22, 22), 2);
|
||||||
@ -123,6 +122,7 @@ class OpenPGP_Crypt_AES_TripleDES {
|
|||||||
// No MDC mean decrypt with resync
|
// No MDC mean decrypt with resync
|
||||||
$iv = substr($epacket->data, 2, $key_block_bytes);
|
$iv = substr($epacket->data, 2, $key_block_bytes);
|
||||||
$edata = substr($epacket->data, $key_block_bytes + 2);
|
$edata = substr($epacket->data, $key_block_bytes + 2);
|
||||||
|
$padAmount = $key_block_bytes - (strlen($edata) % $key_block_bytes);
|
||||||
|
|
||||||
$cipher->setIV($iv);
|
$cipher->setIV($iv);
|
||||||
$data = substr($cipher->decrypt($edata . str_repeat("\0", $padAmount)), 0, strlen($edata));
|
$data = substr($cipher->decrypt($edata . str_repeat("\0", $padAmount)), 0, strlen($edata));
|
||||||
|
Loading…
Reference in New Issue
Block a user