0

We are upgrading our CoSign boxes. I am testing our code against the new box.

All of the User create and update code works OK. The signing code gets this error:

08:52:15,663 gvl.ArxCoSignService addSignedSignatureFieldToPdfEDoc, Exception: java.lang.Exception: Failed create and sign err 90030389

The CoSign Signature APIs Developer’s Guide: Appendix E: simply says: 90030389 = SAPI_ERR_SIGN_HASH_CRYPT_SIGN_HASH, Problem creating hash value.

This is the signing code that is now failing.

private addSignedSignatureFieldToPdfEDoc(byte[] fileBytes, String user, String password,
                            Boolean invisible, page, xLocation, yLocation, width, height,
                            appMask, String dateMask, String timeMask, String reason) throws Exception {
    DssSignResult result
    try {
        def sigTypeURL = 'http://arx.com/SAPIWS/DSS/1.0/signature-field-create-sign'
        DSS dsService = new DSSLocator()
        DSSSoap arxService = dsService.getDSSSoap(new URL(arxEndpointDSS))
        RequestBaseTypeOptionalInputs optionalInputs = new RequestBaseTypeOptionalInputs()
                        // Set signature type (create field + sign)
        optionalInputs.setSignatureType(new URI(sigTypeURL))
                        // Set userName and password
        RequestBaseTypeOptionalInputsClaimedIdentity cosignUser = new RequestBaseTypeOptionalInputsClaimedIdentity()
        NameIdentifierType userName = new NameIdentifierType(user)
        userName.setNameQualifier(domain)
        cosignUser.setName(userName)
        String coSignPassword = encodePasswordForCosign(user)
        cosignUser.setSupportingInfo(new CoSignAuthDataType(coSignPassword, null, signPass))
        optionalInputs.setClaimedIdentity(cosignUser)
                        // Set signature field settings
        SAPISigFieldSettingsType sapiSigField = new SAPISigFieldSettingsType()
        sapiSigField.setTimeFormat(new TimeDateFormatType(ExtendedTimeFormatEnum.GMT, dateMask, timeMask))
        sapiSigField.setName('Signature1')
        sapiSigField.setDependencyMode(DependencyModeEnum.Independent)
        sapiSigField.setSignatureType(SignatureTypeEnum.Digital)
        sapiSigField.setAppearanceMask(new UnsignedInt(appMask))
        sapiSigField.setLabelsMask(new UnsignedInt(appMask))
        sapiSigField.setFlags(new UnsignedInt(0))
        sapiSigField.setEmptyFieldLabel('')
        sapiSigField.setInvisible(invisible)
        if (!invisible) {
            // log.debug 'addSignedSignatureFieldToPdfEDoc, Setting signature field location'
            sapiSigField.setPage(page)
            sapiSigField.setX(xLocation)
            sapiSigField.setY(yLocation)
            sapiSigField.setHeight(height)
            sapiSigField.setWidth(width)
        }
        optionalInputs.setSAPISigFieldSettings(sapiSigField)
        List<ConfValueType> config = new ArrayList<ConfValueType>()
                        // Set the reason
        // log.debug 'addSignedSignatureFieldToPdfEDoc, Setting the reason'
        if (reason != null && reason.trim().length() > 0) {
            ConfValueType ct = new ConfValueType()
            ct.setStringValue(reason)
            ct.setConfValueID(ConfIDEnum.Reason)
            config.add(ct)
        }
        if (config.size() > 0) {
            optionalInputs.setConfigurationValues(config.toArray(new ConfValueType[0]))
        }
                        // Set flags
        optionalInputs.setFlags(new UnsignedInt(0))
                        // Set return PDF tail only
        optionalInputs.setReturnPDFTailOnly(new Boolean(true))
        RequestBaseTypeInputDocuments inputDocs = new RequestBaseTypeInputDocuments()
        DocumentType myDoc = new DocumentType()
        DocumentTypeBase64Data docBytes = new DocumentTypeBase64Data(fileBytes)
        docBytes.setMimeType('application/pdf')
        myDoc.setBase64Data(docBytes)
        inputDocs.setDocument(myDoc)
                        // Make the call
        SignRequest signRequest = new SignRequest()
        signRequest.setOptionalInputs(optionalInputs)
        signRequest.setInputDocuments(inputDocs)
        result = arxService.dssSign(signRequest)
                        // Check result
        ResponseBaseTypeResult rc = result.getResult()
        String resultMessage = rc.getResultMajor().toString()
        if (resultMessage.compareTo(coSignSuccessMessage) != 0) {
            throw new Exception(rc.getResultMessage().get_value())
        }
                        // Return the signature
        SignatureObjectType sig = result.getSignatureObject()
        SignatureObjectTypeBase64Signature sig64 = sig.getBase64Signature()
        return sig64.get_value()
    } catch (java.rmi.RemoteException e) {
        log.error 'addSignedSignatureFieldToPdfEDoc, RemoteException: ' + e
        throw e
    } catch (Exception e) {
        log.error 'addSignedSignatureFieldToPdfEDoc, Exception: ' + e
        throw e
    }
}

I am assuming we may need to update some of the jar files. Here are the current imports.

//ARX Imports and Includes

