Hi!
I generated a DSA key pair and wrote the private key into a file, like following:
DSA *pair = DSA_generate_parameters(1024, NULL, 0, NULL, NULL, NULL, NULL);
DSA_generate_key(pair)
EVP_PKEY *pkey = EVP_PKEY_new();
EVP_PKEY_assign_DSA(pkey, pair);
FILE *fp = fopen("dsaprivatekey.pem", "w");
const EVP_CIPHER *c = EVP_des_ede3_cbc();
string password = "abc123";
int klen = password.length
();
unsigned char *kstr = new unsigned char[klen];
memcpy(kstr, password.c_str(), klen);
PEM_write_PrivateKey(fp,pkey, c, kstr, klen, NULL, NULL); // writes the private key into a file
fclose(fp);
Now I'd like to write the DSA public key into a file too, like the equivalent PEM_writeRSAPublicKey method does to RSA key pairs, but I didn't find any method to do this. There are some other method that does this to DSA keys? Or the solution is only via command line to generate a file with the public key?
Thanks for the help!
- There are no method PEM_writeDSAPublicKey?? Camila Moraes
- Re: There are no method PEM_writeDSAPublicKey?? Dr. Stephen Henson