Can not encrypt a signature using Topaz SigWeb API

831 views Asked by At

I am trying to integrate SigWeb API into my application. I want to use the digital signature in all modern browsers. Now it works only in IE, using ActiveX object. The problem is that I can not use the encryption key. Let me explain:

Old version js code looks like:

    SigPlus1.AutoKeyStart();
    SigPlus1.AutoKeyData = "Some Key Data";
    SigPlus1.AutoKeyFinish();
    SigPlus1.EncryptionMode = 2;
    SigPlus1.SigCompressionMode = 1;
    var strSignature = SigPlus1.SigString;

New version (using SigWebTablet.js):

    AutoKeyStart();
    SetAutoKeyData("Some Key Data");
    AutoKeyFinish();
    SetEncryptionMode(2);
    SetSigCompressionMode(1);
    var strSignature = GetSigString();

The value of strSignature is passed to the server and converted to .jpg file. On the server side (java) I am using following code:

ClassLoader firma = (com.topaz.sigplus.SigPlus.class).getClassLoader();
            sigObj = (SigPlus)Beans.instantiate(firma, "com.topaz.sigplus.SigPlus");
            sigObj.autoKeyStart();
            sigObj.setAutoKeyData("Some Key Data"); // the same data in front-end
            sigObj.autoKeyFinish();
            sigObj.setEncryptionMode (2);
            sigObj.setSigCompressionMode(1);
            sigObj.setSigString(strSignature);

The problem in setSigString method - it doesn't set the new value (with the old code SigPlus1.SigString works), but if I disable setAutoKeyData - it works fine. The tablet model: T-LBK766SE-BHSB-R

1

There are 1 answers

0
S. Yemets On BEST ANSWER

I have found a solution which works for me. Before signature capture it needs to reset the encryption mode, i.e. to call SetEncryptionMode(0)

UPD (05/03/2017). Guys from dev support recommended me to use AutoKeyAddData function instead AutoKeyStart and AutoKeyFinish functions. I have tested and it works for me. I think this better solution of this issue. http://www.sigplusweb.com/sigwebtablet_autokeydemo.htm