mirror of
https://github.com/danog/phpseclib.git
synced 2025-01-22 13:01:59 +01:00
Merge branch '3.0'
This commit is contained in:
commit
c233a385cc
@ -141,7 +141,7 @@ abstract class PKCS8 extends Progenitor
|
||||
$params = ASN1::encodeDER($params, Maps\DSAParams::MAP);
|
||||
$params = new ASN1\Element($params);
|
||||
$key = ASN1::encodeDER($x, Maps\DSAPublicKey::MAP);
|
||||
return self::wrapPrivateKey($key, [], $params, $password, $options);
|
||||
return self::wrapPrivateKey($key, [], $params, $password, null, '', $options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,7 +128,7 @@ abstract class PKCS8 extends Progenitor
|
||||
{
|
||||
$key = PKCS1::savePrivateKey($n, $e, $d, $primes, $exponents, $coefficients);
|
||||
$key = ASN1::extractBER($key);
|
||||
return self::wrapPrivateKey($key, [], null, $password, $options);
|
||||
return self::wrapPrivateKey($key, [], null, $password, null, '', $options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -181,7 +181,7 @@ abstract class PSS extends Progenitor
|
||||
$key = PKCS1::savePrivateKey($n, $e, $d, $primes, $exponents, $coefficients);
|
||||
$key = ASN1::extractBER($key);
|
||||
$params = self::savePSSParams($options);
|
||||
return self::wrapPrivateKey($key, [], $params, $password, $options);
|
||||
return self::wrapPrivateKey($key, [], $params, $password, null, '', $options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
use phpseclib3\Crypt\RSA;
|
||||
use phpseclib3\Crypt\RSA\Formats\Keys\PKCS1;
|
||||
use phpseclib3\Crypt\RSA\Formats\Keys\PKCS8;
|
||||
use phpseclib3\Crypt\RSA\PrivateKey;
|
||||
use phpseclib3\Crypt\RSA\PublicKey;
|
||||
|
||||
@ -66,4 +67,13 @@ class Unit_Crypt_RSA_CreateKeyTestRSA extends PhpseclibTestCase
|
||||
|
||||
RSA::useBestEngine();
|
||||
}
|
||||
|
||||
public function test3DESPKCS8Encryption()
|
||||
{
|
||||
$key = RSA::createKey(768)
|
||||
->withPassword('demo')
|
||||
->toString('PKCS8', ['encryptionAlgorithm' => 'pbeWithSHAAnd3-KeyTripleDES-CBC']);
|
||||
$actual = PKCS8::extractEncryptionAlgorithm($key)['algorithm'];
|
||||
$this->assertSame($actual, 'pbeWithSHAAnd3-KeyTripleDES-CBC');
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user