Example of locking and unlocking an object.
using System;
using System.IO;
namespace BlockObject
{
class Program
{
static void Main(string[] args)
{
string address = "127.0.0.1";
string user = "master";
string pass = "12345678";
string keyId = "key_id";
Console.WriteLine("\nTest newly created key.");
Console.WriteLine("Chave bloqueada: {0}",
TestAsymKeyAccess(hsm, keyId);
Console.WriteLine("\nTest key locked.");
Console.WriteLine("Chave bloqueada: {0}",
TestAsymKeyAccess(hsm, keyId);
Console.WriteLine("\nTest key unlocked.");
Console.WriteLine("Chave bloqueada: {0}",
TestAsymKeyAccess(hsm, keyId);
}
{
var data = new byte[] { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 };
try{
{
Console.WriteLine(
"Sign hash failed: " + e.
Message);
return;
}
Console.WriteLine("Key tested successfully.");
}
}
}
API class for accessing HSM functionalities Dinamo. In this class you can program using...
Definition DinamoClient.cs:93
KEY_ALG
Definition DinamoClient.cs:227
HASH_ALG
Hash algorithm for signatures.
Definition DinamoClient.cs:137
Exception class for errors from Dinamo.
Definition DinamoException.cs:10
override string Message
Definition DinamoException.cs:42
byte[] SignHash(String keyId, byte[] bHash, DinamoClient.HASH_ALG algHash)
Sign a hash.
Definition DinamoClient.cs:4035
bool IsObjectBlocked(string szObjectName)
Recovers the locked state of an object.
Definition DinamoClient.cs:2354
void DestroyKey(IntPtr hKey)
Release key handle.
Definition DinamoClient.cs:1953
void BlockObject(string szObjectName, bool bBlock)
Changes the lock status of an object.
Definition DinamoClient.cs:2321
IntPtr GenerateKey(string KeyId, DinamoClient.KEY_ALG Alg, bool Exportable)
Generates a permanent key in the HSM.
Definition DinamoClient.cs:1891
void RemoveObject(string ObjectId)
Removes an object from the HSM.
Definition DinamoClient.cs:2397
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