|
|
@ -178,7 +178,7 @@ int test2() { |
|
|
|
|
|
|
|
|
if(0 != ecdaa_signature_FP256BN_verify(&sig2, &ipk2.gpk, &revocations, msg, msg_len, bsn, bsn_len)) { |
|
|
if(0 != ecdaa_signature_FP256BN_verify(&sig2, &ipk2.gpk, &revocations, msg, msg_len, bsn, bsn_len)) { |
|
|
printf("verify message failed\n"); |
|
|
printf("verify message failed\n"); |
|
|
//return 1;
|
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
strncpy(bsn, "test basename", 13); |
|
|
strncpy(bsn, "test basename", 13); |
|
|
@ -238,15 +238,30 @@ int test3() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ecdaa_issuer_public_key_FP256BN_serialize(binbuf, &ipk); |
|
|
ecdaa_issuer_public_key_FP256BN_serialize(binbuf, &ipk); |
|
|
ecdaa_bintohex(binbuf, current, ECDAA_ISSUER_PUBLIC_KEY_FP256BN_LENGTH); |
|
|
int numbytes = ecdaa_encode(binbuf, current, ECDAA_ISSUER_PUBLIC_KEY_FP256BN_LENGTH); |
|
|
|
|
|
current = ¤t[numbytes]; |
|
|
|
|
|
|
|
|
if(0 != ecdaa_issuer_public_key_FP256BN_deserialize_file(&ipk2, "ipktest.bin") || |
|
|
bzero(binbuf,MAX_BUFSIZE); |
|
|
0 != ecdaa_issuer_secret_key_FP256BN_deserialize_file(&isk2, "isktest.bin")) { |
|
|
ecdaa_issuer_secret_key_FP256BN_serialize(binbuf, &isk); |
|
|
|
|
|
numbytes += ecdaa_encode(binbuf, current, ECDAA_ISSUER_SECRET_KEY_FP256BN_LENGTH); |
|
|
|
|
|
//current = &buffer[numbytes];
|
|
|
|
|
|
|
|
|
|
|
|
printf("Encoded issuer key pair: %s\n%s\n", buffer, current); |
|
|
|
|
|
|
|
|
|
|
|
current = buffer; |
|
|
|
|
|
int numbytes2 = ecdaa_decode(current, binbuf, ECDAA_ISSUER_PUBLIC_KEY_FP256BN_LENGTH); |
|
|
|
|
|
int ret = ecdaa_issuer_public_key_FP256BN_deserialize(&ipk2, binbuf); |
|
|
|
|
|
|
|
|
|
|
|
current = &buffer[numbytes2]; |
|
|
|
|
|
bzero(binbuf,MAX_BUFSIZE); |
|
|
|
|
|
numbytes2 += ecdaa_decode(current, binbuf, ECDAA_ISSUER_SECRET_KEY_FP256BN_LENGTH); |
|
|
|
|
|
ret += ecdaa_issuer_secret_key_FP256BN_deserialize(&isk2, binbuf); |
|
|
|
|
|
if(0 != ret) { |
|
|
|
|
|
printf("numbytes = %i, numbytes2 = %i\n", numbytes, numbytes2); |
|
|
printf("loading issuer key pair failed\n"); |
|
|
printf("loading issuer key pair failed\n"); |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ecdaa_rand(nonce, NONCE_SIZE); |
|
|
ecdaa_rand(nonce, NONCE_SIZE); |
|
|
if(0 != ecdaa_member_key_pair_FP256BN_generate(&mpk, &msk, nonce, NONCE_SIZE, ecdaa_rand)) { |
|
|
if(0 != ecdaa_member_key_pair_FP256BN_generate(&mpk, &msk, nonce, NONCE_SIZE, ecdaa_rand)) { |
|
|
printf("generate member key pair failed\n"); |
|
|
printf("generate member key pair failed\n"); |
|
|
|