Dastine
Dastine Class Reference

Public Member Functions

string GetVersion (void)
 
int SelectCertificateFromWindowsByUI (string issuerDn, string keyUsages)
 
int SelectCertificateFromWindowsBySubject (string subject, string issuerDn, string keyUsages)
 
int SelectCertificateFromTokenByUI (string issuerDn, string keyUsages)
 
int SelectCertificateFromTokenBySubject (LPCWSTR subject, string issuerDn, string keyUsages)
 
int SelectCertificateFromFileByUI (string issuerDn, string keyUsages, string p12, string password)
 
int SelectCertificateFromFileBySubject (string subject, string issuerDn, string keyUsages, string p12, string password)
 
string FindCertificate (string issuerDn, string keyUsages)
 
string GetSelectedCertificate (void)
 
string Sign (string data, string hashAlg)
 
string CmsSign (string message, bool attachData)
 
string CmsSignWithAttributes (string message, string AuthenticatedAttributes, string UnAuthenticatedAttributes)
 
string CmsDecrypt (string cipher)
 
string Base64ToUnicode (string base64Str)
 
string UnicodeToBase64 (string unicodeStr)
 
string ListTokens (void)
 
string GenerateKeyPairAndCertificateRequest (string subjectDN, string keyLength, string tokenName)
 
string GenerateKeyPairAndCertificateRequestOnSelectedCertificate (string subjectDN, string keyLength, string tokenName)
 
int ImportIssuedCertificate (string certificate)
 
int ImportIssuedCertificateOnSelectedCertificate (string certificate)
 
int ImportCertificateFromFileToToken (string p12, string password, string tokenName, string keyContainer)
 
int RemoveGeneratedKeyPair (void)
 
int RemoveSelectedCertificate (void)
 
int SetTokenRemoveEvent (void)
 
int SetTokenInsertEvent (void)
 
int SetAdminKey (string adminKey, string tokenName)
 
int SetPIN (string pin, string tokenName)
 
int ChangePIN (string tokenName)
 
int UnblockPIN (string tokenName)
 
int ReadSignatureImage (void)
 
int ReadFaceImage (void)
 
int ReadFingerprintImage (void)
 
string ReadValidationData (void)
 
string ReadPrintedData (void)
 
string ReadExtendedPrintedData (void)
 
string ReadSerialNumber (void)
 
string ReadIDinCardsSerialNumber (void)
 
string ReadCustomField (int index)
 
int Reset (void)
 
int CheckUpdate ()
 
int InstallUpdate ()
 
int OpenFingerPrintScanner (string ScannerName)
 
int CaptureFingerPrintScanner (string ImageFormat)
 
string GetFingerPrintScannerSupportedDevices (void)
 
string GetFingerPrintScannerSupportedImageFormat (string ScannerName)
 
string GetFingerPrintScannerDLLVersion (void)
 
int CloseFingerPrintScanner (void)
 
int SetIDinCard (string SerialNumber)
 
int SetIDinCardIndexForIssuance (string SerialNumber)
 

Member Function Documentation

◆ Base64ToUnicode()

string Dastine::Base64ToUnicode ( string  base64Str)

Converts a base64 string to Unicode.

Parameters
base64StrInput base64 string
Returns
Converted Unicode string if succeeded
Or an ErrorCode

◆ CaptureFingerPrintScanner()

int Dastine::CaptureFingerPrintScanner ( string  ImageFormat)

Capture image from scanner by specific image format

Parameters
ImageFormatinput the desirable format of image for capturing
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ ChangePIN()

int Dastine::ChangePIN ( string  tokenName)

Changes a token's PIN

Parameters
tokenNameThe name of CSP that it's PIN is going to be changed. This name can be obtained using ListTokens() function.
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ CheckUpdate()

int Dastine::CheckUpdate ( )

Check server for update

Parameters
void
Returns
110   E_DASTINE_IS_UP_TO_DATE
Or an ErrorCode

◆ CloseFingerPrintScanner()

int Dastine::CloseFingerPrintScanner ( void  )

Close the socket that connected to scanner device.

Parameters
void
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ CmsDecrypt()

string Dastine::CmsDecrypt ( string  cipher)

CmsDecrypts the input cipher. The input cipher is in CMS format described in PKCS7 standard.

Parameters
cipherInput cipher in base64 format which is desired to be cmsdecrypted.
Returns
CmsDecrypted data if succeeded
Or an ErrorCode

◆ CmsSign()

