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