NET API
HSM Dinamo
Loading...
Looking for...
No entries found
import_export_pkcs12.cs

PKCS#12 import and export example.

See Note on examples.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dinamo;
using Dinamo.Hsm;
namespace ImportExportPKCS12
{
class Program
{
static void Main(string[] args)
{
string address = "10.0.0.1";
string user = "usuario";
string pass = "password";
//Conecta ao HSM
din.Connect(address, user, pass);
string keyId = "lab";
string certId = "lab_cert";
string p12Password = "12345678";
/*
* Import a PKCS#12 file.
*/
din.ImportPKCS12(@"c:\tmp\lab.pfx", p12Password, keyId, certId, true);
/*
* Exports a key and certificate in PKCS#12 format.
*/
byte[] pkcs12 = din.ExportPKCS12(keyId, certId, p12Password);
/*
* Import a buffer in PKCS#12 format.
*/
string impKeyId = "imp";
string impCertId = "imp_cert";
din.ImportPKCS12(pkcs12, p12Password, impKeyId, impCertId, true);
din.Disconnect();
}
}
}
API class for accessing HSM functionalities Dinamo. In this class you can program using...
Definition DinamoClient.cs:93
byte[] ExportPKCS12(string KeyId, string CertId, string Secret)
Exports an HSM key and certificate in PKCS#12 format.
Definition DinamoClient.cs:2850
Int32 ImportPKCS12(string FilePath, string Password, string KeyId, string CertId, bool Exportable)
Definition DinamoClient.cs:2713
void Connect(string User, string Password)
Establishes an encrypted connection to the HSM using the load balance settings.
Definition DinamoClient.cs:562
void Disconnect(bool flagClose)
Terminates the connection to the HSM.
Definition DinamoClient.cs:814
Namespace denoting a set of functions for accessing the HSM Dinamo and their respective exceptions.
Definition DinamoClient.cs:12
Definition DinamoClient.cs:12