Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Sop\CryptoTypes\AlgorithmIdentifier\AlgorithmIdentifier;
use Sop\CryptoTypes\AlgorithmIdentifier\AlgorithmIdentifierFactory;
use Sop\CryptoTypes\AlgorithmIdentifier\Feature\AsymmetricCryptoAlgorithmIdentifier;
use Sop\CryptoTypes\AlgorithmIdentifier\Feature\AlgorithmIdentifierType;
use Sop\CryptoTypes\AlgorithmIdentifier\Feature\HashAlgorithmIdentifier;
use Sop\CryptoTypes\AlgorithmIdentifier\Feature\SignatureAlgorithmIdentifier;

Expand Down Expand Up @@ -50,13 +50,13 @@ abstract class SignatureAlgorithmIdentifierFactory
* Get signature algorithm identifier of given asymmetric cryptographic type
* utilizing given hash algorithm.
*
* @param AsymmetricCryptoAlgorithmIdentifier $crypto_algo Cryptographic algorithm identifier, eg. RSA or EC
* @param AlgorithmIdentifierType $crypto_algo Cryptographic algorithm identifier, eg. RSA or EC
* @param HashAlgorithmIdentifier $hash_algo Hash algorithm identifier
*
* @throws \UnexpectedValueException
*/
public static function algoForAsymmetricCrypto(
AsymmetricCryptoAlgorithmIdentifier $crypto_algo,
AlgorithmIdentifierType $crypto_algo,
HashAlgorithmIdentifier $hash_algo): SignatureAlgorithmIdentifier
{
switch ($crypto_algo->oid()) {
Expand Down
8 changes: 4 additions & 4 deletions lib/CryptoTypes/Asymmetric/PrivateKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public function privateKeyData(): string
}

/**
* Get the private key as a PrivateKeyInfo type.
* Get the private key as a OneAsymmetricKey type.
*/
public function privateKeyInfo(): PrivateKeyInfo
public function privateKeyInfo(): OneAsymmetricKey
{
return PrivateKeyInfo::fromPrivateKey($this);
return OneAsymmetricKey::fromPrivateKey($this);
}

/**
Expand All @@ -66,7 +66,7 @@ public static function fromPEM(PEM $pem)
case PEM::TYPE_EC_PRIVATE_KEY:
return EC\ECPrivateKey::fromDER($pem->data());
case PEM::TYPE_PRIVATE_KEY:
return PrivateKeyInfo::fromDER($pem->data())->privateKey();
return OneAsymmetricKey::fromDER($pem->data())->privateKey();
}
throw new \UnexpectedValueException(
'PEM type ' . $pem->type() . ' is not a valid private key.');
Expand Down