1

如何通过openssl以pem格式编写ecdsa私钥?我需要一个解决方案来解决这个问题;EC_KEY_check_key 返回错误码 ::reason(67)

     EVP_PKEY* priveECKey = EVP_PKEY_new();
     EC_KEY  *key =  EC_KEY_new();
     key = EC_KEY_new_by_curve_name(OBJ_sn2nid(strCurvename));
      BIGNUM *prv = BN_bin2bn((unsigned char*)priKeyTemplate[1].pValue, priKeyTemplate[1].ulValueLen, NULL);

     C_KEY_set_private_key(key, prv);
     if (EC_KEY_check_key(key))
     {
       printf("private key verified OK\n");
     }

      EVP_PKEY_assign_EC_KEY(priveECKey ,key);
      if (priveECKey == NULL)
      {
       PEM_write_PrivateKey(file, priveECKey, NULL, NULL, 0, 0, NULL );
      }
4

0 回答 0