string Dastine::CmsSign ( string  message,
bool  attachData 
)

CMSSigns the input message using the selected certificate. The returned cipher is in CMS format described in PKCS7 standard. A certificate must have been selected before calling this function.

Parameters
messageInput message in base64 format which is desired to be cmssigned.
attachDataA boolean that determines wethere the message is attached to the CMS or not.
Returns
CMSSigned data in base64 format if succeeded
Or an ErrorCode

◆ CmsSignWithAttributes()

string Dastine::CmsSignWithAttributes ( string  message,
string  AuthenticatedAttributes,
string  UnAuthenticatedAttributes 
)

CmsSignWithAttributes signs the input message with Authenticated and UnAuthenticated Attributes using the selected certificate. The returned cipher is in CMS format described in PKCS7 standard. A certificate must have been selected before calling this function. This function can be called more than one time to perform multiple signatures on a CMS.

Parameters
messageInput message in base64 format which is desired to be cmssigned.
AuthenticatedAttributesAn attribute to be signed as defined in PKCS#9 standard. Sample usage: Time=2017-04-02 02:15:36
UnAuthenticatedAttributesAn unsigned attribute as defined in PKCS#9 standard.
Returns
CMSSigned data in base64 format if succeeded
Or an ErrorCode

◆ FindCertificate()

string Dastine::FindCertificate ( string  issuerDn,
string  keyUsages 
)

return a list of subjectDN from all certificates in store windows

Parameters
issuerDnSubjectDN of Issuer certificate which displaying certificates are filtered by that issuer.
keyUsagesKey usages which displaying certificates are filtered by them. More than one key usage can be passed using "&" symbol.
Possible values are:
         Digital_Signature
         Non_repudiation
         Key_encipherment
         Data_encipherment
         Key_agreement
         Client_Authentication
         Email_Protection
         SSH_Client
         MS_SmartCard_Logon
         MS_Document_Signing
         PDF_Signing
Returns
   list of subjectDN separated using "|" symbol.
Or an ErrorCode

◆ GenerateKeyPairAndCertificateRequest()

string Dastine::GenerateKeyPairAndCertificateRequest ( string  subjectDN,
string  keyLength,
string  tokenName 
)

Generates a CSR for certificate issuance. A handle to generated key pair on the token is being cached until the certificate in issued and imported on the token using ImportIssuedCertificate() function. This is important to maintain the state of Dastine object until the certificate is imported on the token, otherwise the handle is destroyed and the process should be repeated.

Parameters
subjectDNDesired subject for new certificate.
keyLengthKey length of new key pair which is being generated.
tokenNameThe name of CSP with which the CSR is being generated. This name can be obtained using ListTokens() function.
Returns
CSR in base64 format if succeeded
Or an ErrorCode

◆ GenerateKeyPairAndCertificateRequestOnSelectedCertificate()

string Dastine::GenerateKeyPairAndCertificateRequestOnSelectedCertificate ( string  subjectDN,
string  keyLength,
string  tokenName 
)

Generates a CSR for certificate issuance. A handle is created on selected certificate to generated key pair on the token is being cached until the certificate in issued and imported on the token using ImportIssuedCertificateOnSelectedCertificate() function. This is important to maintain the state of Dastine object until the certificate is imported on the token, otherwise the handle is destroyed and the process should be repeated.

Parameters
subjectDNDesired subject for new certificate.
keyLengthKey length of new key pair which is being generated.
tokenNameThe name of CSP with which the CSR is being generated. This name can be obtained using ListTokens() function.
Returns
CSR in base64 format if succeeded
Or an ErrorCode

◆ GetFingerPrintScannerDLLVersion()

string Dastine::GetFingerPrintScannerDLLVersion ( void  )

Get the DLL version of connected scanner. You must connect to scanner device first by method OpenFingerPrintScanner().

Parameters
void
Returns
A string containing the DLL version of connected scanner device.
Or an ErrorCode

◆ GetFingerPrintScannerSupportedDevices()

string Dastine::GetFingerPrintScannerSupportedDevices ( void  )

Returns the list of supported devices by dastine.

Parameters
void
Returns
List of supported devices by dastine separated using "|" symbol.
Or an ErrorCode

◆ GetFingerPrintScannerSupportedImageFormat()

string Dastine::GetFingerPrintScannerSupportedImageFormat ( string  ScannerName)

Returns the list of supported image format by selected device. You can select a scanner device from list of supported devices.

