Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
16 | 6 | public static function getSignatureAlgorithm( |
|
17 | string $pkiType, |
||
18 | AsymmetricCryptoAlgorithmIdentifier $keyAlgorithm |
||
19 | ): SignatureAlgorithmIdentifier { |
||
20 | 6 | if ($pkiType === PKIType::X509_SHA1) { |
|
21 | 3 | $hashAlgId = new SHA1AlgorithmIdentifier(); |
|
22 | 5 | } else if ($pkiType === PKIType::X509_SHA256) { |
|
23 | 3 | $hashAlgId = new SHA256AlgorithmIdentifier(); |
|
24 | } else { |
||
25 | 2 | throw new X509Exception("Unknown signature scheme"); |
|
26 | } |
||
27 | |||
28 | 4 | return SignatureAlgorithmIdentifierFactory::algoForAsymmetricCrypto( |
|
29 | 4 | $keyAlgorithm, |
|
30 | 4 | $hashAlgId |
|
31 | ); |
||
32 | } |
||
33 | } |
||
34 |