Loading tools/itscertgen/asn1certgen/asn1certgen.c +27 −15 Original line number Diff line number Diff line Loading @@ -404,9 +404,6 @@ int main(int argc, char ** argv) // generate keys if necessary // buf = name of private key file cvstrncpy(buf, CERT_MAX_SIZE, _keyPath, "/", _profileName, EXT_VKEY, NULL); if (_force){ remove(buf); } switch (cert->toBeSigned.verifyKeyIndicator.present){ case VerificationKeyIndicator_PR_verificationKey: switch (cert->toBeSigned.verifyKeyIndicator.choice.verificationKey.present){ Loading Loading @@ -434,9 +431,6 @@ int main(int argc, char ** argv) } if (cert->toBeSigned.encryptionKey){ cvstrncpy(buf, CERT_MAX_SIZE, _keyPath, "/", _profileName, EXT_EKEY, NULL); if (_force){ remove(buf); } switch (cert->toBeSigned.encryptionKey->publicKey.present){ case BasePublicEncryptionKey_PR_NOTHING: cert->toBeSigned.encryptionKey->publicKey.present = BasePublicEncryptionKey_PR_eciesNistP256; Loading Loading @@ -496,10 +490,23 @@ static void fill_curve_point_eccP256(EccP256CurvePoint_t* point, ecc_curve_id cu static void fill_curve_point_eccP384(EccP384CurvePoint_t* point, ecc_curve_id curveType, char * keyPath) { void * key; void * key = NULL; char x[48], y[48]; int compressed_y; int fsize; char * e_pub = keyPath + strlen(keyPath); if(!_force){ // check for public key strcpy(e_pub, EXT_PUB); key = ecc_key_public_load(keyPath, curveType); if (_debug && key){ fprintf(stderr, "DEBUG: use pre-generated key %s\n", keyPath); } *e_pub = 0; } else { remove(keyPath); } if (key == NULL){ key = ecc_key_private_load(keyPath, curveType); if (key == NULL){ if (_debug){ Loading @@ -507,8 +514,13 @@ static void fill_curve_point_eccP384(EccP384CurvePoint_t* point, ecc_curve_id cu } key = ecc_key_gen(curveType); ecc_key_private_save(key, keyPath, _outKeyFormat); strcat(keyPath, EXT_PUB); strcpy(e_pub, EXT_PUB); ecc_key_public_save(key, keyPath, _outKeyFormat); }else{ if (_debug){ fprintf(stderr, "DEBUG: use pre-generated key %s\n", keyPath); } } } fsize = ecc_key_public(key, x, y, &compressed_y); if (fsize > 0){ Loading Loading
tools/itscertgen/asn1certgen/asn1certgen.c +27 −15 Original line number Diff line number Diff line Loading @@ -404,9 +404,6 @@ int main(int argc, char ** argv) // generate keys if necessary // buf = name of private key file cvstrncpy(buf, CERT_MAX_SIZE, _keyPath, "/", _profileName, EXT_VKEY, NULL); if (_force){ remove(buf); } switch (cert->toBeSigned.verifyKeyIndicator.present){ case VerificationKeyIndicator_PR_verificationKey: switch (cert->toBeSigned.verifyKeyIndicator.choice.verificationKey.present){ Loading Loading @@ -434,9 +431,6 @@ int main(int argc, char ** argv) } if (cert->toBeSigned.encryptionKey){ cvstrncpy(buf, CERT_MAX_SIZE, _keyPath, "/", _profileName, EXT_EKEY, NULL); if (_force){ remove(buf); } switch (cert->toBeSigned.encryptionKey->publicKey.present){ case BasePublicEncryptionKey_PR_NOTHING: cert->toBeSigned.encryptionKey->publicKey.present = BasePublicEncryptionKey_PR_eciesNistP256; Loading Loading @@ -496,10 +490,23 @@ static void fill_curve_point_eccP256(EccP256CurvePoint_t* point, ecc_curve_id cu static void fill_curve_point_eccP384(EccP384CurvePoint_t* point, ecc_curve_id curveType, char * keyPath) { void * key; void * key = NULL; char x[48], y[48]; int compressed_y; int fsize; char * e_pub = keyPath + strlen(keyPath); if(!_force){ // check for public key strcpy(e_pub, EXT_PUB); key = ecc_key_public_load(keyPath, curveType); if (_debug && key){ fprintf(stderr, "DEBUG: use pre-generated key %s\n", keyPath); } *e_pub = 0; } else { remove(keyPath); } if (key == NULL){ key = ecc_key_private_load(keyPath, curveType); if (key == NULL){ if (_debug){ Loading @@ -507,8 +514,13 @@ static void fill_curve_point_eccP384(EccP384CurvePoint_t* point, ecc_curve_id cu } key = ecc_key_gen(curveType); ecc_key_private_save(key, keyPath, _outKeyFormat); strcat(keyPath, EXT_PUB); strcpy(e_pub, EXT_PUB); ecc_key_public_save(key, keyPath, _outKeyFormat); }else{ if (_debug){ fprintf(stderr, "DEBUG: use pre-generated key %s\n", keyPath); } } } fsize = ecc_key_public(key, x, y, &compressed_y); if (fsize > 0){ Loading