[][src]Struct openssl::dsa::Dsa

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

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:

These values are used to calculate a pair of asymetrical 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)
}

Methods

impl Dsa<Private>
[src]

Generate a DSA key pair.

Calls DSA_generate_parameters_ex to populate the p, g, and q values. These values are used to generate the key pair with DSA_generate_key.

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

impl Dsa<Public>
[src]

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>>

Serialies 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.

Returns a reference to the private key component of self.

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

OpenSSL documentation at DSA_size

Returns the DSA prime parameter of self.

Returns the DSA sub-prime parameter of self.

Returns the DSA base parameter of self.

Trait Implementations

impl<T> Sync for Dsa<T>
[src]

impl<T> AsRef<DsaRef<T>> for Dsa<T>
[src]

Performs the conversion.

impl<T> Send for Dsa<T>
[src]

impl<T> Drop for Dsa<T>
[src]

Executes the destructor for this type. Read more

impl<T> Deref for Dsa<T>
[src]

The resulting type after dereferencing.

Dereferences the value.

impl<T> DerefMut for Dsa<T>
[src]

Mutably dereferences the value.

impl<T> Debug for Dsa<T>
[src]

Formats the value using the given formatter. Read more

impl<T> Borrow<DsaRef<T>> for Dsa<T>
[src]

Immutably borrows from an owned value. Read more

impl<T> ForeignType for Dsa<T>
[src]

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.

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

Performs the conversion.

impl<T> From for T
[src]

Performs the conversion.

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Borrow for T where
    T: ?Sized
[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut for T where
    T: ?Sized
[src]

Mutably borrows from an owned value. Read more

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more