LMOtsSignature.getInstance test coverage
@@ -39,6 +39,12 @@ public void testPrivateKeyRound()
LMOtsSignature sig = LM_OTS.lm_ots_generate_signature(privateKey, ctx.getQ(), ctx.getC());
assertTrue(LM_OTS.lm_ots_validate_signature(publicKey, sig, ms, false));
+ // Recreate signature
+ {
+ byte[] recreatedSignature = sig.getEncoded();
+ assertTrue(LM_OTS.lm_ots_validate_signature(publicKey, LMOtsSignature.getInstance(recreatedSignature), ms, false));
+ }
+
// Recreate public key.
{
byte[] recreatedPubKey = Arrays.clone(publicKey.getEncoded());
@@ -47,8 +53,7 @@ public void testPrivateKeyRound()
// Vandalise signature
{
-
- byte[] vandalisedSignature = sig.getEncoded(); // Arrays.clone(sig);
+ byte[] vandalisedSignature = sig.getEncoded();
vandalisedSignature[256] ^= 1; // Single bit error
assertFalse(LM_OTS.lm_ots_validate_signature(publicKey, LMOtsSignature.getInstance(vandalisedSignature), ms, false));
}
