Loading CHANGES +5 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,11 @@ Changes between 0.9.8a and 0.9.9 [xx XXX xxxx] *) Integrated support for PVK file format and some related formats such as MS PUBLICKEYBLOB and PRIVATEKEYBLOB. Command line switches to support these in the 'rsa' and 'dsa' utilities. [Steve Henson] *) Support for PKCS#1 RSAPublicKey format on rsa utility command line. [Steve Henson] Loading apps/apps.c +19 −5 Original line number Diff line number Diff line Loading @@ -239,11 +239,18 @@ int str2fmt(char *s) else if ((*s == 'T') || (*s == 't')) return(FORMAT_TEXT); else if ((*s == 'P') || (*s == 'p')) { if (s[1] == 'V' || s[1] == 'v') return FORMAT_PVK; else return(FORMAT_PEM); } else if ((*s == 'N') || (*s == 'n')) return(FORMAT_NETSCAPE); else if ((*s == 'S') || (*s == 's')) return(FORMAT_SMIME); else if ((*s == 'M') || (*s == 'm')) return(FORMAT_MSBLOB); else if ((*s == '1') || (strcmp(s,"PKCS12") == 0) || (strcmp(s,"pkcs12") == 0) || (strcmp(s,"P12") == 0) || (strcmp(s,"p12") == 0)) Loading Loading @@ -879,6 +886,11 @@ EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin, &pkey, NULL, NULL)) goto end; } else if (format == FORMAT_MSBLOB) pkey = b2i_PrivateKey_bio(key); else if (format == FORMAT_PVK) pkey = b2i_PVK_bio(key, (pem_password_cb *)password_callback, &cb_data); else { BIO_printf(err,"bad input format specified for key file\n"); Loading Loading @@ -979,6 +991,8 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin, else if (format == FORMAT_NETSCAPE || format == FORMAT_IISSGC) pkey = load_netscape_key(err, key, file, key_descrip, format); #endif else if (format == FORMAT_MSBLOB) pkey = b2i_PublicKey_bio(key); else { BIO_printf(err,"bad input format specified for key file\n"); Loading apps/apps.h +2 −0 Original line number Diff line number Diff line Loading @@ -333,6 +333,8 @@ void policies_print(BIO *out, X509_STORE_CTX *ctx); * adding yet another param to load_*key() */ #define FORMAT_PEMRSA 9 /* PEM RSAPubicKey format */ #define FORMAT_ASN1RSA 10 /* DER RSAPubicKey format */ #define FORMAT_MSBLOB 11 /* MS Key blob format */ #define FORMAT_PVK 12 /* MS PVK file format */ #define EXT_COPY_NONE 0 #define EXT_COPY_ADD 1 Loading apps/dsa.c +24 −9 Original line number Diff line number Diff line Loading @@ -249,16 +249,22 @@ bad: } BIO_printf(bio_err,"read DSA key\n"); if (informat == FORMAT_ASN1) { if(pubin) dsa=d2i_DSA_PUBKEY_bio(in,NULL); else dsa=d2i_DSAPrivateKey_bio(in,NULL); } else if (informat == FORMAT_PEM) { if(pubin) dsa=PEM_read_bio_DSA_PUBKEY(in,NULL, NULL, NULL); else dsa=PEM_read_bio_DSAPrivateKey(in,NULL,NULL,passin); } else { BIO_printf(bio_err,"bad input format specified for key\n"); goto end; EVP_PKEY *pkey; if (pubin) pkey = load_pubkey(bio_err, infile, informat, 1, passin, e, "Public Key"); else pkey = load_key(bio_err, infile, informat, 1, passin, e, "Private Key"); if (pkey) { dsa = EVP_PKEY_get1_DSA(pkey); EVP_PKEY_free(pkey); } } if (dsa == NULL) { Loading Loading @@ -311,6 +317,15 @@ bad: i=PEM_write_bio_DSA_PUBKEY(out,dsa); else i=PEM_write_bio_DSAPrivateKey(out,dsa,enc, NULL,0,NULL, passout); } else if (outformat == FORMAT_MSBLOB) { EVP_PKEY *pk; pk = EVP_PKEY_new(); EVP_PKEY_set1_DSA(pk, dsa); if (pubin || pubout) i = i2b_PublicKey_bio(out, pk); else i = i2b_PrivateKey_bio(out, pk); EVP_PKEY_free(pk); } else { BIO_printf(bio_err,"bad output format specified for outfile\n"); goto end; Loading apps/rsa.c +19 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,8 @@ int MAIN(int argc, char **argv) #endif int modulus=0; int pvk_encr = 2; apps_startup(); if (bio_err == NULL) Loading Loading @@ -177,6 +179,12 @@ int MAIN(int argc, char **argv) pubin = 2; else if (strcmp(*argv,"-RSAPublicKey_out") == 0) pubout = 2; else if (strcmp(*argv,"-pvk-strong") == 0) pvk_encr=2; else if (strcmp(*argv,"-pvk-weak") == 0) pvk_encr=1; else if (strcmp(*argv,"-pvk-none") == 0) pvk_encr=0; else if (strcmp(*argv,"-noout") == 0) noout=1; else if (strcmp(*argv,"-text") == 0) Loading Loading @@ -390,6 +398,17 @@ bad: } else i=PEM_write_bio_RSAPrivateKey(out,rsa, enc,NULL,0,NULL,passout); } else if (outformat == FORMAT_MSBLOB || outformat == FORMAT_PVK) { EVP_PKEY *pk; pk = EVP_PKEY_new(); EVP_PKEY_set1_RSA(pk, rsa); if (outformat == FORMAT_PVK) i = i2b_PVK_bio(out, pk, pvk_encr, 0, passout); else if (pubin || pubout) i = i2b_PublicKey_bio(out, pk); else i = i2b_PrivateKey_bio(out, pk); EVP_PKEY_free(pk); } else { BIO_printf(bio_err,"bad output format specified for outfile\n"); goto end; Loading Loading
CHANGES +5 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,11 @@ Changes between 0.9.8a and 0.9.9 [xx XXX xxxx] *) Integrated support for PVK file format and some related formats such as MS PUBLICKEYBLOB and PRIVATEKEYBLOB. Command line switches to support these in the 'rsa' and 'dsa' utilities. [Steve Henson] *) Support for PKCS#1 RSAPublicKey format on rsa utility command line. [Steve Henson] Loading
apps/apps.c +19 −5 Original line number Diff line number Diff line Loading @@ -239,11 +239,18 @@ int str2fmt(char *s) else if ((*s == 'T') || (*s == 't')) return(FORMAT_TEXT); else if ((*s == 'P') || (*s == 'p')) { if (s[1] == 'V' || s[1] == 'v') return FORMAT_PVK; else return(FORMAT_PEM); } else if ((*s == 'N') || (*s == 'n')) return(FORMAT_NETSCAPE); else if ((*s == 'S') || (*s == 's')) return(FORMAT_SMIME); else if ((*s == 'M') || (*s == 'm')) return(FORMAT_MSBLOB); else if ((*s == '1') || (strcmp(s,"PKCS12") == 0) || (strcmp(s,"pkcs12") == 0) || (strcmp(s,"P12") == 0) || (strcmp(s,"p12") == 0)) Loading Loading @@ -879,6 +886,11 @@ EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin, &pkey, NULL, NULL)) goto end; } else if (format == FORMAT_MSBLOB) pkey = b2i_PrivateKey_bio(key); else if (format == FORMAT_PVK) pkey = b2i_PVK_bio(key, (pem_password_cb *)password_callback, &cb_data); else { BIO_printf(err,"bad input format specified for key file\n"); Loading Loading @@ -979,6 +991,8 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin, else if (format == FORMAT_NETSCAPE || format == FORMAT_IISSGC) pkey = load_netscape_key(err, key, file, key_descrip, format); #endif else if (format == FORMAT_MSBLOB) pkey = b2i_PublicKey_bio(key); else { BIO_printf(err,"bad input format specified for key file\n"); Loading
apps/apps.h +2 −0 Original line number Diff line number Diff line Loading @@ -333,6 +333,8 @@ void policies_print(BIO *out, X509_STORE_CTX *ctx); * adding yet another param to load_*key() */ #define FORMAT_PEMRSA 9 /* PEM RSAPubicKey format */ #define FORMAT_ASN1RSA 10 /* DER RSAPubicKey format */ #define FORMAT_MSBLOB 11 /* MS Key blob format */ #define FORMAT_PVK 12 /* MS PVK file format */ #define EXT_COPY_NONE 0 #define EXT_COPY_ADD 1 Loading
apps/dsa.c +24 −9 Original line number Diff line number Diff line Loading @@ -249,16 +249,22 @@ bad: } BIO_printf(bio_err,"read DSA key\n"); if (informat == FORMAT_ASN1) { if(pubin) dsa=d2i_DSA_PUBKEY_bio(in,NULL); else dsa=d2i_DSAPrivateKey_bio(in,NULL); } else if (informat == FORMAT_PEM) { if(pubin) dsa=PEM_read_bio_DSA_PUBKEY(in,NULL, NULL, NULL); else dsa=PEM_read_bio_DSAPrivateKey(in,NULL,NULL,passin); } else { BIO_printf(bio_err,"bad input format specified for key\n"); goto end; EVP_PKEY *pkey; if (pubin) pkey = load_pubkey(bio_err, infile, informat, 1, passin, e, "Public Key"); else pkey = load_key(bio_err, infile, informat, 1, passin, e, "Private Key"); if (pkey) { dsa = EVP_PKEY_get1_DSA(pkey); EVP_PKEY_free(pkey); } } if (dsa == NULL) { Loading Loading @@ -311,6 +317,15 @@ bad: i=PEM_write_bio_DSA_PUBKEY(out,dsa); else i=PEM_write_bio_DSAPrivateKey(out,dsa,enc, NULL,0,NULL, passout); } else if (outformat == FORMAT_MSBLOB) { EVP_PKEY *pk; pk = EVP_PKEY_new(); EVP_PKEY_set1_DSA(pk, dsa); if (pubin || pubout) i = i2b_PublicKey_bio(out, pk); else i = i2b_PrivateKey_bio(out, pk); EVP_PKEY_free(pk); } else { BIO_printf(bio_err,"bad output format specified for outfile\n"); goto end; Loading
apps/rsa.c +19 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,8 @@ int MAIN(int argc, char **argv) #endif int modulus=0; int pvk_encr = 2; apps_startup(); if (bio_err == NULL) Loading Loading @@ -177,6 +179,12 @@ int MAIN(int argc, char **argv) pubin = 2; else if (strcmp(*argv,"-RSAPublicKey_out") == 0) pubout = 2; else if (strcmp(*argv,"-pvk-strong") == 0) pvk_encr=2; else if (strcmp(*argv,"-pvk-weak") == 0) pvk_encr=1; else if (strcmp(*argv,"-pvk-none") == 0) pvk_encr=0; else if (strcmp(*argv,"-noout") == 0) noout=1; else if (strcmp(*argv,"-text") == 0) Loading Loading @@ -390,6 +398,17 @@ bad: } else i=PEM_write_bio_RSAPrivateKey(out,rsa, enc,NULL,0,NULL,passout); } else if (outformat == FORMAT_MSBLOB || outformat == FORMAT_PVK) { EVP_PKEY *pk; pk = EVP_PKEY_new(); EVP_PKEY_set1_RSA(pk, rsa); if (outformat == FORMAT_PVK) i = i2b_PVK_bio(out, pk, pvk_encr, 0, passout); else if (pubin || pubout) i = i2b_PublicKey_bio(out, pk); else i = i2b_PrivateKey_bio(out, pk); EVP_PKEY_free(pk); } else { BIO_printf(bio_err,"bad output format specified for outfile\n"); goto end; Loading