Parameters
ScannerNameinput the name of scanner device
Returns
List of supported image format by selected device separated using "|" symbol.
Or an ErrorCode

◆ GetSelectedCertificate()

string Dastine::GetSelectedCertificate ( void  )

Returns the selected certificate.

Parameters
void
Returns
The selected certificate in base64 format if succeeded
Or an ErrorCode

◆ GetVersion()

string Dastine::GetVersion ( void  )

Get the current version of Dastine.

Parameters
void
Returns
A string containing the current version of Dastine.

◆ ImportCertificateFromFileToToken()

int Dastine::ImportCertificateFromFileToToken ( string  p12,
string  password,
string  tokenName,
string  keyContainer 
)

Imports a certificate from file to the token.

Parameters
p12input certificate in base64 format
passwordThe password of the p12 file
tokenNameThe name of CSP into which the certificate is imported. This name can be obtained using ListTokens() function.
keyContainerThe index of keyContainer on IDin card. For specific the index of keyContainer you must set IDin card by method SetIDinCard().
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ ImportIssuedCertificate()

int Dastine::ImportIssuedCertificate ( string  certificate)

Imports the issued certificate on the token. The certificate is imported on the cached handle to the generated key pair. A CSR must have been generated before calling this function.

Parameters
certificateinput issued certificate in base64 format
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ ImportIssuedCertificateOnSelectedCertificate()

int Dastine::ImportIssuedCertificateOnSelectedCertificate ( string  certificate)

Imports the issued certificate on the token. The certificate is imported on the selected certificate. A CSR must have been generated before calling this function.

Parameters
certificateinput issued certificate in base64 format
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ InstallUpdate()

int Dastine::InstallUpdate ( )

Install downloaded update from server.

Parameters
void
Returns
117   E_UPDATE_INSTALL_RUNED
Or an ErrorCode

◆ ListTokens()

string Dastine::ListTokens ( void  )

Returns the list of installed CSP's on client's machine.

Parameters
void
Returns
List of installed CSPs on client machine separated using "|" symbol.
Or an ErrorCode

◆ OpenFingerPrintScanner()

int Dastine::OpenFingerPrintScanner ( string  ScannerName)

Open a socket to specific fingerprint device

Parameters
ScannerNameinput the name of scanner device
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ ReadCustomField()

string Dastine::ReadCustomField ( int  index)

Reads custom field data from IDin Cards.

Parameters
indexThe index of CustomField
Returns
CustomField from IDin Card in b64 format
Or an ErrorCode

◆ ReadExtendedPrintedData()

string Dastine::ReadExtendedPrintedData ( void  )

Reads extended printed data from IDin Cards.

Parameters
void
Returns
ExtendedPrintedData from IDin Card in b64 tlv format
Or an ErrorCode

◆ ReadFaceImage()

int Dastine::ReadFaceImage ( void  )

Reads face image from IDin Cards.

Parameters
void
Returns
Face image from IDin Card in b64 format
Or an ErrorCode

◆ ReadFingerprintImage()

int Dastine::ReadFingerprintImage ( void  )

Reads fingerprint image from IDin Cards.

Parameters
void
Returns
Fingerprint image from IDin Card in b64 format
Or an ErrorCode

◆ ReadIDinCardsSerialNumber()

string Dastine::ReadIDinCardsSerialNumber ( void  )

Reads serial number data from IDin Cards.

Parameters
void
Returns
SerialNumber List from serial number connected IDin Cards in b64 format separated using "|" symbol
Or an ErrorCode

◆ ReadPrintedData()

string Dastine::ReadPrintedData ( void  )

Reads printed data from IDin Cards.

Parameters
void
Returns
PrintedData from IDin Card in b64 tlv format
Or an ErrorCode

◆ ReadSerialNumber()

string Dastine::ReadSerialNumber ( void  )

Reads serial number data from IDin Card. A certificate must have been selected before calling this function.

Parameters
void
Returns
SerialNumber from IDin Card in b64 format
Or an ErrorCode

◆ ReadSignatureImage()

int Dastine::ReadSignatureImage ( void  )

Reads signature image from IDin Cards.

Parameters
void
Returns
Signature image from IDin Card in b64 format
Or an ErrorCode

◆ ReadValidationData()

string Dastine::ReadValidationData ( void  )

Reads validation data from IDin Cards.

Parameters
void
Returns
ValidationData from IDin Card in b64 format
Or an ErrorCode

◆ RemoveGeneratedKeyPair()