import _0._2.SPML.tc.names.oasis.AddRequestType
import _0._2.SPML.tc.names.oasis.AddResponseType
import _0._2.SPML.tc.names.oasis.DeleteRequestType
import _0._2.SPML.tc.names.oasis.ExecutionModeType
import _0._2.SPML.tc.names.oasis.PSOIdentifierType
import _0._2.SPML.tc.names.oasis.PSOType
import _0._2.SPML.tc.names.oasis.ResponseType
import _0._2.SPML.tc.names.oasis.ReturnDataType
import _0._2.SPML.tc.names.oasis.StatusCodeType
import password._0._2.SPML.tc.names.oasis.SetPasswordRequestType
import assertion._0._1.SAML.tc.names.oasis.NameIdentifierType
import schema.core._0._1.dss.tc.names.oasis.*
import search._0._2.SPML.tc.names.oasis.SearchRequestType
import search._0._2.SPML.tc.names.oasis.SearchResponseType

import com.arx.SAPIWS.DSS._1_0.*
import com.arx.SAPIWS.DSS._1_0.DSSLocator
import com.arx.SAPIWS.SPML._1_0.CoSignLogonData
import com.arx.SAPIWS.SPML._1_0.SPML
import com.arx.SAPIWS.SPML._1_0.SPMLLocator
import com.arx.SAPIWS.SPML._1_0.SPMLSoap
import com.arx.SAPIWS.SPML._1_0.UserKindEnum
import com.arx.SAPIWS.SPML._1_0.UserRecord

Any help resolving this problem will be greatly appreciated.

DennLindy
  • 21
  • 5
  • 1
    Try to re-generate the java classes and create new jar files as described here- http://developer.arx.com/quick-start/sapi-web-services/#lang=glang-java – Almog G. Jun 28 '15 at 13:40
  • OK, created new jar files. I cannot find the class: DssSignResult. I also get an error on this line: DSS service = new DSS(new URL(arxEndpointDSS)). You cannot create an instance from the abstract interface 'com.arx.SAPIWS.DSS._1_0.DSS'. – DennLindy Jul 02 '15 at 19:39
  • Which (major) version of Java JDK do you use- 6, 7 or 8? Also, what is the firmware version of your CoSign appliance? – Almog G. Jul 05 '15 at 14:28
  • CoSign appliance firmware is version 7.4. Java version 1.7.0 – DennLindy Jul 07 '15 at 14:26
  • Here you go- https://app.box.com/s/aopyo3ht183vw4j9j5kj1ttog7lg9oyv Use these jars instead and please let me know whether it works or not – Almog G. Jul 09 '15 at 14:22
  • I am using code from this page: https://www.arx.com/forum/content.php?149-java-sign-pdf-webservice – DennLindy Jul 10 '15 at 19:39
  • I am getting this error now on this line. inputs.getOtherOrDocumentHashOrTransformedData().add(myDoc) No signature of method: oasis.names.tc.dss._1_0.core.schema.RequestBaseType$InputDocuments.getOtherOrDocumentHashOrTransformedData() is applicable for argument types: () values: []. – DennLindy Jul 10 '15 at 20:30
  • the generated name of this function (and maybe other functions as well) is a bit different using these jar files- getOtherOrTransformedDataOrDocument(). – Almog G. Jul 13 '15 at 12:12
  • Ok, got past that hurdle. Now it is connecting to the CoSign box, but I cannot seem to get the correct Username and password. This line returns this error. log.error("Cannot sign, Got error: " + rc.getResultMessage().getValue()) DevArxCoSignService Cannot sign, Got error: Failed to verify user name and password – DennLindy Jul 13 '15 at 16:14
  • // New Code that DOES NOT work on new CoSign Boxes NameIdentifierType cosignUserProps = new NameIdentifierType() cosignUserProps.setValue(user) cosignUserProps.setNameQualifier(domain) String encodedPassword = encodePasswordForCosign(user) CoSignAuthDataType cosignPassword = new CoSignAuthDataType() cosignPassword.setLogonPassword(encodedPassword) ClaimedIdentity cosignUser = new ClaimedIdentity() cosignUser.setName(cosignUserProps) cosignUser.setSupportingInfo(cosignPassword) – DennLindy Jul 13 '15 at 16:15
  • // OLD CODE that works on current CoSign Boxes RequestBaseTypeOptionalInputsClaimedIdentity cosignUser = new RequestBaseTypeOptionalInputsClaimedIdentity() NameIdentifierType userName = new NameIdentifierType(user) userName.setNameQualifier(domain) cosignUser.setName(userName) String coSignPassword = encodePasswordForCosign(user) // we use a salt so it isn't immediately obvious we are encoding the username as the rawPassword cosignUser.setSupportingInfo(new CoSignAuthDataType(coSignPassword, null, signPass)) optionalInputs.setClaimedIdentity(cosignUser) – DennLindy Jul 13 '15 at 16:16
  • Almog, Where can I find documentation for the new API? – DennLindy Jul 13 '15 at 18:23
  • Note that in your old code you've provided a sign password ('signPass') which is not provided in the new code. Add this line to the new code (just below the logon pasword)- cosignPassword.setSignPassword(signPass). – Almog G. Jul 14 '15 at 07:35
  • The documentation can be found here- http://docs.arx.com/CoSign_APIs/doc_v7.2/Default.htm#doc_7.2/CoSign%20Signature%20SOAP.htm – Almog G. Jul 14 '15 at 07:37
  • Almog, thanks for your help on this issue. One of my co-workers used your suggestions and got it to work. – DennLindy Oct 06 '15 at 17:29

0 Answers0