ext/openssl/ossl_pkey.h File Reference

Go to the source code of this file.

Defines

#define _OSSL_PKEY_H_
#define OSSL_PKEY_SET_PRIVATE(obj)   rb_iv_set((obj), "private", Qtrue)
#define OSSL_PKEY_SET_PUBLIC(obj)   rb_iv_set((obj), "private", Qfalse)
#define OSSL_PKEY_IS_PRIVATE(obj)   (rb_iv_get((obj), "private") == Qtrue)
#define WrapPKey(klass, obj, pkey)
#define GetPKey(obj, pkey)
#define SafeGetPKey(obj, pkey)
#define HAVE_BN_GENCB   defined(HAVE_RSA_GENERATE_KEY_EX) || defined(HAVE_DH_GENERATE_PARAMETERS_EX) || defined(HAVE_DSA_GENERATE_PARAMETERS_EX)
#define OSSL_PKEY_BN(keytype, name)
#define DEF_OSSL_PKEY_BN(class, keytype, name)

Functions

void ossl_generate_cb (int, int, void *)
VALUE ossl_pkey_new (EVP_PKEY *)
VALUE ossl_pkey_new_from_file (VALUE)
EVP_PKEY * GetPKeyPtr (VALUE)
EVP_PKEY * DupPKeyPtr (VALUE)
EVP_PKEY * GetPrivPKeyPtr (VALUE)
EVP_PKEY * DupPrivPKeyPtr (VALUE)
void Init_ossl_pkey (void)
VALUE ossl_rsa_new (EVP_PKEY *)
void Init_ossl_rsa (void)
VALUE ossl_dsa_new (EVP_PKEY *)
void Init_ossl_dsa (void)
VALUE ossl_dh_new (EVP_PKEY *)
void Init_ossl_dh (void)
VALUE ossl_ec_new (EVP_PKEY *)
void Init_ossl_ec (void)

Variables

VALUE mPKey
VALUE cPKey
VALUE ePKeyError
ID id_private_q
VALUE cRSA
VALUE eRSAError
VALUE cDSA
VALUE eDSAError
VALUE cDH
VALUE eDHError
DH * OSSL_DEFAULT_DH_512
DH * OSSL_DEFAULT_DH_1024
VALUE cEC
VALUE eECError
VALUE cEC_GROUP
VALUE eEC_GROUP
VALUE cEC_POINT
VALUE eEC_POINT


Define Documentation

#define _OSSL_PKEY_H_

Definition at line 12 of file ossl_pkey.h.

#define DEF_OSSL_PKEY_BN ( class,
keytype,
name   ) 

Value:

do {                                                                    \
        rb_define_method((class), #name, ossl_##keytype##_get_##name, 0);       \
        rb_define_method((class), #name "=", ossl_##keytype##_set_##name, 1);\
} while (0)

Definition at line 139 of file ossl_pkey.h.

Referenced by Init_ossl_dh(), Init_ossl_dsa(), and Init_ossl_rsa().

#define GetPKey ( obj,
pkey   ) 

Value:

do {\
    Data_Get_Struct((obj), EVP_PKEY, (pkey));\
    if (!(pkey)) { \
        rb_raise(rb_eRuntimeError, "PKEY wasn't initialized!");\
    } \
} while (0)

Definition at line 30 of file ossl_pkey.h.

Referenced by ossl_dh_initialize(), ossl_dsa_initialize(), ossl_pkey_sign(), ossl_pkey_verify(), and ossl_rsa_initialize().

#define HAVE_BN_GENCB   defined(HAVE_RSA_GENERATE_KEY_EX) || defined(HAVE_DH_GENERATE_PARAMETERS_EX) || defined(HAVE_DSA_GENERATE_PARAMETERS_EX)

Definition at line 42 of file ossl_pkey.h.

#define OSSL_PKEY_BN ( keytype,
name   ) 

Definition at line 103 of file ossl_pkey.h.

#define OSSL_PKEY_IS_PRIVATE ( obj   )     (rb_iv_get((obj), "private") == Qtrue)

Definition at line 21 of file ossl_pkey.h.

