Lines Matching refs:key
46 * @param string $key
50 public static function load($key, $password = '') argument
52 if (!Strings::is_stringable($key)) {
53 throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
56 if (strpos($key, 'PUBLIC') !== false) {
58 } elseif (strpos($key, 'PRIVATE') !== false) {
64 $key = parent::load($key, $password);
66 $decoded = ASN1::decodeBER($key);
71 $key = ASN1::asn1map($decoded[0], Maps\RSAPrivateKey::MAP);
72 if (is_array($key)) {
74 'modulus' => $key['modulus'],
75 'publicExponent' => $key['publicExponent'],
76 'privateExponent' => $key['privateExponent'],
77 'primes' => [1 => $key['prime1'], $key['prime2']],
78 'exponents' => [1 => $key['exponent1'], $key['exponent2']],
79 'coefficients' => [2 => $key['coefficient']]
81 if ($key['version'] == 'multi') {
82 foreach ($key['otherPrimeInfos'] as $primeInfo) {
94 $key = ASN1::asn1map($decoded[0], Maps\RSAPublicKey::MAP);
96 if (!is_array($key)) {
104 return $components + $key;
124 $key = [
136 $key['otherPrimeInfos'][] = [
143 $key = ASN1::encodeDER($key, Maps\RSAPrivateKey::MAP);
145 return self::wrapPrivateKey($key, 'RSA', $password, $options);
158 $key = [
163 $key = ASN1::encodeDER($key, Maps\RSAPublicKey::MAP);
165 return self::wrapPublicKey($key, 'RSA');