mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Thu May 12 07:27:31 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
* ext/openssl/ossl_pkey_rsa.c: Use generic X.509 SubjectPublicKeyInfo format for encoding RSA public keys. [ruby-core:35327] [Bug #4421] Previous revision: 31507 M ChangeLog M ext/openssl/ossl_pkey_rsa.c git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fcd7300bf2
commit
1915a913ec
2 changed files with 15 additions and 9 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Thu May 12 07:27:31 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
|
||||||
|
|
||||||
|
* ext/openssl/ossl_pkey_rsa.c: Use generic X.509 SubjectPublicKeyInfo
|
||||||
|
format for encoding RSA public keys.
|
||||||
|
[ruby-core:35327] [Bug #4421]
|
||||||
|
|
||||||
Wed May 11 19:45:27 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
|
Wed May 11 19:45:27 2011 Keiju Ishitsuka <keiju@ishitsuka.com>
|
||||||
|
|
||||||
* lib/forwardable.rb: support 'delegate :foo => :bar' for to meet
|
* lib/forwardable.rb: support 'delegate :foo => :bar' for to meet
|
||||||
|
|
|
@ -156,11 +156,6 @@ ossl_rsa_initialize(int argc, VALUE *argv, VALUE self)
|
||||||
arg = ossl_to_der_if_possible(arg);
|
arg = ossl_to_der_if_possible(arg);
|
||||||
in = ossl_obj2bio(arg);
|
in = ossl_obj2bio(arg);
|
||||||
rsa = PEM_read_bio_RSAPrivateKey(in, NULL, ossl_pem_passwd_cb, passwd);
|
rsa = PEM_read_bio_RSAPrivateKey(in, NULL, ossl_pem_passwd_cb, passwd);
|
||||||
if (!rsa) {
|
|
||||||
(void)BIO_reset(in);
|
|
||||||
(void)ERR_get_error();
|
|
||||||
rsa = PEM_read_bio_RSAPublicKey(in, NULL, NULL, NULL);
|
|
||||||
}
|
|
||||||
if (!rsa) {
|
if (!rsa) {
|
||||||
(void)BIO_reset(in);
|
(void)BIO_reset(in);
|
||||||
(void)ERR_get_error();
|
(void)ERR_get_error();
|
||||||
|
@ -174,12 +169,17 @@ ossl_rsa_initialize(int argc, VALUE *argv, VALUE self)
|
||||||
if (!rsa) {
|
if (!rsa) {
|
||||||
(void)BIO_reset(in);
|
(void)BIO_reset(in);
|
||||||
(void)ERR_get_error();
|
(void)ERR_get_error();
|
||||||
rsa = d2i_RSAPublicKey_bio(in, NULL);
|
rsa = d2i_RSA_PUBKEY_bio(in, NULL);
|
||||||
}
|
}
|
||||||
if (!rsa) {
|
if (!rsa) {
|
||||||
(void)BIO_reset(in);
|
(void)BIO_reset(in);
|
||||||
(void)ERR_get_error();
|
(void)ERR_get_error();
|
||||||
rsa = d2i_RSA_PUBKEY_bio(in, NULL);
|
rsa = PEM_read_bio_RSAPublicKey(in, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
if (!rsa) {
|
||||||
|
(void)BIO_reset(in);
|
||||||
|
(void)ERR_get_error();
|
||||||
|
rsa = d2i_RSAPublicKey_bio(in, NULL);
|
||||||
}
|
}
|
||||||
BIO_free(in);
|
BIO_free(in);
|
||||||
if (!rsa) {
|
if (!rsa) {
|
||||||
|
@ -268,7 +268,7 @@ ossl_rsa_export(int argc, VALUE *argv, VALUE self)
|
||||||
ossl_raise(eRSAError, NULL);
|
ossl_raise(eRSAError, NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!PEM_write_bio_RSAPublicKey(out, pkey->pkey.rsa)) {
|
if (!PEM_write_bio_RSA_PUBKEY(out, pkey->pkey.rsa)) {
|
||||||
BIO_free(out);
|
BIO_free(out);
|
||||||
ossl_raise(eRSAError, NULL);
|
ossl_raise(eRSAError, NULL);
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ ossl_rsa_to_der(VALUE self)
|
||||||
if(RSA_HAS_PRIVATE(pkey->pkey.rsa))
|
if(RSA_HAS_PRIVATE(pkey->pkey.rsa))
|
||||||
i2d_func = i2d_RSAPrivateKey;
|
i2d_func = i2d_RSAPrivateKey;
|
||||||
else
|
else
|
||||||
i2d_func = i2d_RSAPublicKey;
|
i2d_func = (int (*)(const RSA*, unsigned char**))i2d_RSA_PUBKEY;
|
||||||
if((len = i2d_func(pkey->pkey.rsa, NULL)) <= 0)
|
if((len = i2d_func(pkey->pkey.rsa, NULL)) <= 0)
|
||||||
ossl_raise(eRSAError, NULL);
|
ossl_raise(eRSAError, NULL);
|
||||||
str = rb_str_new(0, len);
|
str = rb_str_new(0, len);
|
||||||
|
|
Loading…
Reference in a new issue