int Dastine::RemoveGeneratedKeyPair ( void  )

Removes the generated key pair from token and releases the handle to this key pair.

Parameters
void
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ RemoveSelectedCertificate()

int Dastine::RemoveSelectedCertificate ( void  )

Removes the selected certificate from token or windows store.

Parameters
void
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ Reset()

int Dastine::Reset ( void  )

Resets everything in Dastine object releasing all handles and stopping every waiting for events.

Parameters
void
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ SelectCertificateFromFileBySubject()

int Dastine::SelectCertificateFromFileBySubject ( string  subject,
string  issuerDn,
string  keyUsages,
string  p12,
string  password 
)

Selects a specific certificate from a p12 file matching with the input subjectDn. Selecting certificate can be filtered using two other input parameters, issuer and key usages. The selected certificate is cached inside the object and further cryptographic tasks like signing or decrypting is done using this certificate. This certificate can be retrieved using GetSelectedCertificate() function.

Parameters
subjectSubjectDN of desired certificate.
issuerDnSubjectDN of Issuer certificate which displaying certificates are filtered by that issuer.
keyUsagesKey usages which displaying certificates are filtered by them. More than one key usage can be passed using "&" symbol.
Possible values are:
         Digital_Signature
         Non_repudiation
         Key_encipherment
         Data_encipherment
         Key_agreement
         Client_Authentication
         Email_Protection
         SSH_Client
         MS_SmartCard_Logon
         MS_Document_Signing
         PDF_Signing
p12input file in base64 format.
passwordThe p12 file's password.
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ SelectCertificateFromFileByUI()

int Dastine::SelectCertificateFromFileByUI ( string  issuerDn,
string  keyUsages,
string  p12,
string  password 
)

Displays a dialog box that allows the selection of a certificate from a p12 file. Selecting certificate can be filtered using two input parameters, issuer and key usages. The selected certificate is cached inside the object and further cryptographic tasks like signing or decrypting is done using this certificate. This certificate can be retrieved using GetSelectedCertificate() function.

Parameters
issuerDnSubjectDN of Issuer certificate which displaying certificates are filtered by that issuer.
keyUsagesKey usages which displayin g certificates are filtered by them. More than one key usage can be passed using "&" symbol.
Possible values are:
         Digital_Signature
         Non_repudiation
         Key_encipherment
         Data_encipherment
         Key_agreement
         Client_Authentication
         Email_Protection
         SSH_Client
         MS_SmartCard_Logon
         MS_Document_Signing
         PDF_Signing
p12input file in base64 format.
passwordThe p12 file's password.
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ SelectCertificateFromTokenBySubject()

int Dastine::SelectCertificateFromTokenBySubject ( LPCWSTR  subject,
string  issuerDn,
string  keyUsages 
)

Selects a specific certificate from hardware tokens connected to client's machine matching with the input subjectDn. Selecting certificate can be filtered using two other input parameters, issuer and key usages. The selected certificate is cached inside the object and further cryptographic tasks like signing or decrypting is done using this certificate. This certificate can be retrieved using GetSelectedCertificate() function.

Parameters
subjectSubjectDN of desired certificate.
issuerDnSubjectDN of Issuer certificate which displaying certificates are filtered by that issuer.
keyUsagesKeyusages which displaying certificates are filtered by them. More than one key usage can be passed using "&" symbol.
Possible values are:
         Digital_Signature
         Non_repudiation
         Key_encipherment
         Data_encipherment
         Key_agreement
         Client_Authentication
         Email_Protection
         SSH_Client
         MS_SmartCard_Logon
         MS_Document_Signing
         PDF_Signing
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ SelectCertificateFromTokenByUI()

int Dastine::SelectCertificateFromTokenByUI ( string  issuerDn,
string  keyUsages 
)

Displays a dialog box that allows the selection of a certificate from hardware tokens connected to client's machine. Displaying certificates can be filtered using two input parameters, issuer and key usages. The selected certificate is cached inside the object and further cryptographic tasks like signing or decrypting is done using this certificate. This certificate can be retrieved using GetSelectedCertificate() function.

Parameters
issuerDnSubjectDN of Issuer certificate which displaying certificates are filtered by that issuer.
keyUsagesKey usages which displaying certificates are filtered by them. More than one key usage can be passed using "&" symbol.
Possible values are:
         Digital_Signature
         Non_repudiation
         Key_encipherment
         Data_encipherment
         Key_agreement
         Client_Authentication
         Email_Protection
         SSH_Client
         MS_SmartCard_Logon
         MS_Document_Signing
         PDF_Signing
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ SelectCertificateFromWindowsBySubject()

