CryptoSys PKI Pro Manual

Rsa.SaveEncKey Method

Save an internal RSA key string to an encrypted key file.

Syntax

[C#]
public static int SaveEncKey(
   string outputFile,
   string privateKey,
   string password,
   Rsa.PbeOptions pbeOption,
   string paramString = "",
   Rsa.Format format = Rsa.Format.Default 
)
[VB]
Public Shared Function SaveEncKey (
   outputFile As String,
   privateKey As String,
   password As String,
   pbeOption As Rsa.PbeOptions,
   Optional paramString As String = "",
   Optional format As Rsa.Format = Rsa.Format.Default 
) As Integer

Parameters

outputFile  String
Name of output file to be created
privateKey  String
The private RSA key as an internal key string.
password  String
Password to be used for the encrypted key file.
pbeOption  Rsa.PbeOptions
Encryption scheme to encrypt private key [default = pbeWithSHAAnd3-KeyTripleDES-CBC from PKCS#12]
paramString  String  (Optional)
Optional parameters. A set of attribute name=value pairs separated by a semicolon ";" (see remarks).
format  Rsa.Format  (Optional)
File format

Return Value

Int32
If successful, the return value is zero; otherwise it returns a nonzero error code

Remarks

Valid name-value pairs for paramString are:

ParameterDescription
count=integerTo set the iteration count used in the PBKDF2 method, e.g. "count=5000;" [default=2048].
prf=hmac-nameTo change the HMAC algorithm used in the PBKDF2 method, e.g. "prf=hmacwithSHA256;" [default=hmacwithSHA1].

Valid values for hmac-name are one of {hmacWithSHA1, hmacWithSHA224, hmacWithSHA256, hmacWithSHA384, hmacWithSHA512}.

See Also

VB6/C equivalent: RSA_SaveEncKey

[Contents] [Index]

[PREV: Rsa.ReadPublicKey Method...]   [Contents]   [Index]   
   [NEXT: Rsa.SaveEncPrivateKey(String, String, Int32, String, CipherAlgorithm, HashAlgorithm, Rsa.Format) Method...]

Copyright © 2004-26 D.I. Management Services Pty Ltd t/a CryptoSys. All rights reserved. Generated 2026-09-21T05:59:39Z.