Skip to content

Commit

Permalink
Add -pubin and -pubout options to rsa
Browse files Browse the repository at this point in the history
fix -putbout help message
  • Loading branch information
Yu-Ma28051503 committed Jul 16, 2024
1 parent 055982c commit 266b43f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/pkey/clu_rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ static const struct option rsa_options[] = {
{"-noout", no_argument, 0, WOLFCLU_NOOUT },
{"-modulus", no_argument, 0, WOLFCLU_MODULUS },
{"-RSAPublicKey_in", no_argument, 0, WOLFCLU_RSAPUBIN },
{"-pubin", no_argument, 0, WOLFCLU_RSAPUBIN },
{"-pubout", no_argument, 0, WOLFCLU_RSAPUBOUT },
{"-help", no_argument, 0, WOLFCLU_HELP },
{"-h", no_argument, 0, WOLFCLU_HELP },

Expand All @@ -55,6 +57,8 @@ static void wolfCLU_RSAHelp(void)
WOLFCLU_LOG(WOLFCLU_L0, "\t-noout do not print the key out when set");
WOLFCLU_LOG(WOLFCLU_L0, "\t-modulus print out the RSA modulus (n value)");
WOLFCLU_LOG(WOLFCLU_L0, "\t-RSAPublicKey_in expecting a public key input");
WOLFCLU_LOG(WOLFCLU_L0, "\t-pubin expecting a public key input");
WOLFCLU_LOG(WOLFCLU_L0, "\t-pubout output a public key");
}
#endif /* WOLFCLU_NO_FILESYSTEM */

Expand All @@ -69,6 +73,7 @@ int wolfCLU_RSA(int argc, char** argv)
int outForm = PEM_FORM;
int printModulus = 0;
int pubOnly = 0;
int pubOut = 0;
int noOut = 0;
int option;
int longIndex = 1;
Expand Down Expand Up @@ -121,6 +126,10 @@ int wolfCLU_RSA(int argc, char** argv)
pubOnly = 1;
break;

case WOLFCLU_RSAPUBOUT:
pubOut = 1;
break;

case WOLFCLU_NOOUT:
noOut = 1;
break;
Expand Down Expand Up @@ -207,7 +216,7 @@ int wolfCLU_RSA(int argc, char** argv)
int pemType;
int heapType;

if (pubOnly) {
if (pubOnly || pubOut) {
heapType = DYNAMIC_TYPE_PUBLIC_KEY;
pemType = PUBLICKEY_TYPE;

Expand Down
1 change: 1 addition & 0 deletions wolfclu/clu_optargs.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ enum {
WOLFCLU_PASSWORD_OUT,
WOLFCLU_PASSWORD_SOURCE,
WOLFCLU_RSAPUBIN,
WOLFCLU_RSAPUBOUT,
WOLFCLU_MODULUS,
WOLFCLU_KEY,
WOLFCLU_IV,
Expand Down

0 comments on commit 266b43f

Please sign in to comment.