#define OSSL_PKEY_SET_PRIVATE ( obj   )     rb_iv_set((obj), "private", Qtrue)

Definition at line 19 of file ossl_pkey.h.

#define OSSL_PKEY_SET_PUBLIC ( obj   )     rb_iv_set((obj), "private", Qfalse)

Definition at line 20 of file ossl_pkey.h.

#define SafeGetPKey ( obj,
pkey   ) 

Value:

do { \
    OSSL_Check_Kind((obj), cPKey); \
    GetPKey((obj), (pkey)); \
} while (0)

Definition at line 36 of file ossl_pkey.h.

Referenced by DupPKeyPtr(), DupPrivPKeyPtr(), GetPKeyPtr(), and GetPrivPKeyPtr().

#define WrapPKey ( klass,
obj,
pkey   ) 

Value:

do { \
    if (!(pkey)) { \
        rb_raise(rb_eRuntimeError, "PKEY wasn't initialized!"); \
    } \
    (obj) = Data_Wrap_Struct((klass), 0, EVP_PKEY_free, (pkey)); \
    OSSL_PKEY_SET_PUBLIC(obj); \
} while (0)

Definition at line 23 of file ossl_pkey.h.

Referenced by dh_instance(), dsa_instance(), ossl_dh_new(), ossl_dsa_new(), ossl_pkey_alloc(), ossl_rsa_new(), and rsa_instance().


Function Documentation

EVP_PKEY* DupPKeyPtr ( VALUE   ) 

Definition at line 197 of file ossl_pkey.c.

References SafeGetPKey.

Referenced by ossl_client_cert_cb().

EVP_PKEY* DupPrivPKeyPtr ( VALUE   ) 

Definition at line 208 of file ossl_pkey.c.

References id_private_q, NULL, ossl_raise(), Qtrue, rb_eArgError, rb_funcall(), and SafeGetPKey.

EVP_PKEY* GetPKeyPtr ( VALUE   ) 

Definition at line 174 of file ossl_pkey.c.

References SafeGetPKey.

Referenced by ossl_call_client_cert_cb(), ossl_call_tmp_dh_callback(), ossl_pkcs12_s_create(), ossl_spki_set_public_key(), ossl_spki_verify(), ossl_sslctx_setup(), ossl_tmp_dh_callback(), ossl_x509_set_public_key(), ossl_x509_verify(), ossl_x509crl_verify(), ossl_x509req_set_public_key(), and ossl_x509req_verify().

EVP_PKEY* GetPrivPKeyPtr ( VALUE   ) 

Definition at line 184 of file ossl_pkey.c.

References id_private_q, NULL, ossl_raise(), Qtrue, rb_eArgError, rb_funcall(), and SafeGetPKey.

Referenced by ossl_pkcs7_decrypt(), ossl_pkcs7_s_sign(), ossl_pkcs7si_initialize(), ossl_spki_sign(), ossl_x509_check_private_key(), ossl_x509_sign(), ossl_x509crl_sign(), and ossl_x509req_sign().

void Init_ossl_dh ( void   ) 

Definition at line 591 of file ossl_pkey_dh.c.

References cDH, cPKey, DEF_OSSL_PKEY_BN, DEFAULT_DH_1024_GEN, DEFAULT_DH_1024_PRIM, DEFAULT_DH_512_GEN, DEFAULT_DH_512_PRIM, eDHError, ePKeyError, mOSSL, mPKey, ossl_create_dh(), OSSL_DEFAULT_DH_1024, OSSL_DEFAULT_DH_512, ossl_dh_check_params(), ossl_dh_compute_key(), ossl_dh_export(), ossl_dh_generate_key(), ossl_dh_get_params(), ossl_dh_initialize(), ossl_dh_is_private(), ossl_dh_is_public(), ossl_dh_s_generate(), ossl_dh_to_der(), ossl_dh_to_public_key(), ossl_dh_to_text(), rb_define_alias(), rb_define_class_under(), rb_define_method(), rb_define_module(), rb_define_module_under(), and rb_define_singleton_method().

Referenced by Init_ossl_pkey().

void Init_ossl_dsa ( void   ) 

Definition at line 566 of file ossl_pkey_dsa.c.

