ossl_pkey.c File Reference
`#include "ossl.h"`

Go to the source code of this file.

## Functions

void | ossl_generate_cb (int p, int n, void *arg)
VALUE | ossl_pkey_new (EVP_PKEY *pkey)
VALUE | ossl_pkey_new_from_file (VALUE filename)
static VALUE | ossl_pkey_new_from_data (int argc, VALUE *argv, VALUE self)
EVP_PKEY * | GetPKeyPtr (VALUE obj)
EVP_PKEY * | GetPrivPKeyPtr (VALUE obj)
EVP_PKEY * | DupPKeyPtr (VALUE obj)
EVP_PKEY * | DupPrivPKeyPtr (VALUE obj)
static VALUE | ossl_pkey_alloc (VALUE klass)
static VALUE | ossl_pkey_initialize (VALUE self)
static VALUE | ossl_pkey_sign (VALUE self, VALUE digest, VALUE data)
static VALUE | ossl_pkey_verify (VALUE self, VALUE digest, VALUE sig, VALUE data)
void | Init_ossl_pkey ()

## Variables

VALUE | mPKey
VALUE | cPKey
VALUE | ePKeyError
ID | id_private_q

## Function Documentation

EVP_PKEY* DupPKeyPtr | ( | VALUE | obj | ) |

Definition at line 159 of file ossl_pkey.c.

References SafeGetPKey.

Referenced by ossl_client_cert_cb().

EVP_PKEY* DupPrivPKeyPtr | ( | VALUE | obj | ) |

Definition at line 170 of file ossl_pkey.c.

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

EVP_PKEY* GetPKeyPtr | ( | VALUE | obj | ) |

Definition at line 136 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 | obj | ) |

Definition at line 146 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_pkey | ( | void |  | ) |

Definition at line 304 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 ossl_generate_cb | ( | int | p,
|  | int | n,
|  | void * | arg
| ) |  |

Definition at line 25 of file ossl_pkey.c.

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

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

static VALUE ossl_pkey_alloc | ( | VALUE | klass | ) |

static

Definition at line 187 of file ossl_pkey.c.

References ePKeyError, NULL, ossl_raise(), and WrapPKey.

Referenced by Init_ossl_pkey().

static VALUE ossl_pkey_initialize | ( | VALUE | self | ) |

static

Definition at line 208 of file ossl_pkey.c.

References cPKey, ossl_raise(), rb_eNotImpError, and rb_obj_is_instance_of().

Referenced by Init_ossl_pkey().

VALUE ossl_pkey_new | ( | EVP_PKEY * | pkey | ) |

Definition at line 40 of file ossl_pkey.c.

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

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().

static VALUE ossl_pkey_new_from_data | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |

static

Definition at line 102 of file ossl_pkey.c.

References NIL_P, NULL, OSSL_BIO_reset, ossl_obj2bio(), ossl_pem_passwd_cb(), ossl_pkey_new(), ossl_raise(), rb_eArgError, rb_scan_args(), and StringValuePtr.

Referenced by Init_ossl_pkey().

VALUE ossl_pkey_new_from_file | ( | VALUE | filename | ) |

Definition at line 69 of file ossl_pkey.c.

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

static VALUE ossl_pkey_sign | ( | VALUE | self,
|  | VALUE | digest,
|  | VALUE | data
| ) |  |

static

Definition at line 234 of file ossl_pkey.c.

References assert, ePKeyError, GetDigestPtr(), GetPKey, id_private_q, NULL, ossl_raise(), Qtrue, rb_eArgError, rb_funcall(), rb_str_new(), rb_str_set_len, RSTRING_LEN, RSTRING_PTR, and StringValue.

Referenced by Init_ossl_pkey().

static VALUE ossl_pkey_verify | ( | VALUE | self,
|  | VALUE | digest,
|  | VALUE | sig,
|  | VALUE | data
| ) |  |

static

Definition at line 279 of file ossl_pkey.c.

References ePKeyError, GetDigestPtr(), GetPKey, NULL, ossl_raise(), Qfalse, Qnil, Qtrue, RSTRING_LEN, RSTRING_LENINT, RSTRING_PTR, and StringValue.

Referenced by Init_ossl_pkey().

## Variable Documentation

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 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().

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().