Skip to content

Commit

Permalink
pkey: getPrivateKey method
Browse files Browse the repository at this point in the history
  • Loading branch information
kunkku committed Apr 30, 2018
1 parent 88c535f commit 5257f2d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -3946,6 +3946,14 @@ static int pk_toPEM(lua_State *L) {
} /* pk_toPEM() */


static int pk_getPrivateKey(lua_State *L) {
if (!PEM_write_bio_PrivateKey(getbio(L), checksimple(L, 1, PKEY_CLASS), 0, 0, 0, 0, 0))
return auxL_error(L, auxL_EOPENSSL, "pkey:getPrivateKey");
pushbiostring(L);
return 1;
} /* pk_getPrivateKey() */


static int pk_getDefaultDigestName(lua_State *L) {
EVP_PKEY *key = checksimple(L, 1, PKEY_CLASS);
int nid;
Expand Down Expand Up @@ -4516,6 +4524,7 @@ static const auxL_Reg pk_methods[] = {
{ "verify", &pk_verify },
{ "getDefaultDigestName", &pk_getDefaultDigestName },
{ "toPEM", &pk_toPEM },
{ "getPrivateKey", &pk_getPrivateKey },
{ "getParameters", &pk_getParameters },
{ "setParameters", &pk_setParameters },
{ NULL, NULL },
Expand Down

0 comments on commit 5257f2d

Please sign in to comment.