References cDSA, cPKey, DEF_OSSL_PKEY_BN, eDSAError, ePKeyError, mOSSL, mPKey, ossl_dsa_export(), ossl_dsa_get_params(), ossl_dsa_initialize(), ossl_dsa_is_private(), ossl_dsa_is_public(), ossl_dsa_s_generate(), ossl_dsa_sign(), ossl_dsa_to_der(), ossl_dsa_to_public_key(), ossl_dsa_to_text(), ossl_dsa_verify(), rb_define_alias(), rb_define_class_under(), rb_define_method(), rb_define_module(), rb_define_module_under(), and rb_define_singleton_method().

Referenced by Init_ossl_pkey().

void Init_ossl_ec ( void   ) 

Definition at line 1680 of file ossl_pkey_ec.c.

Referenced by Init_ossl_pkey().

void Init_ossl_pkey ( void   ) 

Definition at line 345 of file ossl_pkey.c.

References cPKey, eOSSLError, ePKeyError, id_private_q, Init_ossl_dh(), Init_ossl_dsa(), Init_ossl_ec(), Init_ossl_rsa(), mOSSL, mPKey, ossl_pkey_alloc(), ossl_pkey_initialize(), ossl_pkey_new_from_data(), ossl_pkey_sign(), ossl_pkey_verify(), rb_cObject, rb_define_alloc_func(), rb_define_class_under(), rb_define_method(), rb_define_module(), rb_define_module_function(), rb_define_module_under(), and rb_intern.

Referenced by Init_openssl().

void Init_ossl_rsa ( void   ) 

Definition at line 629 of file ossl_pkey_rsa.c.

References cPKey, cRSA, DEF_OSSL_PKEY_BN, DefRSAConst, ePKeyError, eRSAError, mOSSL, mPKey, ossl_rsa_export(), ossl_rsa_get_params(), ossl_rsa_initialize(), ossl_rsa_is_private(), ossl_rsa_is_public(), ossl_rsa_private_decrypt(), ossl_rsa_private_encrypt(), ossl_rsa_public_decrypt(), ossl_rsa_public_encrypt(), ossl_rsa_s_generate(), ossl_rsa_to_der(), ossl_rsa_to_public_key(), ossl_rsa_to_text(), rb_define_alias(), rb_define_class_under(), rb_define_method(), rb_define_module(), rb_define_module_under(), and rb_define_singleton_method().

Referenced by Init_ossl_pkey().

VALUE ossl_dh_new ( EVP_PKEY *   ) 

Definition at line 62 of file ossl_pkey_dh.c.

References cDH, dh_instance(), eDHError, NULL, ossl_raise(), Qfalse, rb_eTypeError, VALUE, and WrapPKey.

Referenced by ossl_pkey_new().

VALUE ossl_dsa_new ( EVP_PKEY *   ) 

Definition at line 56 of file ossl_pkey_dsa.c.

References cDSA, dsa_instance(), eDSAError, NULL, ossl_raise(), Qfalse, rb_eTypeError, VALUE, and WrapPKey.

Referenced by ossl_pkey_new().

VALUE ossl_ec_new ( EVP_PKEY *   ) 

Referenced by ossl_pkey_new().

void ossl_generate_cb ( int  ,
int  ,
void *   
)

Definition at line 25 of file ossl_pkey.c.

References INT2NUM, rb_ary_new2, rb_ary_store(), rb_yield(), and VALUE.

Referenced by dh_generate(), dsa_generate(), and rsa_generate().

VALUE ossl_pkey_new ( EVP_PKEY *   ) 

Definition at line 76 of file ossl_pkey.c.

References ePKeyError, ossl_dh_new(), ossl_dsa_new(), ossl_ec_new(), ossl_raise(), ossl_rsa_new(), and UNREACHABLE.

Referenced by ossl_pkcs12_initialize(), ossl_pkey_new_from_data(), ossl_pkey_new_from_file(), ossl_spki_get_public_key(), ossl_x509_get_public_key(), and ossl_x509req_get_public_key().

VALUE ossl_pkey_new_from_file ( VALUE   ) 

