Support the no-MDC (resync) case
This commit is contained in:
parent
47a7f6e25c
commit
8c60f4e37b
@ -50,7 +50,17 @@ class OpenPGP_Crypt_AES_TripleDES {
|
||||
} catch (Exception $ex) { $msg = NULL; }
|
||||
if($msg) return $msg; /* Otherwise keep trying */
|
||||
} else {
|
||||
// TODO (resync)
|
||||
// No MDC mean decrypt with resync
|
||||
$iv = substr($epacket->data, 2, $key_block_bytes);
|
||||
$edata = substr($epacket->data, $key_block_bytes + 2);
|
||||
|
||||
$cipher->setIV($iv);
|
||||
$data = substr($cipher->decrypt($edata . str_repeat("\0", $padAmount)), 0, strlen($edata));
|
||||
|
||||
try {
|
||||
$msg = OpenPGP_Message::parse($data);
|
||||
} catch (Exception $ex) { $msg = NULL; }
|
||||
if($msg) return $msg; /* Otherwise keep trying */
|
||||
}
|
||||
} else {
|
||||
// TODO
|
||||
|
@ -88,9 +88,9 @@ class Decryption extends PHPUnit_Framework_TestCase {
|
||||
public function testDecryptSessionKey() {
|
||||
$this->oneSymmetric("hello", "PGP\n", "symmetric-with-session-key.gpg");
|
||||
}
|
||||
*/
|
||||
|
||||
public function testDecryptNoMDC() {
|
||||
$this->oneSymmetric("hello", "PGP\n", "symmetric-no-mdc.gpg");
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user