Skip to content

Commit 1fc6958

Browse files
committed
added octet string processing for ML-DSA
1 parent c8fe4d7 commit 1fc6958

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

core/src/main/java/org/bouncycastle/pqc/crypto/util/PrivateKeyFactory.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,16 @@ else if (algOID.equals(NISTObjectIdentifiers.id_ml_dsa_44)
322322
null);
323323
}
324324
}
325+
else if (keyObj instanceof DEROctetString)
326+
{
327+
byte[] data = ASN1OctetString.getInstance(keyObj).getOctets();
328+
if (keyInfo.getPublicKeyData() != null)
329+
{
330+
MLDSAPublicKeyParameters pubParams = PublicKeyFactory.MLDSAConverter.getPublicKeyParams(spParams, keyInfo.getPublicKeyData());
331+
return new MLDSAPrivateKeyParameters(spParams, data, pubParams);
332+
}
333+
return new MLDSAPrivateKeyParameters(spParams, data, null);
334+
}
325335
else
326336
{
327337
throw new IOException("not supported");

0 commit comments

Comments
 (0)