PrivateKey

Generates a RSA public/private key pair for use with X509 Certificates and other applications search as S/MIME, DomainKeys, etc.

Example

auto newPkey = new PrivateKey(2048); // create new keypair
Stdout(newPkey.pemFormat("password")); // dumps in pemFormat with encryption
Stdout(newPkey.pemFormat()); // dumps in pemFormat without encryption
Stdout(newPkey.publicKey.pemFormat); // dump out just the public key portion
auto data = newPkey.decrypt(someData); // decrypt data encrypted with public Key

Constructors

this
this(const(char)[] privatePemData, const(char)[] certPass)

Reads in the provided PEM data, with an optional password to decrypt the private key.

this
this(int bits)

Generates a new private/public key at the specified bit leve.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

decrypt
ubyte[] decrypt(const(ubyte)[] data)

Decrypts data previously encrypted with the matching PublicKey

encrypt
ubyte[] encrypt(const(ubyte)[] data)

Encrypt the passed data using the PrivateKey

opEquals
bool opEquals(Object obj)

Compares two PrivateKey classes to see if the internal structures are the same.

pemFormat
string pemFormat(const(char)[] pass)

Returns the underlying public/private key pair in PEM format.

publicKey
PublicKey publicKey()

Returns the underlying PublicKey

sign
ubyte[] sign(const(ubyte)[] data, ubyte[] sigbuf)

Sign the given data with the private key

Variables

_evpKey
EVP_PKEY* _evpKey;
Undocumented in source.

Meta