fix algorithm id for ECDSA auth keys on security keys

This commit is contained in:
Dominik Schürmann 2021-03-16 15:12:22 +01:00
parent 48f0bdcf75
commit fb0651eda1
1 changed files with 3 additions and 3 deletions

View File

@ -42,10 +42,10 @@ public class SecurityTokenUtils {
byte[] oid = new ASN1ObjectIdentifier(secretKey.getCurveOid()).getEncoded();
byte[] attrs = new byte[1 + (oid.length - 2) + 1];
if (slot.equals(KeyType.SIGN))
attrs[0] = ECKeyFormat.ECAlgorithmFormat.ECDSA_WITH_PUBKEY.getAlgorithmId();
else {
if (slot.equals(KeyType.ENCRYPT))
attrs[0] = ECKeyFormat.ECAlgorithmFormat.ECDH_WITH_PUBKEY.getAlgorithmId();
else { // SIGN and AUTH is ECDSA
attrs[0] = ECKeyFormat.ECAlgorithmFormat.ECDSA_WITH_PUBKEY.getAlgorithmId();
}
System.arraycopy(oid, 2, attrs, 1, (oid.length - 2));