API .Net HSM Dinamo
API Proprietária .Net do HSM Dinamo
generate_hash.cs

Exemplo de uso de geração HASH.

Veja Nota sobre os exemplos.
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 GenerateHASH
{
class Program
{
static void Main(string[] args)
{
string address = "10.0.0.1";
string user = "master";
string pass = "12345678";
DinamoClient din = new DinamoClient();
//Conecta ao HSM
din.Connect(address, user, pass);
byte []message1 = new byte[]
{
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38
};
byte []message2 = new byte[]
{
0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31,
0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32,
};
Console.Out.WriteLine("Generate HASH in one call.\n");
byte[] hash = din.generateHash(DinamoClient.HASH_ALG.ALG_SHA2_256, message1);
Console.Out.WriteLine("hash: {0}\n", BitConverter.ToString(hash).Replace("-", string.Empty));
Console.Out.WriteLine("Generate HASH in multiple calls.\n");
din.initHash(DinamoClient.HASH_ALG.ALG_SHA2_256);
din.updateHash(message1);
din.updateHash(message2);
byte[] hash2 = din.endMAC();
Console.Out.WriteLine("hash2: {0}\n", BitConverter.ToString(hash2).Replace("-", string.Empty));
din.Disconnect();
}
}
}
Namespace que denota um conjunto de funções para acesso ao HSM Dinamo e suas respectivas exceptions.
Definition: DinamoClient.cs:12
Definition: DinamoClient.cs:12