Struct openssl::pkey::PKey [] [src]

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

A public or private key.

Methods

impl<T> PKey<T>
[src]

[src]

Creates a new PKey containing an RSA key.

This corresponds to EVP_PKEY_assign_RSA.

[src]

Creates a new PKey containing a DSA key.

This corresponds to EVP_PKEY_assign_DSA.

[src]

Creates a new PKey containing a Diffie-Hellman key.

This corresponds to EVP_PKEY_assign_DH.

[src]

Creates a new PKey containing an elliptic curve key.

This corresponds to EVP_PKEY_assign_EC_KEY.

impl PKey<Private>
[src]

[src]

Creates a new PKey containing an HMAC key.

Note

To compute HMAC values, use the sign module.

[src]

Creates a new PKey containing a CMAC key.

Requires OpenSSL 1.1.0 or newer.

Note

To compute CMAC values, use the sign module.

[src]

Deserializes a private key from a PEM-encoded key type specific format.

This corresponds to PEM_read_bio_PrivateKey.

[src]

Deserializes a private key from a PEM-encoded encrypted key type specific format.

This corresponds to PEM_read_bio_PrivateKey.

[src]

Deserializes a private key from a PEM-encoded encrypted key type specific format.

The callback should fill the password into the provided buffer and return its length.

This corresponds to PEM_read_bio_PrivateKey.

[src]

Decodes a DER-encoded private key.

This function will automatically attempt to detect the underlying key format, and supports the unencrypted PKCS#8 PrivateKeyInfo structures as well as key type specific formats.

This corresponds to d2i_AutoPrivateKey.

[src]

Deserializes a DER-formatted PKCS#8 private key, using a callback to retrieve the password if the key is encrpyted.

The callback should copy the password into the provided buffer and return the number of bytes written.

[src]

Deserializes a DER-formatted PKCS#8 private key, using the supplied password if the key is encrypted.

Panics

Panics if passphrase contains an embedded null.

impl PKey<Public>
[src]

[src]

Decodes a PEM-encoded SubjectPublicKeyInfo structure.

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

This corresponds to PEM_read_bio_PUBKEY.

[src]

Decodes a DER-encoded SubjectPublicKeyInfo structure.

This corresponds to d2i_PUBKEY.

Methods from Deref<Target = PKeyRef<T>>

[src]

Returns a copy of the internal RSA key.

This corresponds to EVP_PKEY_get1_RSA.

[src]

Returns a copy of the internal DSA key.

This corresponds to EVP_PKEY_get1_DSA.

[src]

Returns a copy of the internal DH key.

This corresponds to EVP_PKEY_get1_DH.

[src]

Returns a copy of the internal elliptic curve key.

This corresponds to EVP_PKEY_get1_EC_KEY.

[src]

Returns the Id that represents the type of this key.

This corresponds to EVP_PKEY_id.

[src]

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

[src]

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

This corresponds to i2d_PUBKEY.

[src]

Returns the size of the key.

This corresponds to the bit length of the modulus of an RSA key, and the bit length of the group order for an elliptic curve key, for example.

[src]

Compares the public component of this key with another.

[src]

Serializes the private key to a PEM-encoded PKCS#8 PrivateKeyInfo structure.

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

This corresponds to PEM_write_bio_PKCS8PrivateKey.

[src]

Serializes the private key to a PEM-encoded PKCS#8 EncryptedPrivateKeyInfo structure.

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

This corresponds to PEM_write_bio_PKCS8PrivateKey.

[src]

Serializes the private key to a DER-encoded key type specific format.

This corresponds to i2d_PrivateKey.

Trait Implementations

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

The raw C type.

The type representing a reference to this type.

[src]

Constructs an instance of this type from its raw type.

[src]

Returns a raw pointer to the wrapped value.

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

[src]

Executes the destructor for this type. Read more

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

The resulting type after dereferencing.

[src]

Dereferences the value.

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

[src]

Mutably dereferences the value.

impl<T> Borrow<PKeyRef<T>> for PKey<T>
[src]

[src]

Immutably borrows from an owned value. Read more

impl<T> AsRef<PKeyRef<T>> for PKey<T>
[src]

[src]

Performs the conversion.

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

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