Class: OpenSSL::PKey::DSA

Inherits:
PKey
  • Object
show all
Defined in:
ossl_pkey_dsa.c

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeObject

Class Method Details

.generateObject

Instance Method Details

#exportObject Also known as: to_pem, to_s

#paramsObject

Stores all parameters of key to the hash INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!! Don't use :-)) (I's up to you)



# File 'ossl_pkey_dsa.c'

static VALUE
ossl_dsa_get_params(VALUE self)
{
    EVP_PKEY *pkey;
    VALUE hash;

    GetPKeyDSA(self, pkey);

    hash = rb_hash_new();

    rb_hash_aset(hash, rb_str_new2("p"), ossl_bn_new(pkey->pkey.dsa->p));
    rb_hash_aset(hash, rb_str_new2("q"), ossl_bn_new(pkey->pkey.dsa->q));
    rb_hash_aset(hash, rb_str_new2("g"), ossl_bn_new(pkey->pkey.dsa->g));
    rb_hash_aset(hash, rb_str_new2("pub_key"), ossl_bn_new(pkey->pkey.dsa->pub_key));
    rb_hash_aset(hash, rb_str_new2("priv_key"), ossl_bn_new(pkey->pkey.dsa->priv_key));
    
    return hash;
}

#private?Boolean

Returns:

  • (Boolean)

#public?Boolean

Returns:

  • (Boolean)

#public_keyObject

Makes new instance DSA PUBLIC_KEY from PRIVATE_KEY



# File 'ossl_pkey_dsa.c'

static VALUE
ossl_dsa_to_public_key(VALUE self)
{
EVP_PKEY *pkey;
DSA *dsa;
VALUE obj;

GetPKeyDSA(self, pkey);
/* err check performed by dsa_instance */
dsa = DSAPublicKey_dup(pkey->pkey.dsa);
obj = dsa_instance(CLASS_OF(self), dsa);
if (obj == Qfalse) {
DSA_free(dsa);
ossl_raise(eDSAError, NULL);
}

#syssignObject

#sysverifyObject

#to_derObject

#to_textObject

Prints all parameters of key to buffer INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!! Don't use :-)) (I's up to you)



# File 'ossl_pkey_dsa.c'

static VALUE
ossl_dsa_to_text(VALUE self)
{
EVP_PKEY *pkey;
BIO *out;
VALUE str;

GetPKeyDSA(self, pkey);
if (!(out = BIO_new(BIO_s_mem()))) {
ossl_raise(eDSAError, NULL);
}