Generate an EC public/private key pair and save as two key files.
Namespace: CryptoSysPKIAssembly: diCrSysPKINet (in diCrSysPKINet.dll) Version: 23.0.0.30549 (23.1.0.0)
Syntaxpublic static int MakeKeys(
string publicKeyfile,
string privateKeyFile,
EccCurveName curveName,
string password,
EccPbeScheme pbes = EccPbeScheme.Default,
string paramString = "",
EccFormat fileFormat = EccFormat.Default
)
Public Shared Function MakeKeys (
publicKeyfile As String,
privateKeyFile As String,
curveName As EccCurveName,
password As String,
Optional pbes As EccPbeScheme = EccPbeScheme.Default,
Optional paramString As String = "",
Optional fileFormat As EccFormat = EccFormat.Default
) As Integer
Parameters
- publicKeyfile String
- name of public key file to be created
- privateKeyFile String
- name of encrypted private key file to be created
- curveName EccCurveName
- name of elliptic curve
- password String
- password to be used for the encrypted key file.
- pbes EccPbeScheme (Optional)
- (optional) Password-based encryption scheme to encrypt private key
[default = pbeWithSHAAnd3-KeyTripleDES-CBC]
- paramString String (Optional)
- Optional parameters.
A set of attribute name=value pairs separated by a semicolon ";" (see remarks).
- fileFormat EccFormat (Optional)
- (optional) Format to save file [default = DER binary]
Return Value
Int32Zero if successful or non-zero
error code
RemarksValid name-value pairs for paramString are:
count=integer | To set the iteration count used in the PBKDF2 method,
e.g. "count=5000;" [default=2048].
|
prf=hmac-name | To change the HMAC algorithm used in the PBKDF2 method,
e.g. "prf=hmacwithSHA256;" [default=hmacwithSHA1].
|
rngseed=string | To add some user-supplied entropy for the key generation process,
e.g. "rngseed=pqrrr1234xyz;".
|
Valid values for hmac-name are
{hmacWithSHA1|hmacWithSHA224|hmacWithSHA256|hmacWithSHA384|hmacWithSHA512}.
Example
n = Ecc.MakeKeys(pubkeyfile, prikeyfile, Ecc.CurveName.Prime192v1, "password");
n = Ecc.MakeKeys(pubkeyfile, prikeyfile, Ecc.CurveName.Prime192v1, "password",
Ecc.PbeScheme.Pbe_Pbkdf2_aes128_CBC, "count=3999;prf=hmacWithSha256", Ecc.Format.PEM);
See Also