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

Example of using the SPB API (Brazilian Payment System).

See Note on examples.
using Dinamo.Hsm;
using System;
using System.Text;
namespace SPBEncodeDecode
{
class Program
{
private static String strAddr = "10.1.1.11";
private static String strUsrId = "spb";
private static String strPwd = "12345678";
static void Main(string[] args)
{
String szSrcISPB = "11111111@SPR";
bool bAcceptExpiredCert = false;
bool bAutoUpdateCert = false;
byte[] pbMsgIn = Encoding.ASCII.GetBytes("abcdefghijklmnopqrstuvwxyz");
try {
api.Connect(strAddr, strUsrId, strPwd); // connects
byte[] bout = api.SPBEncode(szSrcISPB, szSrcISPB, pbMsgIn, bSpecialTreatment);
Console.Out.WriteLine(BitConverter.ToString(bout));
byte[] bin2 = api.SPBDecode(szSrcISPB, szSrcISPB, bout, bAcceptExpiredCert, bAutoUpdateCert);
Console.Out.WriteLine(Encoding.ASCII.GetString(bin2)); // show the decrypted output
} catch (DinamoException e) {
Console.Out.WriteLine(e.Message);
} finally{
api.Disconnect(); // disconnects
}
}
}
}
API class for accessing HSM functionalities Dinamo. In this class you can program using...
Definition DinamoClient.cs:93
Exception class for errors from Dinamo.
Definition DinamoException.cs:10
override string Message
Definition DinamoException.cs:42
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
byte[] SPBEncode(string szSrcISPB, string szDstISPB, byte[] pbMsgIn, byte bSpecialTreatment)
It encodes a message with the SPB header, signing, encrypting and including all the fields...
Definition DinamoClient.cs:6375
byte[] SPBDecode(string szSrcISPB, string szDstISPB, byte[] pbMsgIn)
Decrypts a message in the SPB standard, checking the signatures, decrypting it, but does not check...
Definition DinamoClient.cs:6535
Namespace denoting a set of functions for accessing the HSM Dinamo and their respective exceptions.
Definition DinamoClient.cs:12