Ruby  2.4.2p198(2017-09-14revision59899)
Macros | Functions | Variables
ossl_pkcs12.c File Reference
#include "ossl.h"
Include dependency graph for ossl_pkcs12.c:

Go to the source code of this file.

Macros

#define NewPKCS12(klass)   TypedData_Wrap_Struct((klass), &ossl_pkcs12_type, 0)
 
#define SetPKCS12(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 void ossl_pkcs12_free (void *ptr)
 
static VALUE ossl_pkcs12_s_allocate (VALUE klass)
 
static VALUE ossl_pkcs12_initialize_copy (VALUE self, VALUE other)
 
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 (void)
 

Variables

VALUE cPKCS12
 
VALUE ePKCS12Error
 
static const rb_data_type_t ossl_pkcs12_type
 

Macro Definition Documentation

◆ GetPKCS12

#define GetPKCS12 (   obj,
  p12 
)
Value:
do { \
TypedData_Get_Struct((obj), PKCS12, &ossl_pkcs12_type, (p12)); \
if(!(p12)) ossl_raise(rb_eRuntimeError, "PKCS12 wasn't initialized."); \
} while (0)
static const rb_data_type_t ossl_pkcs12_type
Definition: ossl_pkcs12.c:47
VALUE rb_eRuntimeError
Definition: error.c:761
void ossl_raise(VALUE exc, const char *fmt,...)
Definition: ossl.c:278

Definition at line 15 of file ossl_pkcs12.c.

Referenced by ossl_pkcs12_initialize_copy(), and ossl_pkcs12_to_der().

◆ NewPKCS12

#define NewPKCS12 (   klass)    TypedData_Wrap_Struct((klass), &ossl_pkcs12_type, 0)

Definition at line 7 of file ossl_pkcs12.c.

Referenced by ossl_pkcs12_s_allocate(), and ossl_pkcs12_s_create().

◆ ossl_pkcs12_get_ca_certs

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

Definition at line 30 of file ossl_pkcs12.c.

◆ ossl_pkcs12_get_cert

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

Definition at line 29 of file ossl_pkcs12.c.

◆ ossl_pkcs12_get_key

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

Definition at line 28 of file ossl_pkcs12.c.

◆ ossl_pkcs12_set_ca_certs

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

Definition at line 27 of file ossl_pkcs12.c.

Referenced by ossl_pkcs12_initialize(), and ossl_pkcs12_s_create().

◆ ossl_pkcs12_set_cert

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

Definition at line 26 of file ossl_pkcs12.c.

Referenced by ossl_pkcs12_initialize(), and ossl_pkcs12_s_create().

◆ ossl_pkcs12_set_key

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

Definition at line 25 of file ossl_pkcs12.c.

Referenced by ossl_pkcs12_initialize(), and ossl_pkcs12_s_create().

◆ SafeGetPKCS12

#define SafeGetPKCS12 (   obj,
  p12 
)
Value:
do { \
OSSL_Check_Kind((obj), cPKCS12); \
GetPKCS12((obj), (p12)); \
} while (0)
VALUE cPKCS12
Definition: ossl_pkcs12.c:35

Definition at line 20 of file ossl_pkcs12.c.

Referenced by ossl_pkcs12_initialize_copy().

◆ SetPKCS12

#define SetPKCS12 (   obj,
  p12 
)
Value:
do { \
if(!(p12)) ossl_raise(rb_eRuntimeError, "PKCS12 wasn't initialized."); \
RTYPEDDATA_DATA(obj) = (p12); \
} while (0)
VALUE rb_eRuntimeError
Definition: error.c:761
void ossl_raise(VALUE exc, const char *fmt,...)
Definition: ossl.c:278

Definition at line 10 of file ossl_pkcs12.c.

Referenced by ossl_pkcs12_initialize_copy(), ossl_pkcs12_s_allocate(), and ossl_pkcs12_s_create().

Function Documentation

◆ Init_ossl_pkcs12()

void Init_ossl_pkcs12 ( void  )

◆ ossl_pkcs12_free()

static void ossl_pkcs12_free ( void *  ptr)
static

Definition at line 42 of file ossl_pkcs12.c.

◆ ossl_pkcs12_initialize()

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

◆ ossl_pkcs12_initialize_copy()

static VALUE ossl_pkcs12_initialize_copy ( VALUE  self,
VALUE  other 
)
static

Definition at line 69 of file ossl_pkcs12.c.

References ePKCS12Error, GetPKCS12, ossl_raise(), rb_check_frozen, SafeGetPKCS12, and SetPKCS12.

Referenced by Init_ossl_pkcs12().

◆ ossl_pkcs12_s_allocate()

static VALUE ossl_pkcs12_s_allocate ( VALUE  klass)
static

Definition at line 56 of file ossl_pkcs12.c.

References ePKCS12Error, NewPKCS12, NULL, ossl_raise(), and SetPKCS12.

Referenced by Init_ossl_pkcs12().

◆ ossl_pkcs12_s_create()

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

◆ ossl_pkcs12_to_der()

static VALUE ossl_pkcs12_to_der ( VALUE  self)
static

Definition at line 218 of file ossl_pkcs12.c.

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

Referenced by Init_ossl_pkcs12().

Variable Documentation

◆ cPKCS12

VALUE cPKCS12

Definition at line 35 of file ossl_pkcs12.c.

Referenced by Init_ossl_pkcs12(), and ossl_pkcs12_s_create().

◆ ePKCS12Error

VALUE ePKCS12Error

◆ ossl_pkcs12_type

const rb_data_type_t ossl_pkcs12_type
static
Initial value:
= {
"OpenSSL/PKCS12",
{
},
}
#define RUBY_TYPED_FREE_IMMEDIATELY
Definition: ruby.h:1145
static void ossl_pkcs12_free(void *ptr)
Definition: ossl_pkcs12.c:42

Definition at line 47 of file ossl_pkcs12.c.