Skip to content

Commit

Permalink
removed weird conversion of HSS key to LMS key.
Browse files Browse the repository at this point in the history
  • Loading branch information
dghgit committed Nov 20, 2024
1 parent 47a2464 commit a051043
Showing 1 changed file with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.bouncycastle.pqc.crypto.hqc.HQCPublicKeyParameters;
import org.bouncycastle.pqc.crypto.lms.HSSPublicKeyParameters;
import org.bouncycastle.pqc.crypto.lms.LMSKeyParameters;
import org.bouncycastle.pqc.crypto.lms.LMSPublicKeyParameters;
import org.bouncycastle.pqc.crypto.mldsa.MLDSAParameters;
import org.bouncycastle.pqc.crypto.mldsa.MLDSAPublicKeyParameters;
import org.bouncycastle.pqc.crypto.mlkem.MLKEMParameters;
Expand Down Expand Up @@ -452,19 +451,11 @@ AsymmetricKeyParameter getPublicKeyParameters(SubjectPublicKeyInfo keyInfo, Obje
private LMSKeyParameters getLmsKeyParameters(byte[] keyEnc)
throws IOException
{
if (Pack.bigEndianToInt(keyEnc, 0) == 1)
if (keyEnc.length == 64)
{
return LMSPublicKeyParameters.getInstance(Arrays.copyOfRange(keyEnc, 4, keyEnc.length));
}
else
{
// public key with extra tree height
if (keyEnc.length == 64)
{
keyEnc = Arrays.copyOfRange(keyEnc, 4, keyEnc.length);
}
return HSSPublicKeyParameters.getInstance(keyEnc);
keyEnc = Arrays.copyOfRange(keyEnc, 4, keyEnc.length);
}
return HSSPublicKeyParameters.getInstance(keyEnc);
}
}

Expand Down

0 comments on commit a051043

Please sign in to comment.