diff options
author | Dr. Stephen Henson <steve@openssl.org> | 1999-11-21 22:28:31 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 1999-11-21 22:28:31 +0000 |
commit | 52664f5081939c96c5867fd02278f7575f1cab2d (patch) | |
tree | f2a5a01dcf50d2f54aa8114adf8ed59867754ed6 /apps/rsa.c | |
parent | a716d727347d6cd81534327901b509c6f5763f83 (diff) | |
download | openssl-52664f5081939c96c5867fd02278f7575f1cab2d.zip openssl-52664f5081939c96c5867fd02278f7575f1cab2d.tar.gz openssl-52664f5081939c96c5867fd02278f7575f1cab2d.tar.bz2 |
Transparent support for PKCS#8 private keys in RSA/DSA.
New universal public key format.
Fix CRL+cert load problem in by_file.c
Make verify report errors when loading files or dirs
Diffstat (limited to 'apps/rsa.c')
-rw-r--r-- | apps/rsa.c | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -220,6 +220,11 @@ bad: ERR_load_crypto_strings(); + if(check && pubin) { + BIO_printf(bio_err, "Only private keys can be checked\n"); + goto end; + } + in=BIO_new(BIO_s_file()); out=BIO_new(BIO_s_file()); if ((in == NULL) || (out == NULL)) @@ -239,9 +244,9 @@ bad: } } - BIO_printf(bio_err,"read RSA private key\n"); + BIO_printf(bio_err,"read RSA key\n"); if (informat == FORMAT_ASN1) { - if (pubin) rsa=d2i_RSAPublicKey_bio(in,NULL); + if (pubin) rsa=d2i_RSA_PUBKEY_bio(in,NULL); else rsa=d2i_RSAPrivateKey_bio(in,NULL); } #ifndef NO_RC4 @@ -272,7 +277,7 @@ bad: } #endif else if (informat == FORMAT_PEM) { - if(pubin) rsa=PEM_read_bio_RSAPublicKey(in,NULL,NULL,NULL); + if(pubin) rsa=PEM_read_bio_RSA_PUBKEY(in,NULL,NULL,NULL); else { if(passin) rsa=PEM_read_bio_RSAPrivateKey(in,NULL, key_cb,passin); @@ -286,7 +291,7 @@ bad: } if (rsa == NULL) { - BIO_printf(bio_err,"unable to load Key\n"); + BIO_printf(bio_err,"unable to load key\n"); ERR_print_errors(bio_err); goto end; } @@ -312,9 +317,9 @@ bad: if (modulus) { - fprintf(stdout,"Modulus="); + BIO_printf(out,"Modulus="); BN_print(out,rsa->n); - fprintf(stdout,"\n"); + BIO_printf(out,"\n"); } if (check) @@ -351,7 +356,7 @@ bad: } BIO_printf(bio_err,"writing RSA key\n"); if (outformat == FORMAT_ASN1) { - if(pubout || pubin) i=i2d_RSAPublicKey_bio(out,rsa); + if(pubout || pubin) i=i2d_RSA_PUBKEY_bio(out,rsa); else i=i2d_RSAPrivateKey_bio(out,rsa); } #ifndef NO_RC4 @@ -375,7 +380,7 @@ bad: #endif else if (outformat == FORMAT_PEM) { if(pubout || pubin) - i=PEM_write_bio_RSAPublicKey(out,rsa); + i=PEM_write_bio_RSA_PUBKEY(out,rsa); else { if(passout) i=PEM_write_bio_RSAPrivateKey(out,rsa, enc,NULL,0,key_cb,passout); |