Lines Matching refs:key

71      * @param string $key
75 public static function load($key, $password = '') argument
84 if (!Strings::is_stringable($key)) {
85 throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
88 $isPublic = strpos($key, 'PUBLIC') !== false;
90 $key = parent::load($key, $password);
92 $type = isset($key['privateKey']) ? 'privateKey' : 'publicKey';
101 switch ($key[$type . 'Algorithm']['algorithm']) {
104 return self::loadEdDSA($key);
107 $decoded = ASN1::decodeBER($key[$type . 'Algorithm']['parameters']->element);
117 $components['QA'] = self::extractPoint("\0" . $key['publicKey'], $components['curve']);
122 $decoded = ASN1::decodeBER($key['privateKey']);
123 $key = ASN1::asn1map($decoded[0], Maps\ECPrivateKey::MAP);
124 if (isset($key['parameters']) && $params != $key['parameters']) {
128 $components['dA'] = new BigInteger($key['privateKey'], 256);
130 $components['QA'] = isset($key['publicKey']) ?
131 self::extractPoint($key['publicKey'], $components['curve']) :
142 private static function loadEdDSA(array $key) argument
146 if (isset($key['privateKey'])) {
147 …$components['curve'] = $key['privateKeyAlgorithm']['algorithm'] == 'id-Ed25519' ? new Ed25519() : …
151 if (substr($key['privateKey'], 0, 2) != "\x04\x20") {
154 $components['dA'] = $components['curve']->extractSecret(substr($key['privateKey'], 2));
157 if (isset($key['publicKey'])) {
159 …$components['curve'] = $key['publicKeyAlgorithm']['algorithm'] == 'id-Ed25519' ? new Ed25519() : n…
162 $components['QA'] = self::extractPoint($key['publicKey'], $components['curve']);
165 if (isset($key['privateKey']) && !isset($components['QA'])) {
199 $key = "\4" . $publicKey[0]->toBytes() . $publicKey[1]->toBytes();
201 return self::wrapPublicKey($key, $params, 'id-ecPublicKey');
237 $key = [
244 $key = ASN1::encodeDER($key, Maps\ECPrivateKey::MAP);
246 return self::wrapPrivateKey($key, [], $params, $password, 'id-ecPublicKey', '', $options);