PrivateKeyInfo.Save Method
Namespace: Rebex.Security.Cryptography.Pkcs
Assembly: Rebex.Common.dll (version 7.0.9083)
Save(Stream, String, PrivateKeyFormat)
Saves the private key into the supplied stream in the specified format.
Declaration
public void Save(Stream output, string password, PrivateKeyFormat format)
Parameters
Type | Name | Description |
---|---|---|
Stream | output | A stream to which to save the private key. |
String | password | Password to encrypt the private key, or null if no encryption desired. |
PrivateKeyFormat | format | Private key file format. |
Save(Stream, Byte[], PrivateKeyFormat)
Saves the private key into the supplied stream in the specified format.
Declaration
protected void Save(Stream output, byte[] password, PrivateKeyFormat format)
Parameters
Type | Name | Description |
---|---|---|
Stream | output | A stream to which to save the private key. |
Byte[] | password | Password to encrypt the private key, or null if no encryption desired. |
PrivateKeyFormat | format | Private key file format. |
Save(String, String, PrivateKeyFormat)
Saves the private key into the supplied stream in the specified format.
Declaration
public void Save(string fileName, string password, PrivateKeyFormat format)
Parameters
Type | Name | Description |
---|---|---|
String | fileName | A file to which to save the public key. |
String | password | Password to encrypt the private key, or null if no encryption desired. |
PrivateKeyFormat | format | Private key file format. |
Save(Stream, String, ObjectIdentifier)
Saves the private key into the supplied stream in Base64-encoded PKCS #8 format.
Declaration
public void Save(Stream output, string password, ObjectIdentifier encryptionAlgorithm)
Parameters
Type | Name | Description |
---|---|---|
Stream | output | A stream to which to save the private key. |
String | password | Password to encrypt the private key, or null if no encryption desired. |
ObjectIdentifier | encryptionAlgorithm | Encryption algorithm identifier. Ignored if password is null. |
Remarks
Currently, AES-128 ("2.16.840.1.101.3.4.1.2"), AES-192 ("2.16.840.1.101.3.4.1.22"), AES-256 ("2.16.840.1.101.3.4.1.42"), 3DES ("1.2.840.113549.3.7"), DES ("1.3.14.3.2.7"), and RC2 ("1.2.840.113549.3.2") algorithms are supported and SHA-1 is used. For AES-256 with SHA-256, use Save(Stream, String, PrivateKeyFormat) method.