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

Go to the source code of this file.

## Macros

#define | WrapPKCS12(klass, obj, p12)
#define | GetPKCS12(obj, p12)
#define | SafeGetPKCS12(obj, p12)
#define | ossl_pkcs12_set_key(o, v) rb_iv_set((o), "@key", (v))
#define | ossl_pkcs12_set_cert(o, v) rb_iv_set((o), "@certificate", (v))
#define | ossl_pkcs12_set_ca_certs(o, v) rb_iv_set((o), "@ca_certs", (v))
#define | ossl_pkcs12_get_key(o) rb_iv_get((o), "@key")
#define | ossl_pkcs12_get_cert(o) rb_iv_get((o), "@certificate")
#define | ossl_pkcs12_get_ca_certs(o) rb_iv_get((o), "@ca_certs")

## Functions

static VALUE | ossl_pkcs12_s_allocate (VALUE klass)
static VALUE | ossl_pkcs12_s_create (int argc, VALUE *argv, VALUE self)
static VALUE | ossl_pkcs12_initialize (int argc, VALUE *argv, VALUE self)
static VALUE | ossl_pkcs12_to_der (VALUE self)
void | Init_ossl_pkcs12 ()

## Variables

VALUE | cPKCS12
VALUE | ePKCS12Error

## Macro Definition Documentation

#define GetPKCS12 | ( |  | obj,
|  |  | p12
| ) |  |

Value:
do { \
Data_Get_Struct((obj), PKCS12, (p12)); \
if(!(p12)) ossl_raise(rb_eRuntimeError, "PKCS12 wasn't initialized."); \
} while (0)

Definition at line 13 of file ossl_pkcs12.c.

Referenced by ossl_pkcs12_to_der().

#define ossl_pkcs12_get_ca_certs | ( |  | o | ) | rb_iv_get((o), "@ca_certs")

Definition at line 28 of file ossl_pkcs12.c.

#define ossl_pkcs12_get_cert | ( |  | o | ) | rb_iv_get((o), "@certificate")

Definition at line 27 of file ossl_pkcs12.c.

#define ossl_pkcs12_get_key | ( |  | o | ) | rb_iv_get((o), "@key")

Definition at line 26 of file ossl_pkcs12.c.

#define ossl_pkcs12_set_ca_certs | ( |  | o,
|  |  | v
| ) |  | rb_iv_set((o), "@ca_certs", (v))

Definition at line 25 of file ossl_pkcs12.c.

Referenced by ossl_pkcs12_initialize(), and ossl_pkcs12_s_create().

#define ossl_pkcs12_set_cert | ( |  | o,
|  |  | v
| ) |  | rb_iv_set((o), "@certificate", (v))

Definition at line 24 of file ossl_pkcs12.c.

Referenced by ossl_pkcs12_initialize(), and ossl_pkcs12_s_create().

#define ossl_pkcs12_set_key | ( |  | o,
|  |  | v
| ) |  | rb_iv_set((o), "@key", (v))

Definition at line 23 of file ossl_pkcs12.c.

Referenced by ossl_pkcs12_initialize(), and ossl_pkcs12_s_create().

#define SafeGetPKCS12 | ( |  | obj,
|  |  | p12
| ) |  |

Value:
do { \
OSSL_Check_Kind((obj), cPKCS12); \
GetPKCS12((obj), (p12)); \
} while (0)

Definition at line 18 of file ossl_pkcs12.c.

#define WrapPKCS12 | ( |  | klass,
|  |  | obj,
|  |  | p12
| ) |  |

Value:
do { \
if(!(p12)) ossl_raise(rb_eRuntimeError, "PKCS12 wasn't initialized."); \
(obj) = Data_Wrap_Struct((klass), 0, PKCS12_free, (p12)); \
} while (0)

Definition at line 8 of file ossl_pkcs12.c.

Referenced by ossl_pkcs12_s_allocate(), and ossl_pkcs12_s_create().

## Function Documentation

void Init_ossl_pkcs12 | ( | void |  | ) |

Definition at line 195 of file ossl_pkcs12.c.

References cPKCS12, eOSSLError, ePKCS12Error, mOSSL, ossl_pkcs12_initialize(), ossl_pkcs12_s_allocate(), ossl_pkcs12_s_create(), ossl_pkcs12_to_der(), Qfalse, rb_attr(), rb_cObject, rb_define_alloc_func(), rb_define_class_under(), rb_define_method(), rb_define_singleton_method(), and rb_intern.

Referenced by Init_openssl().

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

static

Definition at line 131 of file ossl_pkcs12.c.

References _, arg, DATA_PTR, ePKCS12Error, err, NIL_P, NULL, ossl_obj2bio(), ossl_pkcs12_set_ca_certs, ossl_pkcs12_set_cert, ossl_pkcs12_set_key, ossl_pkey_new(), ossl_raise(), ossl_x509_new(), ossl_x509_sk2ary(), Qnil, rb_jump_tag(), rb_protect(), rb_scan_args(), STACK_OF(), and StringValuePtr.

Referenced by Init_ossl_pkcs12().

static VALUE ossl_pkcs12_s_allocate | ( | VALUE | klass | ) |

static

Definition at line 40 of file ossl_pkcs12.c.

References ePKCS12Error, NULL, ossl_raise(), and WrapPKCS12.

Referenced by Init_ossl_pkcs12().

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

static

Definition at line 74 of file ossl_pkcs12.c.

References cPKCS12, ePKCS12Error, GetPKeyPtr(), GetX509CertPtr(), name, NIL_P, NULL, NUM2INT, ossl_pkcs12_set_ca_certs, ossl_pkcs12_set_cert, ossl_pkcs12_set_key, ossl_raise(), rb_eArgError, rb_scan_args(), STACK_OF(), StringValuePtr, and WrapPKCS12.

Referenced by Init_ossl_pkcs12().

static VALUE ossl_pkcs12_to_der | ( | VALUE | self | ) |

static

Definition at line 175 of file ossl_pkcs12.c.

References ePKCS12Error, GetPKCS12, len, NULL, ossl_raise(), ossl_str_adjust, p, rb_str_new(), and RSTRING_PTR.

Referenced by Init_ossl_pkcs12().

## Variable Documentation

VALUE cPKCS12

Definition at line 33 of file ossl_pkcs12.c.

Referenced by Init_ossl_pkcs12(), and ossl_pkcs12_s_create().

VALUE ePKCS12Error

Definition at line 34 of file ossl_pkcs12.c.

Referenced by Init_ossl_pkcs12(), ossl_pkcs12_initialize(), ossl_pkcs12_s_allocate(), ossl_pkcs12_s_create(), and ossl_pkcs12_to_der().