Definition at line 106 of file ossl_pkey.c.

References ePKeyError, errno, fileno, NULL, ossl_pem_passwd_cb(), ossl_pkey_new(), ossl_raise(), rb_fd_fix_cloexec(), RSTRING_PTR, SafeStringValue, and strerror().

VALUE ossl_rsa_new ( EVP_PKEY *   ) 

Definition at line 56 of file ossl_pkey_rsa.c.

References cRSA, eRSAError, NULL, ossl_raise(), Qfalse, rb_eTypeError, rsa_instance(), VALUE, and WrapPKey.

Referenced by ossl_pkey_new().


Variable Documentation

VALUE cDH

Definition at line 34 of file ossl_pkey_dh.c.

Referenced by Init_ossl_dh(), and ossl_dh_new().

VALUE cDSA

Definition at line 28 of file ossl_pkey_dsa.c.

Referenced by Init_ossl_dsa(), and ossl_dsa_new().

VALUE cEC

VALUE cEC_GROUP

VALUE cEC_POINT

VALUE cPKey

Definition at line 17 of file ossl_pkey.c.

Referenced by Init_ossl_dh(), Init_ossl_dsa(), Init_ossl_pkey(), Init_ossl_rsa(), and ossl_pkey_initialize().

VALUE cRSA

Definition at line 28 of file ossl_pkey_rsa.c.

Referenced by Init_ossl_rsa(), and ossl_rsa_new().

VALUE eDHError

Definition at line 35 of file ossl_pkey_dh.c.

Referenced by Init_ossl_dh(), ossl_create_dh(), ossl_dh_compute_key(), ossl_dh_export(), ossl_dh_generate_key(), ossl_dh_initialize(), ossl_dh_new(), ossl_dh_s_generate(), ossl_dh_to_der(), ossl_dh_to_public_key(), and ossl_dh_to_text().

VALUE eDSAError

Definition at line 29 of file ossl_pkey_dsa.c.

Referenced by Init_ossl_dsa(), ossl_dsa_export(), ossl_dsa_initialize(), ossl_dsa_new(), ossl_dsa_s_generate(), ossl_dsa_sign(), ossl_dsa_to_der(), ossl_dsa_to_public_key(), ossl_dsa_to_text(), and ossl_dsa_verify().

VALUE eEC_GROUP

VALUE eEC_POINT

VALUE eECError

VALUE ePKeyError

Definition at line 18 of file ossl_pkey.c.

Referenced by Init_ossl_dh(), Init_ossl_dsa(), Init_ossl_pkey(), Init_ossl_rsa(), ossl_pkey_alloc(), ossl_pkey_new(), ossl_pkey_new_from_file(), ossl_pkey_sign(), and ossl_pkey_verify().

VALUE eRSAError

Definition at line 29 of file ossl_pkey_rsa.c.

Referenced by Init_ossl_rsa(), ossl_rsa_export(), ossl_rsa_initialize(), ossl_rsa_new(), ossl_rsa_private_decrypt(), ossl_rsa_private_encrypt(), ossl_rsa_public_decrypt(), ossl_rsa_public_encrypt(), ossl_rsa_s_generate(), ossl_rsa_to_der(), ossl_rsa_to_public_key(), and ossl_rsa_to_text().

ID id_private_q

Definition at line 19 of file ossl_pkey.c.

Referenced by DupPrivPKeyPtr(), GetPrivPKeyPtr(), Init_ossl_pkey(), and ossl_pkey_sign().

VALUE mPKey

Definition at line 16 of file ossl_pkey.c.

Referenced by Init_ossl_dh(), Init_ossl_dsa(), Init_ossl_pkey(), and Init_ossl_rsa().

DH* OSSL_DEFAULT_DH_1024

Definition at line 569 of file ossl_pkey_dh.c.

Referenced by Init_ossl_dh(), and ossl_default_tmp_dh_callback().

DH* OSSL_DEFAULT_DH_512

Definition at line 541 of file ossl_pkey_dh.c.

Referenced by Init_ossl_dh(), and ossl_default_tmp_dh_callback().


Generated on 19 Jul 2016 for Ruby by  doxygen 1.4.7