Commit fffa3ebc authored by Éloïs's avatar Éloïs
Browse files

[tests] wrong block signature should NOT be verified with new verify fn

parent 9895862c
......@@ -14,7 +14,7 @@
"use strict";
import {Base58decode, Base58encode} from "../../../app/lib/common-libs/crypto/base58"
import {decodeBase64, encodeBase64} from "../../../app/lib/common-libs/crypto/nacl-util"
import {KeyGen, verifyBuggy} from "../../../app/lib/common-libs/crypto/keyring"
import {KeyGen, verify, verifyBuggy} from "../../../app/lib/common-libs/crypto/keyring"
const should = require('should');
......@@ -86,4 +86,36 @@ describe('ed25519 tests:', function(){
verified.should.equal(true);
done();
});
it('wrong block signature due to oldest tweetnacl should be verified with verifyBuggy', function(done){
const msg = "InnerHash: 8B194B5C38CF0A38D16256405AC3E5FA5C2ABD26BE4DCC0C7ED5CC9824E6155B\nNonce: 30400000119992\n";
const rawSig = "fJusVDRJA8akPse/sv4uK8ekUuvTGj1OoKYVdMQQAACs7OawDfpsV6cEMPcXxrQTCTRMrTN/rRrl20hN5zC9DQ==";
const verified = verifyBuggy(msg, rawSig, "D9D2zaJoWYWveii1JRYLVK3J4Z7ZH3QczoKrnQeiM6mx");
verified.should.equal(true);
done();
});
it('wrong block signature due to oldest tweetnacl should NOT be verified with verify', function(done){
const msg = "InnerHash: 8B194B5C38CF0A38D16256405AC3E5FA5C2ABD26BE4DCC0C7ED5CC9824E6155B\nNonce: 30400000119992\n";
const rawSig = "fJusVDRJA8akPse/sv4uK8ekUuvTGj1OoKYVdMQQAACs7OawDfpsV6cEMPcXxrQTCTRMrTN/rRrl20hN5zC9DQ==";
const verified = verify(msg, rawSig, "D9D2zaJoWYWveii1JRYLVK3J4Z7ZH3QczoKrnQeiM6mx");
verified.should.equal(false);
done();
});
it('rectified block signature should be NOT verified with verifyBuggy', function(done){
const msg = "InnerHash: 8B194B5C38CF0A38D16256405AC3E5FA5C2ABD26BE4DCC0C7ED5CC9824E6155B\nNonce: 30400000119992\n";
const rawSig = "aZusVDRJA8akPse/sv4uK8ekUuvTGj1OoKYVdMQQ/3+VMaDJ02I795GBBaLgjypZFEKYlPMssJMn/X+F/pxgAw==";
const verified = verifyBuggy(msg, rawSig, "D9D2zaJoWYWveii1JRYLVK3J4Z7ZH3QczoKrnQeiM6mx");
verified.should.equal(false);
done();
});
it('rectified block signature should be verified with verify', function(done){
const msg = "InnerHash: 8B194B5C38CF0A38D16256405AC3E5FA5C2ABD26BE4DCC0C7ED5CC9824E6155B\nNonce: 30400000119992\n";
const rawSig = "aZusVDRJA8akPse/sv4uK8ekUuvTGj1OoKYVdMQQ/3+VMaDJ02I795GBBaLgjypZFEKYlPMssJMn/X+F/pxgAw==";
const verified = verify(msg, rawSig, "D9D2zaJoWYWveii1JRYLVK3J4Z7ZH3QczoKrnQeiM6mx");
verified.should.equal(true);
done();
});
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment