• create the key object and the license object.


             SentinelKeys theKey =
new SentinelKeys();                                   // class for the key
             SentinelKeysLicense theLicense = new SentinelKeysLicense();        
// class for the license
  


  • declare the following variables to use with the 2 classes .


             
long          DeveloperID;                  // Developer ID of Sentinel Keys key
              int []         licHandle = new int [1];   
// Handle for License  
              int            status;                         
// The Sentinel Keys API return codes



  • acquire a License from the Sentinel Keys key using the SFNTGetLicense() API function .


            status = theKey.SFNTGetLicense(theLicense.
DEVELOPERID , theLicense. SOFTWARE_KEY ,
                          theLicense.
LICENSEID , theKey. SP_STANDALONE_MODE
, licHandle);



  • i f the d ongle not found or invalid d ongle  inserted then you can take he appropriate action, i.e: exit the application.


     
       if (status != theKey. SP_SUCCESS )
            {
                 JOptionPane.showMessageDialog(
null , "Dongle not found!" , "error" , JOptionPane. ERROR_MESSAGE
);
                 System.
exit
(0);
            }



  • call the ECC feature to sign a 255 byte data with the key stored in the dongle and later verify it with the key stored in the application.


             byte [] signBuffer = new byte [255];         // data to be signed
             byte [] signResult = new byte [42];         
// signed data

            theKey.SFNTSign(licHandle[0], theLicense. MY_ECC_FEATURE
, signBuffer, signBuffer.length, signResult);
            theKey.SFNTVerify(licHandle[0], theLicense.
PUBLIC_KEY_MY_ECC_FEATURE
, signBuffer,
                          signBuffer.
length
, signResult);



  • if the sign/verify calls is success ful then the dongle and the application are integrated successfuly and your application cannot run without the dongle.
API Demonstration

We will demonstrate how to integrate the dongle APIs with your application using the Sentinel Hardware Key s API , which comes with the software development kit of the dongle.

Application: Protecting a java application plication using the Sentinel Hardware Key .
Programming language: Java 1.6
Dongle Type: Sentinel Hardware Key.
Dongle SDK: Sentinel Keys 1.2.1
OS: Windows XP SP2 .

Design the strategy

  • use the Sentinel Keys software kit to add any number of features your strategy requires,
    from counters to AES 128-bit features and ECC sign/verify features.


for simplicity city's sake we will only add one ECC feature to the protection strategy. ECC (Elliptic Curve Cryptography) is a public key cryptography system that uses two keys to make a secure and private session between two parties, hence the dongle and the application.

open the kit , add an ECC feature and then click 'build' . the kit will p rogram the key with the
strategy, prepare a code sketch and
generate the header file you will include in your
program.
Create the application


  • copy the com.safenet.sentinel folder which were generated by the kit to the project src folder.
  • copy the license file SentinelKeysLicense.java to the src folder, this file contains license and key information.
  • copy the Sentinel Keys client library SentinelKeysJDK.dll to your <WINDIR> /system32 directory.
Call the APIs
Create the application


  • copy the com.safenet.sentinel folder which were generated by the kit to the project src folder.
  • copy the license file SentinelKeysLicense.java to the src folder, this file contains license and key information.
  • copy the Sentinel Keys client library SentinelKeysJDK.dll to your <WINDIR> /system32 directory.

Zakaria & Partners Co.  Cairo, Egypt. Tel: +2(02)26441400 / +2(02)26441800 Fax: +2(02)26386868
e-mail: zakariaimport@yahoo.com
site designed by ahmed.r.badr@gmail.com  site logo designed by mohammad.elsebaie@gmail.com

go to shell protection demostration