int Dastine::SelectCertificateFromWindowsBySubject ( string  subject,
string  issuerDn,
string  keyUsages 
)

Selects a specific certificate from client's "Current_User" store matching with the input subjectDn. Selecting certificate can be filtered using two other input parameters, issuer and key usages. The selected certificate is cached inside the object and further cryptographic tasks like signing or decrypting is done using this certificate. This certificate can be retrieved using GetSelectedCertificate() function.

Parameters
subjectSubjectDN of desired certificate.
issuerDnSubjectDN of Issuer certificate which displaying certificates are filtered by that issuer.
keyUsagesKeyusages which displaying certificates are filtered by them. More than one key usage can be passed using "&" symbol.
Possible values are:
         Digital_Signature
         Non_repudiation
         Key_encipherment
         Data_encipherment
         Key_agreement
         Client_Authentication
         Email_Protection
         SSH_Client
         MS_SmartCard_Logon
         MS_Document_Signing
         PDF_Signing
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ SelectCertificateFromWindowsByUI()

int Dastine::SelectCertificateFromWindowsByUI ( string  issuerDn,
string  keyUsages 
)

Displays a dialog box that allows the selection of a certificate from client's "Current_User" store. Displaying certificates can be filtered using two input parameters, issuer and keyusages. The selected certificate is cached inside the object and further cryptographic tasks like signing or decrypting is done using this certificate. This certificate can be retrieved using GetSelectedCertificate() function.

Parameters
issuerDnSubjectDN of Issuer certificate which displaying certificates are filtered by that issuer.
keyUsagesKey usages which displaying certificates are filtered by them. More than one key usage can be passed using "&" symbol.
Possible values are:
         Digital_Signature
         Non_repudiation
         Key_encipherment
         Data_encipherment
         Key_agreement
         Client_Authentication
         Email_Protection
         SSH_Client
         MS_SmartCard_Logon
         MS_Document_Signing
         PDF_Signing
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ SetAdminKey()

int Dastine::SetAdminKey ( string  adminKey,
string  tokenName 
)

Sets AdminKey for a token.

Parameters
adminKeyToken AdminKey in b64 format.
tokenNameThe name of CSP for which the AdminKey is set. This name can be obtained using ListTokens() function.
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ SetIDinCard()

int Dastine::SetIDinCard ( string  SerialNumber)

Set an IDin card between other IDin cards connected to machine for working on it.

Parameters
SerialNumberinput the serial number of specific IDin card.
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ SetIDinCardIndexForIssuance()

int Dastine::SetIDinCardIndexForIssuance ( string  SerialNumber)

Set index of keystore IDin for issuance. IDin card must set before calling this method by SetIDinCard();

Parameters
Indexinput the number of specific keystore IDin. This number is between 0 to 3.
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ SetPIN()

int Dastine::SetPIN ( string  pin,
string  tokenName 
)

Sets pin for a token.

Parameters
pinToken pin.
tokenNameThe name of CSP for which the PIN is set. This name can be obtained using ListTokens() function.
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ SetTokenInsertEvent()

int Dastine::SetTokenInsertEvent ( void  )

This method no longer supported.

◆ SetTokenRemoveEvent()

int Dastine::SetTokenRemoveEvent ( void  )

Sets an event for the selected certificate's hardware token. On this token's removal, FireTokenRemovalEvent() is called.

Parameters
void
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ Sign()

string Dastine::Sign ( string  data,
string  hashAlg 
)

Signs the input data using the selected certificate. A certificate must have been selected before calling this function.

Parameters
dataInput data in base64 format which is desired to be signed.
hashAlgHash algorithm used in signing process.
Possible values are:
         SHA1
Returns
Signed data in base64 format if succeeded
Or an ErrorCode

◆ UnblockPIN()

int Dastine::UnblockPIN ( string  tokenName)

Unblock a token's PIN

Parameters
tokenNameThe name of CSP that it's PIN is going to be changed. This name can be obtained using ListTokens() function.
Returns
00   SUCCESSFUL
Or an ErrorCode

◆ UnicodeToBase64()

string Dastine::UnicodeToBase64 ( string  unicodeStr)

Converts a Unicode string to base64.

Parameters
unicodeStrInput Unicode string
Returns
Converted base64 string if succeeded
Or an ErrorCode