pub struct Dsa<T>(_, _);
Expand description

Object representing DSA keys.

A DSA object contains the parameters p, q, and g. There is a private and public key. The values p, g, and q are:

  • p: DSA prime parameter
  • q: DSA sub-prime parameter
  • g: DSA base parameter

These values are used to calculate a pair of asymmetrical keys used for signing.

OpenSSL documentation at DSA_new

Examples

use openssl::dsa::Dsa;
use openssl::error::ErrorStack;
use openssl::pkey::Private;

fn create_dsa() -> Result<Dsa<Private>, ErrorStack> {
    let sign = Dsa::generate(2048)?;
    Ok(sign)
}

Implementations

Creates a DSA params based upon the given parameters.

This corresponds to DSA_set0_pqg.

Generates DSA params based on the given number of bits.

This corresponds to DSA_generate_parameters_ex.

Generates a private key based on the DSA params.

This corresponds to DSA_generate_key.

Generate a DSA key pair.

The bits parameter corresponds to the length of the prime p.

Create a DSA key pair with the given parameters

p, q and g are the common parameters. priv_key is the private component of the key pair. pub_key is the public component of the key. Can be computed via g^(priv_key) mod p

Decodes a PEM-encoded SubjectPublicKeyInfo structure containing a DSA key.

The input should have a header of -----BEGIN PUBLIC KEY-----.

This corresponds to PEM_read_bio_DSA_PUBKEY.

Decodes a DER-encoded SubjectPublicKeyInfo structure containing a DSA key.

This corresponds to d2i_DSA_PUBKEY.

Create a new DSA key with only public components.

p, q and g are the common parameters. pub_key is the public component of the key.

Methods from Deref<Target = DsaRef<T>>

Serializes the public key into a PEM-encoded SubjectPublicKeyInfo structure.

The output will have a header of -----BEGIN PUBLIC KEY-----.

This corresponds to PEM_write_bio_DSA_PUBKEY.

Serializes the public key into a DER-encoded SubjectPublicKeyInfo structure.

This corresponds to i2d_DSA_PUBKEY.

Returns a reference to the public key component of self.

This corresponds to DSA_get0_key.

Serializes the private key to a PEM-encoded DSAPrivateKey structure.

The output will have a header of -----BEGIN DSA PRIVATE KEY-----.

This corresponds to PEM_write_bio_DSAPrivateKey.

Serializes the private key to a PEM-encoded encrypted DSAPrivateKey structure.

The output will have a header of -----BEGIN DSA PRIVATE KEY-----.

This corresponds to PEM_write_bio_DSAPrivateKey.

Serializes the private_key to a DER-encoded DSAPrivateKey structure.

This corresponds to i2d_DSAPrivateKey.

Returns a reference to the private key component of self.

This corresponds to DSA_get0_key.

Returns the maximum size of the signature output by self in bytes.

This corresponds to DSA_size.

Returns the DSA prime parameter of self.

This corresponds to DSA_get0_pqg.

Returns the DSA sub-prime parameter of self.

This corresponds to DSA_get0_pqg.

Returns the DSA base parameter of self.

This corresponds to DSA_get0_pqg.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.
Immutably borrows from an owned value. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Mutably dereferences the value.
Executes the destructor for this type. Read more
The raw C type.
The type representing a reference to this type.
Constructs an instance of this type from its raw type.
Returns a raw pointer to the wrapped value.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.