EAC2CVRequestGeneratorTest.js
Summary
No overview generated for 'EAC2CVRequestGeneratorTest.js'
Method Summary
|
static void
|
test(crypto, priKey, pubKey, taOID)
|
load("EAC2CVRequestGenerator.js");
function test(crypto, priKey, pubKey, taOID) {
var reqGenerator = new EAC2CVRequestGenerator(crypto);
reqGenerator.setProfileIdentifier(0x00);
var CAR = "decvca00000";
reqGenerator.setCAR(CAR);
reqGenerator.setPublicKey(pubKey);
reqGenerator.setTAAlgorithmIdentifier(taOID);
var ext1 = new ASN1("ext1", new ByteString("06022A11", HEX));
var ext2 = new ASN1("ext2", new ByteString("06022A12", HEX));
reqGenerator.setExtensions([ext1, ext2]);
var CHR = "dedvca00001";
reqGenerator.setCHR(CHR);
var req = reqGenerator.generateAuthenticatedCVRequest(priKey, priKey, new PublicKeyReference("dedvca00000"), taOID);
print(req);
var cvreq = new CVC(req);
print(cvreq);
assert(cvreq.verifyWith(crypto, pubKey, taOID));
assert(cvreq.verifyATWith(crypto, pubKey, taOID));
}
var crypto = new Crypto();
var priKey = new Key();
var pubKey = new Key();
priKey.setType(Key.PRIVATE);
pubKey.setType(Key.PUBLIC);
priKey.setComponent(Key.ECC_CURVE_OID, new ByteString("brainpoolP256t1", OID));
pubKey.setComponent(Key.ECC_CURVE_OID, new ByteString("brainpoolP256t1", OID));
crypto.generateKeyPair(Crypto.EC, pubKey, priKey);
test(crypto, priKey, pubKey, new ByteString("id-TA-ECDSA-SHA-256", OID));
var priKey = new Key();
var pubKey = new Key();
priKey.setType(Key.PRIVATE);
pubKey.setType(Key.PUBLIC);
pubKey.setSize(1024);
crypto.generateKeyPair(Crypto.RSA, pubKey, priKey);
test(crypto, priKey, pubKey, new ByteString("id-TA-RSA-v1-5-SHA-256", OID));
Documentation generated by
JSDoc on Tue Sep 3 22:29:38 2013