Skip to content
Last updated

SWS Integration Guide

Table of Contents


Introduction

After installing and configuring your virtual appliance SWS or SaaS instance, now you can use their method to sign or apply timestamp. SWS have two interfaces SOAP and REST. SOAP and REST standard interface is used for files under 80MB and REST big interface is used for files over 80MB.

SWS can manage some signature devices like:

  • automatic signature (her name starts with AHI or AHIP followed by numbers)
  • eSeal (her name starts with SHI or SHIP followed by numbers)
  • remote signature (her name starts RHI or RHIP followed by numbers)
  • disposable signature (her name starts with RHI or RHID followed by numbers)
  • long-lived signature (her name starts with RHIL or RHILD followed by numbers)

During the integration, you can only see:

  • eSeal like an automatic signature
  • disposable, long-lived like a remote signature

The remote signature is like an extension of the automatic signature because it requires the OTP code beyond username and password.

SWS supports three different types of signatures:

  • Pades: valid only for PDF files
  • Xades: valid only for XML files
  • Cades: valid for every type of file

Apply timestamp on files (according to standard RFC3161)

Each type of signature and timestamp has its web method, which is described in the next sections.

In this user guide, the examples will be shown using "SoapUI". This is a free tool which can be installed on every OS. It is possible to create SOAP requests with this tool that invokes different web methods.

During the integration, the application client of SWS should recreate the same XML soap request created on SoapUI with his program language.

Methods for sign

SWS offer different method according to type of device signature. For example with automatic signature isn't possible to use the method "sendOtpBySMS" because don't require the second factor for sign.

Below will be described all methods offered by SWS.

Sign interface#MethodgetAvailableSignatures

Methods for automatic and remote signature

The main methods used to sign (valid for remote and automatic signatures) are:

  • signPAdES → Used for sign only PDF files
  • signPAdESMultiFieldName → Used for sign only PDF files, the field signature must exist
  • signCAdES → Used for sign every type of files
  • signXAdES → Used for sign XML files
  • signPkcs1 → Used for raw signature (require the client of SWS make the cryptographic envelope)
  • getSignatures → allows obtaining the number of signatures, since the certificate was issued
  • getCertificate → allows obtaining the certificate associated to signature device
  • getAvailableSignatures → allows obtaining the numbers of signatures (valid only for device NOT pay per use, otherwise an exception is generated)
  • changePassword → allows changing the password (PIN) of the device

Each method requires the Credentials object. In the next section, you will see how to populate this field.

Method signPades

In this table are defined the parameters required (IN) and the output (OUT) of this method:

NameTypeDescriptionIN/OUT
credentialsCredentialsSee the Credentials section to see how to populate this objectIN
bufferbyte[]Byte array which you want to signIN
PAdESPreferencesPAdESPreferencesSpecify the details of PadesSignatureIN
byte[]Byte array containing the files just signedOUT

Method signPadesMultiFieldName

In this table are defined the parameters required (IN) and the output (OUT) of this method:

AVAILABLE FROM VERSION 2.5.57

NameTypeDescriptionIN/OUT
credentialsCredentialsSee the Credentials section to see how to populate this objectIN
bufferbyte[]Byte array which you want to signIN
PAdESPreferencesPAdESPreferencesSpecify the details of PadesSignatureIN
PadesWithMultiFieldNameComplex object with details about signatures and errorOUT

PadesWithMultiFieldName

Here you can find a description of the complex object PadesMultiFieldName.

NameTypeDescriptionIncluded from SWS version
signedContentbyte[]File signed fully or partially2.5.57
remainingFieldNamesList<String>List of unsigned fields (if the file signed is partially)2.5.57
serviceErrorServiceErrorComplex object with details about error. This field is populated if the "signedContent" is partially signed2.5.57

ServiceError

Here you can find a description of the complex object ServiceError.

NameTypeDescriptionIncluded from SWS version
codeinterror code generated during the signature2.5.57
messageStringerror message generated during the signature2.5.57

NOTE: For example if you want sign a PDF with 10 fields signatures ("field-1", "field-2", ... "field-10") using the sessionKey after 6 signatures the session key has expired in output will receive this response.

ResponseMultiFieldName

signedContent = PDF with 6 signatures (the fields signed are: "field-1", "field-2",...,"field-6")

remainingFieldNames = ["field-7","field-8","field-9","field-10"]

IMPORTANT!!!

The serviceError will be:

serviceError.code = 69

serviceError.message = "SessionKeyScaduta"

Example of usage

In this sequence diagram, you can see usage standard (when the session key no expire):



In this use case we are signing the signatures fields ("Field-1", "Field-2" and "Field-3") of "pdf_to_sign" and SWS make all three signatures required without problem returning the "pdf_fully_signed".


Below you can find a sequence diagram that explains the method "signPadesMultiFieldName" when the session key expire.


In this use case our target is: sign 3 fields ("Field-1", "Field-2" and "Field-3") of "pdf_to_sign" using a session key.

Make the request using "signPadesMultiFieldName" and after two signature the session key has expire.

Therefore the response will be:

  • the pdf_partially_signed (contains two signatures)
  • ServiceError contain the details about error (in this example session key expired)
  • List of unsigned fields: Field-3

To complete all three signatures we must:

  • generate "new_sessionKey"
  • make a new request of signPadesMultiFieldName using pdf_partially_signed and set "Field-3" as list fields to sign

Finally, in response we obtain the pdf_fully_signed!

Method signCades

In this table are defined the parameters required (IN) and the output (OUT) of this method:

NameTypeDescriptionIN/OUT
credentialsCredentialsSee the Credentials section to see how to populate this objectIN
bufferbyte[]Byte array that you want to signIN
CAdESPreferencesCAdESPreferencesSpecify the details of PadesSignature. See the CadesPreferences section to populate this objectIN
byte[]List of byte array containing the file just signedOUT

Method signXades

In this table are defined the parameters required (IN) and the output (OUT) of this method:

NameTypeDescriptionIN/OUT
credentialsCredentialsSee the Credentials section to see how to populate this objectIN
bufferbyte[]Byte array that you want signIN
XAdESPreferencesXAdESPreferencesSpecify the details of XadesSignature. See the XadesPreferences section to populate this objectIN
byte[]Byte array containing the file just signedOUT

Method signPkcs1

In this table are defined the parameters required (IN) and the output (OUT) of this method:

NameTypeDescriptionIN/OUT
credentialsCredentialsSee the Credentials section to see how to populate this objectIN
bufferbyte[]hash associated the file you want signIN
SignPreferencesSignPreferencesSpecify the hash algorithm used to sign the hashIN
byte[]Byte array containing the hash associated to the file just signedOUT

NOTE:

SignPreferences is a complex object, the method require only the field: SignPreferences.hashAlgorithm

Possible values:

  • SHA-256 (default value if not specified)
  • SHA-1
  • SHA-384
  • SHA-512

Method changePassword

In this table are defined the parameters required (IN) and the output (OUT) of this method:

NameTypeDescriptionIN/OUT
credentialsCredentialsSee the Credentials section to see how to populate this objectIN
newPasswordStringString that contains the new passwordIN

VERY IMPORTANT: If the customer forgets the new password, it IS NOT POSSIBLE to recover/reset the password.

Methods only for remote signature

If you are signing with a remote signature, you can also use these methods:

  • getOTPList → allows obtaining the list of OTPs associated with your remote signature (OTP is assigned to the owner of the certificate. For example, if you have two or more remote signatures associated with the same owner, you can use this OTP for each remote signature).
  • sendOtpBySMS → it will send an SMS containing the OTP code
  • openSession → allows obtaining the token (like a string) for the signature instead of inserting new OTP code for each signature. The token is available for three minutes from generation.
  • getRemainingTimeForSession → returns time until the session is valid
  • closeSession → if you want to destroy the token before three minutes (however will expire after three minutes)

Method getOtpList

NameTypeDescriptionIN/OUT
credentialsCredentialsSee the Credentials section to see how populate this objectIN
List<OTP>List of OTP assigned to the CredentialsOUT

Method sendOtpBySMS

NameTypeDescriptionIN/OUT
credentialsCredentialsSee the Credentials section to see how populate this objectIN

After this method is done the customer receives an SMS with an OTP code to use.

Method openSession

NameTypeDescriptionIN/OUT
credentialsCredentialsSee the section Credentials for see how populate this objectIN
StringSessionkey to use for signOUT

At the end of this method the customer will receive string with sessionKey for sign (credentials.sessionKey)

Method getRemainingTimeForSession

NameTypeDescriptionIN/OUT
credentialsCredentialsSee the section Credentials for see how populate this objectIN
intSeconds left until the session is validOUT

Method closeSession

NameTypeDescriptionIN/OUT
credentialsCredentialsSee the section Credentials for see how populate this objectIN

After this method is done the session is destroyed.

Methods for timestamp

SWS offers methods for applying timestamp and enquiry (only for Namirial accounts).

  • timestamp → allows to get the file with timestamp; there are two types TSR or TSD. The TSR option means that the timestamp is in another file, while TSD means that the timestamp signature is in the same file.
  • getAvailableTimestamps → allows getting the timestamp; available ONLY for Namirial account.

Each method is described below with the required inputs.

Method timestamp

NameTypeDescriptionIN/OUT
contentbyte[]Byte array to which the timestamp is appliedIN
preferences (SOAP)

preferences (REST)
timestampPreferencesPreferences about timestamp url, username, passwordIN
byte[]Timestamp in binary formatOUT

This method can be used with all timestamp account (not only Namirial) they must use standard RFC3161.

NOTE: Since SWS v2.5.44 this method supports Adobe Timestamp. In the timestampPreferences you should set "outputAsPDF=true".

TimeStampPreferences

Below will described how populate the preferences about timestamp

NameTypeMandatoryDefault valueDescriptionIncluded from SWS version
timestampUrlStringyesUrl for timestamp service
timestampUsernameStringyesUsername for timestamp service
timestampPasswordStringyesPassword for timestamp service
outputAsTSDbooleantrue
  • TRUE permits to obtain in output the file+timestamp (TSD)
  • FALSE permits to obtain in output only timestamp (TSR)
outputBase64Encodedbooleanfalsereturn the output in base64 encode
outputAsPDFbooleanfalseAllow to obtain the timestamp according to Adobe standard2.5.44
timestampHashAlgoStringSHA256Hash algorithm used for generate the timestamp

TimestampUrl can be set to:

Method getAvailableTimestamps (since SWS v2.5.44)

NameTypeDescriptionIN/OUT
preferencesTimeStampPreferencestimestamp url, username, passwordIN
LongNumber of timestamps availableOUT

NOTE: TimestampUrl can be set to:

How Sign the file

To sign the file with SWS each method requires parameters:

  • Credentials: contain the value about signature device;
  • Preferences: contain the details of the signature such as page, appearance etc., Level of signature (B, T, LT, etc.). There are different types of preferences PadesPreferences, CadesPreferences, XadesPreferences;
  • buffer: file you want to sign.

In the next sections you will learn how to set these parameters.

Credentials Object

All methods for signing (signPAdES..., signCAdES..., signXAdES) use the Credentials object, as you can see in this table:

NameTypeDescription
usernameStringDevice name starts with: RHI (remote/disposable), SHI (eSeal) or AHI (automatic)
passwordStringPIN associated to device name (can be set by the customer or read into blind envelope)
idOtpintotp identifier associated to device (used only in remote signature) can be SMS, App, Token . Every remote device can have one or more idOtp (for example a remote signature can have associated SMS and App OTP)
otpStringotp code for sign/change password (this is used only in remote device)
sessionKeyStringstring code (like a token) valid 3 minutes for sign (instead to insert every times new otp code)
securityCodeStringThis is the second factor (used in automatic and eSeal) for change the password. This code is linked to the portal account

How to fill in these fields?

For automatic and remote signature

For each type of signature (automatic signature and remote signature) you must fill in these two fields:

  • username: contains the device name starting with RHI..., AHI... or SHI...
  • password: contains the PIN associated to the device (read from the blind envelope or set by the customer)

Only for automatic signature

Only if you use the automatic signature (username starts with AHI... or SHI...) you should fill in these fields:

  • securityCode: this parameter must not be set. It is used only in certain situations (for example during the change password)

Only for remote signature

Only if you use the remote signature (username starts with RHI...) you should fill in these fields:

  • idOtp: (optional) specify the idOtp you want to use for the signature. If you do not want to set the idOtp, you can set idOtp to "-1" and SWS will automatically use the default OTP, threfore will be used: the FIRST element of list generated by the method "getOtpList". Else, using the method "getOTPList", you can retrieve all idOtp belong to specific username;
  • Otp: contains the OTP code received via SMS or read in the Namirial app;
  • sessionKey: contains the token (like a string) received from openSession method;

How works method getOTPList?

With this method, you can get the OTP list which can be used with the specified username, and you can fill in the Credentials.idOtp variable.

This method requires only the username.

NomeTipoDescrizioneIN/OUT
credentialsCredentialsYou must specify only credentials.username with the device name (RHI...)IN
List<OTP>list of OTPs associated to device nameOUT

The "OTP" object is compose by:

NameTypeDescription
idOtpintidentifier otp used for sign/change password
serialNumberStringthis field isn't used by SWS, this is serial number printed on OTP token
typeStringThe possible values are:
  • SMS
  • OTP PUSH (not consider this value for SWS, this is used for other purpose)
  • OTP GENERATOR (OTP showed on Namirial App)
  • FISICO (this is the otp token)

NOTE: with SWS is not possible to use the OTP with type "OTP PUSH".

Sign with OTP SMS

If you decide to sign with OTP SMS, you should use the method sendOTPBySMS.

sendOTPBySMS

NameTypeDescriptionIN/OUT
credentialsCredentialsYou must specify only credentials.username with the device name (RHI...)IN
voidwill receive on your mobile phone the SMS with OTP codeOUT

Sign with OTP GENERATOR (App)

If you decide to sign with OTP GENERATOR, you should open the Namirial OTP App and insert the OTP code shown during the signing process.

→Show the guide "How to configure Namirial OTP App" (To Do/Add)

Sign with sessionKey

With otp it is possible to create only one signature, but if you need to sign more files, it is possible with “sessionKey”. The next section describes how the session works.

This function is available only for remote signatures. It allows signing for a maximum of 3 minutes with the same sessionKey. You can see the session like a token provided from the method “openSession”.

Sign with sessionKey

With otp it is possible to create only one signature, but if you need to sign more files, it is possible with “sessionKey”. The next section describes how the session works.

This function is available only for remote signatures. It allows signing for a maximum of 3 minutes with the same sessionKey. You can see the session like a token provided from the method “openSession”.

How obtain the sessionKey?

The “openSession” method allows obtaining the sessionKey.

Input requires:

  • username
  • password
  • otp
  • idOtp

openSession

NameTypeDescriptionIN/OUT
credentialsCredentialsYou must specify:
  • credentials.username with the device name (RHI...)
  • credentials.password
  • credentials.idOtp
  • credentials.otp
IN
Stringwill receive the session which
will be used for sign
will be the value of credentials.sessionKey
OUT

The sessionKey is valid for three minutes from has been generated. With this is possible to sign unlimited files.

How to check if the sessionKey has expired or is valid

You can find out when the session expires with the method getRemainingTimeForSession.

This method requires input:

  • username
  • sessionKey (obtained from method "openSession")

getRemainingTimeForSession

NameTypeDescriptionIN/OUT
credentialsCredentialsYou must specify:
  • credentials.username with the device name (RHI...)

  • credentials.sessionKey
  • IN
    intseconds until the sessionKey is validOUT

    Destroy the session manually

    The method closeSession requires in input:

    • sessionKey
    • username

    closeSession

    NameTypeDescriptionIN/OUT
    credentialsCredentialsYou must specify:
  • credentials.username with the device name (RHI...)

  • credentials.sessionKey
  • IN
    the sessionKey will be destroyedOUT

    NOTE: for security reasons, this method doesn't generate an exception if you insert the wrong sessionKey and/or username.

    Sequence diagram for signature with session with OTP App

    In this sequence diagram, we can summarise the methods that are for the signature with sessionKey and OTP SMS:

    Sequence diagram for signature with session and OTP SMS

    In this sequence diagram, we can summarise the methods that are called for the signature with sessionKey and OTP SMS:

    Summarize

    Finally, we have all the requirements to populate the Credentials object during the signing.

    As already mentioned, the methods for signing are:

    • signPAdES
    • signCAdES
    • signXAdES

    There are the same methods with the suffix "List", they accept in input a list of files to be signed.

    Therefore with only SOAP requests is possible to sign more files (using automatic signature or sessionKey).

    With these three methods it is possible to sign with any type of signature (automatic and remote).

    Each of these three methods uses the Credentials object filled in at the same time.

    For the automatic signature, it requires only the username and password variables in the object Credentials.

    If you use a remote signature, you should also fill in the other fields:

    • idOtp
    • OTP or sessionKey

    Therefore for the automatic signature, the credentials object is composed by:

    • username
    • password

    While for the remote signature, the credentials object is composed by:

    • username
    • password
    • otp
    • idOtp
    • sessionKey

    If you need to sign multiple files with remote signature you should use the sessionKey as described earlier. Now, that we know how to fill the Credentials object for the methods: signPades, signCades and signXades, we can fill the object buffer.

    Now we should populate the value of:

    • buffer
    • preferences of signature (there are different types for each type of signature)

    Populate the "buffer"

    The buffer contains the file (in byte array) you want to sign.

    In SoapUI, for example, the buffer is composed of the base64 of the file you want to sign, as in this example:

    REQUEST-remote-signPades

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.ws.nam/">
       <soapenv:Header/>
       <soapenv:Body>
          <ser:signPAdES>
             <credentials>
                <idOtp>501719</idOtp>
                <otp>548316</otp>
                <password>13572468</password>
                <username>RHIP20102336019765</username>
             </credentials>
             <buffer>BASE64-FILE-TO-SIGN</buffer>
             <PAdESPreferences>
                <level>B</level>
                <signerImage></signerImage>
             </PAdESPreferences>
          </ser:signPAdES>
       </soapenv:Body>
    </soapenv:Envelope>

    You can download the complete example at this link: signPadesList.xml

    The output is the base64 associated with the file you just signed as follows: RESPONSE-base64-signPadesList.b64 and decoded will be this PDF: RESPONSE-signPadesList.pdf

    Signature Preferences

    The difference between signPades, signCades and signXades is based on the preferences:

    • signPades → use PadESPreferences
    • signCades → use CadESPreferences
    • signXades → use XadESPreferences

    How to populate these preferences is described in the next sections.

    PadES Preferences

    This type of preference is used in method signPades. Their main options are:

    NameTypeMandatoryDefault valueDescriptionIncluded from SWS version
    hashAlgorithmStringSHA256Algorithm you want to use for signature. Possible values are: SHA1, SHA256, SHA384, SHA512.
    levelLevelBSee the description of Level type.
    signTypeint
    encryptInAnyCasebooleanfalse
    filenameInTSDStringNot used.
    outputAsTSDbooleanNot used.
    withTimestampbooleanfalseSpecify whether you want to add the timestamp to the signed file or not.
    outputBase64EncodedbooleanfalseSet true if you want the file signed in Base64 encoding.
    timestampHashAlgoStringSHA-256Algorithm you want to use during the process of applying timestamp.
    timestampUrlStringURL of timestamp provider with standard RFC3161.
    Namirial URL:
    • PROD: https://timestamp.namirialtsp.com / http://timestamp.namirialtsp.com
    • TEST: https://timestamp.test.namirialtsp.com / http://timestamp.test.namirialtsp.com
    timestampUsernameStringUsername of timestamp credentials.
    timestampPasswordStringPassword of timestamp credentials.
    needAppearanceDisabledbooleanfalseDeprecated.
    page1Indicate the page number on which you want to apply the signature appearance. If you want to add the appearance on the last page of the PDF file, you should set it to "-1".
    withTimestampbooleanfalseSet true if you want to apply the timestamp after the signature.
    encryptionPasswordStringSpecify the password PDF, if present.
    lockFieldsList<String>
    signerImageSignerImageSee the description of SignerImage.
    signerImageReferenceStringUsed to specify the template to be used (used in old version).
    withSignatureFieldbooleanfalseSet true if you want to apply the signature on signature field in the PDF file.

    SignerImage

    The SignerImage object is composed of the following:

    NameTypeMandatoryDefault valueDescriptionIncluded from SWS version
    imagebyte[]Contains the image you want to apply to the appearance.
    signerNameStringContains the text you want to type to the appearance.
    reasonStringIndicate the reason for the signature.
    textVisiblebooleantrueAllows the text to be shown on appearance or not.
    textPositionStringPosition of the signerName on appearance. It is possible to choose between:
    • TOP
    • BOTTOM
    • RIGHT
    • LEFT
    xintX coordinate of the appearance (0 is on left of the page).
    yintY coordinate of the appearance (0 is on bottom of the page).
    widthintSpecify the width of the appearance.
    heightintSpecify the height of the appearance.
    fieldNameStringSpecify the fieldname to which the signature is to be applied. This fieldName must already exist in the PDF file before the signature is applied.
    fontNameStringTimes-RomanSpecify the font to be used for the text on the appearance. Possible values:
    • Times-Roman
    • Times-Bold
    • Times-Italic
    • Times-BoldItalic
    • Helvetica
    • Helvetica-Bold
    • Helvetica-Oblique
    • Helvetica-BoldOblique
    • Courier
    • Courier-Bold
    • Courier-Oblique
    • Courier-BoldOblique
    • Symbol
    • ZapfDingbats
    OR specify the absolute path of a .ttf font file.
    2.5.39
    imageURLStringURL to get the logo for appearance.
    imageVisiblebooleanfalseAllows the logo to be displayed or not when it appears.
    fontSizeint10Allows the font size to be set.
    imageFilenameStringPath of the logo on appearance.
    scaledbooleanfalseSet true if you want to resize the logo on appearance.
    scaledTextbooleanfalseReduce the font size until it fits the appearance.
    locationStringPlace of the signature.2.5.53
    fieldsNameListList<String>List of signature fields you want to sign.2.5.57
    signAllFieldsbooleanfalseAllow signing all signature fields available in a PDF.2.5.57

    NOTE: if you are using the method "signPadesMultiFieldName", the property "signAllFields" have a priority on property "fieldsNameList"

    Below an example of output in Adobe if you use the option "location" and "reason":

    Use specific ttf (TrueTypeFont)

    With SWS is possible to use a specific font specifying a path of ttf files. The fonts available are:

    • DejaVu
    • helvetica-neue

    To use Dejavu, you must set value of "fontName" (signerImage.fontName) with this value:

    /usr/share/fonts/dejavu/@FONTNAME@

    The possible values of "@FONTNAME@" are:

    • DejaVuSans-BoldOblique.ttf
    • DejaVuSansCondensed-Oblique.ttf
    • DejaVuSansMono-Bold.ttf
    • DejaVuSans.ttf
    • DejaVuSans-Bold.ttf
    • DejaVuSansCondensed.ttf
    • DejaVuSansMono-Oblique.ttf
    • DejaVuSansCondensed-BoldOblique.ttf
    • DejaVuSans-ExtraLight.ttf
    • DejaVuSansMono.ttf
    • DejaVuSansCondensed-Bold.ttf
    • DejaVuSansMono-BoldOblique.ttf
    • DejaVuSans-Oblique.ttf

    To use Helvetica-Neue, you must set value of "fontName" (signerImage.fontName) with this value:

    /usr/share/fonts/helvetica-neue/@FONTNAME@

    The possible values of "@FONTNAME@" are:

    • HelveticaBlkIt.ttf
    • HelveticaNeueBold.ttf
    • HelveticaNeueCondensedBlack.ttf
    • HelveticaNeueCondensedBold.ttf
    • HelveticaNeueMedium.ttf
    • HelveticaNeueUltraLightItal.ttf

    Cades Preferences

    With cades signature, it is possible to sign each type of file. The signCades method requires:

    • Credentials assigned to device signature;
    • Buffer, the file that you want to sign;
    • CAdESPreferences, the preferences about CAdES signature.

    In the following table, you can see how to set the CAdESPreferences correctly:

    CAdESPreferences

    NameTypeMandatoryDefault valueDescriptionIncluded from SWS version
    filenameInTSD
    outputAsTSD
    outputBase64EncodedbooleanfalseEncodes the just signed file in base64.
    timestampHashAlgoStringSHA-256Algorithm you want to use during the process of applying timestamp.
    timestampPasswordString
    timestampUrlStringURL of the timestamp provider with the RFC3161 standard.

    Namirial URL:
    PROD: https://timestamp.namirialtsp.com / http://timestamp.namirialtsp.com
    TEST: https://timestamp.test.namirialtsp.com / http://timestamp.test.namirialtsp.com
    timestampUsernameStringUsername of the timestamp credentials.
    hashAlgorithmStringyesSHA256Algorithm which you want to use for signing. Possible values: SHA1, SHA256, SHA384, SHA512.
    levelLevelBSee the description of Level type.
    withTimestampbooleanfalseSet true if you want to apply the timestamp after the signature.
    counterSignature
    counterSignatureIndex
    detachedbooleanfalseSet true if you want the signature and the files in two different files. The output will be the signature.
    serialbooleanfalseAllow to make a serial signature (in append to signatures which already exist)

    Xades Preferences

    With Xades Signature it is possible to sign only XML files, the signXades method requires:

    • Credentials assigned to device signature
    • Buffer, file that you want to sign
    • XAdESPreferences, the preferences about XAdES signature

    In the following table you can learn how to set the XAdESPreferences correctly:

    NameTypeMandatoryDefault valueDescriptionIncluded from SWS version
    filenameInTSD
    outputAsTSD
    outputBase64EncodedbooleanfalseEncodes the just signed file in base64.
    timestampHashAlgoStringSHA-256Algorithm you want to use during the process of applying timestamp.
    timestampPassword
    timestampUrlStringURL of the timestamp provider with the RFC3161 standard.

    Namirial URL:
    PROD: https://timestamp.namirialtsp.com / http://timestamp.namirialtsp.com
    TEST: https://timestamp.test.namirialtsp.com / http://timestamp.test.namirialtsp.com
    timestampUsernameStringUsername of the timestamp credentials.
    hashAlgorithmStringyesSHA256Algorithm you want to use for signing. Possibile values: SHA1, SHA256, SHA384, SHA512
    levelLevelBSee the description of Level type.
    withTimestampbooleanfalseSet true if you want to apply the timestamp after the signature.
    detachedbooleanfalseSet true if you want the signature and the files in two different files. The output will be the signature.
    detachedReferenceURIString
    signElementStringAllows to specify the "Id" on XML which you want to sign.
    signatureIdStringAllows to specify the "Id" of the signature.
    withoutSignatureExclusionbooleanfalseAllows to sign the file with/without previous signature.
    XPathQueryStringAllows to sign a specified path of XML

    Level

    You can see how to set the correct Level signature:

    ValueDescriptionApply on signatureIncluded from SWS version
    BIn the signed file the electronic signature and the signing certificate are added.Pades, Cades, Xades
    TLike B-Level, but adds a time-stamp, respectively a time-mark that proves the signature existed at a certain date and time.Pades, Cades, Xades
    LTLike T-Level, but adds VRI (Verification Related Information) data to the DSS (Long Term).Pades, Cades, Xades
    LTALike LT-level, but adds a time stamp document and VRI data for the TSA (Time Stamping Authority). An LTA may help to validate the signature beyond any event that may limit its validity (Long Term with Archive Time-Stamps).Pades, Cades, Xades
    LTV(Long Term Validation) contains the OCSP/CRL response after the signature. It is used for validation after the signing certificate has expired.Pades

    How apply the timestamp

    It is possible to apply timestamp with the method timestamp, in input require:

    • content: byte array of the file to which the timestamp is applied;
    • preferences: object containing details about timestamp.

    Below the object timestamp:

    NameTypeMandatoryDefault valueDescriptionIncluded from SWS version
    filenameInTSD
    outputAsTSD
    outputBase64EncodedbooleanfalseEncoded the file just signed in base64.
    timestampHashAlgoStringSHA-256Algorithm you want to use during the process of applying timestamp.
    timestampPassword
    timestampUrlStringURL of the timestamp provider with RFC3161 standard.

    Namirial URL:
    PROD: https://timestamp.namirialtsp.com / http://timestamp.namirialtsp.com
    TEST: https://timestamp.test.namirialtsp.com / http://timestamp.test.namirialtsp.com

    Manage signer device

    As already mentioned, SWS offers a method for managing the signing device.

    Method changePassword

    This method requires a different signature according to device type: automatic/eseal or remote. The output of this method will change the password. NOTE: if the holder device forgets the new password, it IS NOT POSSIBLE TO RESET the password.

    changePassword on automatic/eseal signature

    Input requires:

    • credentials.username
    • credentials.password
    • credentials.securityCode
    • newPassword

    In output (if input is correct) will have the password associated to credentials.username set to "newPassword".

    changePassword on remote signature

    Input requires:

    • credentials.username
    • credentials.password
    • credentials.idOtp
    • credentials.otp
    • newPassword

    In output (if input is correct) will have the password associated to credentials.usernam set to "newPassword".

    Method getCertificate

    This method allow to obtain the certificate associated to signer device. This method require same input for automatic and remote signature. Below the details:

    NameTypeDescriptionIN/OUT
    credentialsCredentialsYou must specify:
  • credentials.username with the device name (RHI..., AHI, SHI)
  • IN
    byte[]byte array of certificate associated to signer deviceOUT

    Method getAvailableSignatures

    This method allow to obtain the number of signaures available This method require same input for automatic and remote signature. Below the details:

    NameTypeDescriptionIN/OUT
    credentialsCredentialsYou must specify:
    credentials.username with the device name (RHI..., AHI, SHI)
    IN
    intnumber of signatures availablesOUT

    NOTE: this method can't be used for signer device "pay-per-use" (device with unlimited signatures), will generate error with code: "56"

    Method getSignatures

    This method allow to obtain the number of signaures apposed since the device has been created This method require same input for automatic and remote signature. Below the details:

    NameTypeDescriptionIN/OUT
    credentialsCredentialsYou must specify:
  • credentials.username with the device name (RHI..., AHI, SHI)
  • IN
    intnumber of signatures apposedOUT

    Manage error in SWS

    Each method can generate an exception, for example PIN not correct, sessioneKey expired or OTP not correct.

    For example if we try to execute the signPAdESList method with the same OTP, we get the SOAP response with error 44, as in this response:

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
       <soap:Body>
          <soap:Fault>
             <faultcode>soap:Server</faultcode>
             <faultstring>Codice OTP errato, riprovare con il prossimo codice</faultstring>
             <detail>
                <ns2:WSException xmlns:ns2="http://service.ws.nam/">
                   <error>44</error>
                   <message>Codice OTP errato, riprovare con il prossimo codice</message>
                </ns2:WSException>
             </detail>
          </soap:Fault>
       </soap:Body>
    </soap:Envelope>

    By default, the error message is in the Italian language.

    Error codes

    Below is the table description of all error messages SWS can generate during your execution method:

    Error numberDescriptionEnglishItalian
    0No errors foundNo errors foundNessun errore riscontrato
    1Generic errorGeneric errorErrore Generico
    2Virtual device not foundVirtual device not foundDispositivo virtuale inesistente
    3Virtual device lockedVirtual device lockedDispositivo virtuale bloccato
    4Wrong credentialsWrong credentialsCredenziali errate
    5Wrong emergency codeWrong emergency codeCodice di emergenza errato
    6Virtual device status changes deniedVirtual device status changes deniedModifiche allo stato del dispositivo virtuale negate
    7Signature errorSignature errorErrore nella firma
    8Error creating slotError creating slotErrore nella creazione dello slot
    9Error deleting slotError deleting slotErrore nella eliminazione dello slot
    10PIN change errorPIN change errorErrore nel cambio PIN
    11Key generation errorKey generation errorErrore nella generazione chiave
    12Error in key management configurationError in key management configurationErrore nella configurazione del sistema di gestione delle chiavi
    13Wrong company codeWrong company codeCodice azienda errato
    14No available slotsNo available slotsNessuno slot disponibile
    15Virtual device already existsVirtual device already existsDispositivo virtuale gia' esistente
    16Operation performed using a wrong certificateOperation performed using a wrong certificateOperazione eseguita usando il certificato errato
    17Wrong virtual device codeWrong virtual device codeCodice dispositivo virtuale errato
    18Slot already usedSlot already usedSlot gia' utilizzato
    22Incompatible file format for the signature type requiredIncompatible file format for the signature type requiredRichiesta una firma di file di formato non compatibile con il tipo di firma richiesto
    23Unsupported hash algorithmUnsupported hash algorithmAlgoritmo di hash non supportato
    24Error decrypting CMS dataError decrypting CMS dataErrore nella decifratura del CMS EnvelopedData
    25Error importing key and certificatesError importing key and certificatesErrore nell'importazione di chiave e certificati
    26The public key in the certificate does not match the private keyThe public key in the certificate does not match the private keyChiave pubblica nel certificato non corrisponde a quella privata
    27Web method denied for the credentials or ssl certificate usedWeb method denied for the credentials or ssl certificate usedEseguita una chiamata a web method mediante credenziali o certificato ssl non abilitato per questa funzione
    28CA doesn't existCA doesn't existLa CA inserita non esiste
    29The user didn't enter all required fields for the profileThe user didn't enter all required fields for the profileL'utente non ha inserito tutti i campi richiesti per il profilo
    30EJBCA errorEJBCA errorErrore di EJBCA
    31Authorization deniedAuthorization deniedAutorizzazione negata
    32Error due to waiting for data approvalError due to waiting for data approvalErrore dovuto all'attesa per l'approvazione dei dati
    33Error approving the entered dataError approving the entered dataErrore nell'approvazione dei dati inseriti
    34Illegal queryIllegal queryErrore per query illegale
    35Certificate already revokedCertificate already revokedCertificato gia' revocato in precedenza
    36I / O error, caused by writing / reading / converting a file / byte array / stringI / O errorErrore di I/O, causato dalla scrittura/lettura/conversione di un file/array di byte/stringa
    37Payment verification failedPayment verification failedVerifica di pagamento non andata a buon fine
    38No available signaturesNo available signaturesEseguite tutte le firme a disposizione
    42A denied feature is invoked in the current modeA denied feature is invoked in the current modeE' stata richiamata una funzionalita' non permessa nella modalita' corrente
    43A denied feature is invoked in the implementation usedA denied feature is invoked in the implementation usedE' stata richiamata una funzionalita' non permessa nell'implementazione usata
    44Wrong OTP code, try again with the next codeWrong OTP codeCodice OTP errato, riprovare con il prossimo codice
    45The key isn't associated to a certificateThe key isn't associated to a certificateLa chiave non ha associato un certificato
    46Unknown certificate formatUnknown certificate formatE' stato passato un certificato di formato sconosciuto
    47It isn't possible to open the slotIt isn't possible to open the slotNon e' stato possibile aprire lo slot
    49Key login errorKey login errorErrore di login sulla chiave
    50Error generating the CSRError generating the CSRErrore nella generazione del CSR
    51The maximum number of attempts to access the virtual device is reachedMaximum number of attempts reachedRaggiunto il numero massimo di tentativi di accesso al dispositivo virtuale
    52Error decryptingError decryptingErrore nella decifra
    53The certificate has expiredThe certificate has expiredIl certificato associato alla chiave e' scaduto
    54There are no tokens for automatic signature with Cosign HSMNo tokens availableNon sono disponibili token per la firma automatica con hsm Cosign
    55Error updating certificate in dbError updating certificate in dbErrore durante l'aggiornamento del certificato nel db
    56Wrong method useWrong method useErrato utilizzo del metodo
    57Method not implemented yetMethod not implemented yetMetodo non ancora implementato
    58Error assigning the OTPError assigning the OTPErrore durante l'assegnazione dell'OTP
    59Error assigning the static tokenError assigning the static tokenErrore durante l'assegnazione del token statico
    60Error deleting the accountError deleting the accountErrore durante la cancellazione dell'account
    61Error activating the accountError activating the accountErrore durante l'attivazione dell'account
    62Error loading the accountError loading the accountErrore durante il caricamento dell'account
    63Error unlocking the accountError unlocking the accountErrore durante lo sblocco dell'account
    64Unavailable hsm licensesUnavailable hsm licensesLicenze per hsm esaurite
    65PIN too shortPIN too shortPIN troppo corto
    66Session key incorrectSession key incorrectSession key errata
    67Session key not specifiedSession key not specifiedSession key non specificata
    68Session key undefinedSession key undefinedSession key non definita
    69Session key expiredSession key expiredSession key scaduta
    70Session key not usableSession key not usableSession key non utilizzabile
    71Error generating session keyError generating session keyErrore durante la generazione della session key
    72Error incrementing the session counterError incrementing session counterErrore durante l'incremento del session counter
    73Error sending OTP codeError sending OTP codeErrore durante l'invio del codice OTP
    74Error deleting session keyError deleting session keyErrore durante la cancellazione della session key
    76Error appositioning timestampError appositioning timestampErrore durante l'apposizione della marca temporale
    77Error closing sessionError closing sessionErrore durante la chiusura della sessione
    78The number of documents to be signed differs from the number of signature preferencesDocuments/signature mismatchIl numero di documenti da firmare differisce dal numero di preferenze di firma
    79Error detecting Security WorldError detecting Security WorldErrore durante il rilevamento del Security World
    80Error detecting the ModuleError detecting the ModuleErrore durante il rilevamento del Modulo
    81Error reading the SoftCardError reading the SoftCardErrore durante la lettura della SoftCard
    82Error writing the SoftCardError writing the SoftCardErrore durante la scrittura della SoftCard
    83Error deleting the SoftCardError deleting the SoftCardErrore durante la cancellazione della SoftCard
    84Error loading SoftCardError loading SoftCardErrore durante il caricamento della SoftCard
    85SoftCard not loadedSoftCard not loadedSoftCard non caricata
    86SoftCard already exists in the systemSoftCard already existsSoftCard gia' esistente a sistema
    87SoftCard does not existSoftCard does not existSoftCard inesistente
    88Error reading the keyError reading the keyErrore durante la lettura della chiave
    89Error writing the keyError writing the keyErrore durante la scrittura della chiave
    90Error deleting the keyError deleting the keyErrore durante la cancellazione della chiave
    91Error decrypting the RSA dataError decrypting RSA dataErrore durante la decifratura RSA
    92Error decrypting the CMS envelopeError decrypting CMS envelopeErrore durante la decifratura CMS
    93Error creating the SoftCardError creating the SoftCardErrore durante la creazione della SoftCard
    94The size of the hash does not coincide with the expected one by the algorithmHash size mismatchLa dimensione dell'hash non coincide con quella prevista dall'algoritmo
    95Error loading Cosign TokensError loading Cosign TokensErrore durante il caricamento dei Token Cosign
    96The system takes too much time, HSM overload. Try againHSM overloadIl sistema impiega troppo tempo, HSM sovraccarico. Riprovare
    97Timeout passedTimeout passedTimeout superato
    98No signature device associated to the userNo signature device associatedNessun dispositivo di firma remota risulta associato all'utente in questione
    1001The OTP device does not existOTP device does not existDispositivo OTP non esistente a sistema
    1007The OTP device was not activatedOTP device not activatedIl dispositivo OTP non risulta essere stato attivato
    1009Unavailable attempts for the OTP deviceOTP attempts exceededSuperato il numero massimo di tentativi per il dispositivo OTP
    1016The OTP device was not associated to the holderOTP device not associatedIl dispositivo OTP non risulta essere stato associato al titolare

    Method getErrors

    This method return a list of errors which can be generated from SWS in in

    NameTypeOptionalDescriptionIN/OUT
    langStringString country code in 2 digits. Accepted values: EN, IT.IN
    errorCodeIntegertrueSpecify the error code you want to receive in the error description. If not specified, all errors will be returned in the specified language.IN
    errorDetailsList<ErrorDetails>Return a list with the error(s) description.OUT

    The type "ErrorDetails" is a composed by:

    • int errorCode
    • String errorLanguage (language code in 2 digit for example EN)
    • String errorLanguage2 (language code in 3 digit for example ENG)
    • String errorText (contain the error description in a specified language)

    In this method, it is possible to return the list of all errors without setting the value of errorCode.

    Verify the signatures/timestamp in SWS

    SWS permits to verify the signature. For SWS the signature is VALID only if the signature has been apposed with qualified certificate.

    For example the the certificate which has apposed the signature is qualified if:

    • Root CA enroll the certificate is in the truested list
    • private key is in secure device like smartcard, token or HSM

    For example if the signature has been apposed with private key on file, the verify with SWS will fail because the private isn't in a secure device (like HSM).

    Method for verification of digital signatures: verifyWithPreferences

    This method allow to verify different types of signatures (detached or no): Pades, Xades, Cades:

    NameTypeMandatoryDescriptionIN/OUT
    signedContentbyte[]✔️file to be verifiedIN
    preferencesVerifyPreferencesContain the preferences to be used during the verify processIN
    SignedDocumentReportBeanComposite class which contain the report of a signatureOUT

    Below will be described the complex object "VerifiyPreferences"

    VerifyPreferences

    NameTypeMandatoryDefault valueDescriptionIncluded from SWS version
    checkByteRangeboolean
    detachedContentbyte[]Contain the original file if you are verifying a detached signature
    includeFeafalseIf set to true permits to verify the FEA (Firma Elettronica Avanzata) signature
    languageStringITContain the country code two digit and specify the language of verification report.
    mandatoryRevocationCheckbooleanfalse
    pdfEncryptionPasswordStringContains the password of PDF files (if you are verifying PDF files with password)
    recursivebooleanfalseCheck if there are signatures in the file which has been signed
    verifyOnDateDateDate of verification at specified date
    namirialbooleanfalsePermits to use custom tsl specified on properties. Used only for test purpose.
    withoutPlainDocumentbooleanfalsePermits to omit the plain document2.5.54
    qscdMandatorybooleantrueIf set to false, disable check key on secure devices (like smartcard, token and HSM)3.0.6

    In output will obtain the verification report described by complex object: SignedDocumentReportBean

    SignedDocumentReportBean

    NameTypeDescriptionIncluded from SWS version
    overallVerifiedbooleanVery IMPORTANT: outcome of verification, if true the signature is VALID
    checkDateDateDate of execute of verification
    verificationDateDateDate of verification. For example if the verification date is: "2021-09-03 15:30:00" specificy i want verify in that date.
    plainDocumentbyte[]Original file (present only in Cades signatures)
    noteReportListNoteReportBeanList of notes to support the signature evaluation
    signatureReportListSignatureReportBeanList of specific report on a single signature
    nrOfSignaturesintNumber of signature in the file are you verifiyng
    signatureFormatStringSpecify the type of signature. Can be: Pades, Cades or Xades
    timestampReportListTimestampReportBeanReports list in possible timestamps apposed to the signature

    Below will be described the complex object NoteReportBean, SignatureReportBean:

    NameTypeDescriptionIncluded from SWS version
    policyintNote validity area (0=ALL, 1=IT, 2=EU)
    aboutintObject of the note (0=other, 1=Signature, 2=holder, 3=issuer, 4=timestamp)
    typeintType of the note (1=INFO, 2=WARNING, 3=ERROR)
    synopsisStringBrief description of the note (for example: "Key on secure device")
    descriptionStringDetailed description of the note: "The private key associated with the test azienda certificate is stored in a secure device compliant with European Regulation 2014/910/EU"

    SignatureReportBean

    NameTypeDescriptionIncluded from SWS version
    integritybooleanIt defines the integrity of signature
    signatureAlgorithmNameStringAlghoritm used to sign
    serialNumberBigIntegerSerial of the signing certificate
    subjectDNStringSubject DN of the signing certificate
    subjectCNStringCommon Name (CN) in the subject DN associated to the signing certificate
    issuerDNStringSubject DN associated to the issuer of signing certificate
    issuerDNStringCommon name (CN) of subject DN associated to the issuer of signing certificate
    issuerCertificateStatusenumIssuer's certificate status. It can have the following values: VALID, REVOKE, UNKNOWN
    issuerInTrustedListbooleanIt defines if the issuer of the signing certificate is a trusted entity defined by the European TSL
    keySizeintsize of key associated to the signer certificate
    qcComplianceStatusenumIt defines if the signatures is in line with the Qualified Signature requirements. It can have the following values: VALID, INVALID, UNDETERMINATED, VALID_WITH_WARNINGS, INFORMATION
    qcSSCDStatusenumIf defines if the signature was created by a secure device (like smartcard, token, hsm) NOT file (p12, jks)
    signatureDateDateDate of signature
    trustedSignatureDatebooleanSet to true if the signature include timestamp (to guarantee the date of signature)
    derEncodedSignerCertbyte[]Signer certificate in X509 format
    signerCertifcateNotBeforeDateStart date of the validity of the signing certificate
    signerCertificateNotAfterDateEnd date of the validity of the signing certificate
    signerCertificateStatusenumStatus of certificate. The value can be: VALID, REVOKED, HOLD, UNKNOWN
    idintnumber of signature

    Method for verification of timestamps

    The timestamp can be of two different types:

    • TSR (TimeStamp Response) + original file in the same file is called TSD (TimeStamp Data)
    • TSR and original file in two different files

    There are two method for verify the TSD and TSR:

    • verifyTimeStampData
    • verifyTimeStampResponse

    Method verifyTimeStampResponse and verifyTimestampData

    NameTypeMandatoryDescriptionIN/OUT
    tsrbyte[]✔️tsr to verifyIN
    contentbyte[]✔️original fileIN
    TimestampReportBeanReport with detail of verificationOUT

    And the method "verifyTimestampData" permits to verify only TSD:

    NameTypeMandatoryDescriptionIN/OUT
    tsdbyte[]✔️TSD to verifyIN
    timestampReportsList<TimestampReportBean>Report with detail of verificationOUT

    While the method "verifyTimeStampWithPreferences" permits to verify TSR and TSD, below the details:

    NameTypeMandatoryDescriptionIN/OUTIncluded from SWS version
    timestampedContentbyte[]✔️TSR or TSD to verifyIN2.5.55
    preferencesVerifyTimestampPreferencesContains the verification preferences such as language and original files (if you are verifying a TSR file)IN"
    timestampReportTimestampReportBeanSummaryReport with detail of verificationOUT"

    Below will be described the complex object VerifyTimestampPreferences:

    VerifyTimestampPreferences

    NameTypeDefault valueMandatoryDescription
    detachedContentbyte[]Contain the original file where has been applied the timestamp, use this field only if you are verifying the TSR
    responseWithoutContentbooleanfalsePermits to remove the original files from the response (use this flag for reduce the bandwith usage)
    languageStringITSpecify the language report associated to verify

    TimestampReportBeanSummary

    Below will be described the complex object TimestampReportBeanSummary:

    NameTypeDescription
    timestampReportListList<TimestampReportBean>Detailed report of every timestamp in TSD file
    noteReportListList<NoteReportBean>Other details about timestamp
    overallVerifiedbooleanVery IMPORTANT: outcome of verification. If true, all timestamps are valid

    Below will be described the complex object TimestampReportBean:

    TimestampReportBean

    NameTypeDescriptionIncluded from SWS version
    indexIntegerReturn the number of timestamp verified
    dateDateWhen the timestamp has been apposed
    signatureVerificationStatusenumThe status of the integrity of the timestamp (indicates if the token's signature is intact), the value can be: VALID, INVALID
    trustedListVerificationStatusenumThe status of the root certificates associated, the value can be: VALID, INVALID, UNDETERMINATED
    timestampCertificateStatusenumThe status of certifcate which has apposed the timestamp, the value can be: VALID, INVALID, UNDETERMINATED
    issuerStringSubject DN associated to the issuer certificate
    subjectStringSubject DN associated to timestamp certificate
    issuerCNStringCN (Common Name) of Subject DN associated to the issuer certificate
    subjectCNStringCN (Common Name) of Subject DN associated to the timestamp certificate
    serialNumberBigIntegerSerial number associated to timestamp certificate
    signatureAlgorithmStringAlgorithm used for apply the timestamp
    hashAlgorithmStringAlgorithm used for the hash generation for document hash
    commentStringMessage explain the details of the error if present
    timestampCertDatabyte[]Certificate associated to timestamp
    contentbyte[]File oringinal which has been applied the timestamp
    contentFilenameStringReturn the filename if present else will return "originalFile.bin"
    contentMimeTypeStringReturn the content type associated to the file if present. Else will return "application/octect-stream"
    timeStampTokenbyte[]Contain the timestamp associated

    NOTE: the timestamp file is verified only if for every element of TimestampReportBean list all this conditions (in AND) are verified:

    • signatureVerificationStatus = VALID
    • trustedListVerificationStatus = VALID
    • timestampCertificateStatus = VALID

    Method for verifyCertificate

    Below the description of method "verifyCertificate":

    NameTypeMandatoryDescriptionIN/OUT
    certificatebyte[]✔️certificate to verifyIN
    CertificateReportBeanReport with detail of verificationOUT

    CertificateReportBean

    Below will be described the complex object CertificateReportBean:

    NameTypeDescriptionIncluded from SWS version
    trustedbooleanSet to TRUE mean the root certificate of the chain is in trusted list. The root of the chain is the self-signed certificate (where issuerDN = subjectDN)
    subjectValidbooleanTRUE: if the certificate isn't expired
    FALSE: the certificate is expired
    subjectRevokedbooleanTRUE: if the certificate is hold or revoked
    FALSE: the certificate is active
    subjectRevocationDateDatedate of revoke/hold
    issuerValidbooleanTRUE: if the issuer of the certificate isn't expired
    FALSE: the certificate is expired
    issuerRevokedbooleanTRUE: if the issuer certificate is hold or revoked
    FALSE: the issuer certificate is active
    issuerRevocationDateDatedate of revoke/hold

    LEGEND:

    Below the details about certificate:

    active → the certificate isn't revoked or hold

    valid → isn't expired

    Utilities for sign

    Below will described described the method for extract the info about the files, for example extract extract the info about the fieldName in a PDF

    getAvailableSignatureFieldNames

    This method allow to retrieve for a given PDF file all signature fields present that there are NOT already used.

    Below you can find a description of IN/OUT fields.

    NameTypeMandatoryDescriptionIN/OUT
    bufferbyte[]✔️The file to search for signature fieldsIN
    encryptionPasswordStringThe encryption password if the PDF file is encryptedIN
    signatureFieldNamesList<String>List of all signature field names availableOUT

    Example response

    An example response can be found below:

    [
     "SignatureField-1",
     "SignatureField-2"
    ]

    allSignatureFieldNamesWithPreferences

    This method allow to retrieve all signature field present inside a file. Using preferences the user is able to retrieve more details about the signature applied to a given signature field.

    Below you can find a description of IN/OUT fields.

    NameTypeMandatoryDescriptionIN/OUT
    bufferbyte[]✔️The file to search for signature fieldsIN
    preferencesSignatureFieldPreferencesPreferences to be applied to the search operationIN
    signatureFieldNamesList<SignatureFieldName>List of all signature field namesOUT

    SignatureFieldPreferences

    Here you can find a description of the complex object SignatureFieldPreferences

    SignatureFieldPreferences

    NameTypeDescriptionIncluded from SWS version
    withDetailsbooleanShow details about the signature field signed, for example the appearence (height, width, x, y),
    signer name, sign date, the reason, location and the page.
    DEFAULT=false
    2.5.56
    withCertificatebooleanRetrieve the signer certificate in base64 encoding and certificate subjectDN. DEFAULT=false2.5.56
    encryptionPasswordStringThe encryption password used to protect the PDF given in input if present2.5.56

    SignatureFieldName

    Here you can find a description of the complex object SignatureFieldName:

    NameTypeDescriptionIncluded from SWS version
    identifierStringSignature field name identifier2.5.56
    signedbooleanTRUE: the signature field is already signed
    FALSE: the signature field is not signed
    2.5.56
    signatureDetailsSignatureDetailsComplex object containing details about the signature applied to a given field if signed2.5.56

    SignatureDetails

    Here you can find a description of the complex object SignatureDetails

    NameTypeDescriptionIncluded from SWS version
    nameStringSigner name applied to a given signature field2.5.56
    signDateTimestampUnix timestamp representing the date of when the signature has been applied2.5.56
    locationStringThe location of where the signature has been applied2.5.56
    reasonStringReason applied to a given signature2.5.56
    pageIntegerPage where the signature field is present ( -1 if the page is not found )2.5.56
    appearancePdfRectangleComplex object containing info about the signature field box2.5.56
    certificateStringBase64-encoding of the signer certificate2.5.56
    subjectDNStringSubjectDN of the signer certificate2.5.56

    PdfRectangle

    Here you can find a description of the complex object PdfRectangle

    NameTypeDescriptionIncluded from SWS version
    witdthFloatWidth of the signature field2.5.56
    heightFloatHeigth of the signature field2.5.56
    xFloatLower left X-Axis position of the signature field2.5.56
    yFloatLower left Y-Axis position of the signature field2.5.56

    Example response

    Here you can find an example response:

    [
        {
            "identifier": "SignatureField-1",
            "signed": false
        },
        {
            "identifier": "SignatureField-2",
            "signatureDetails": {
                "name": "My Name and Surname",
                "signDate": 1687869549000,
                "location": "Milan",
                "reason": "Signed for general purpose",
                "page": -1,
                "appearance": {
                    "width": 40.50,
                    "height": 10.20,
                    "x": 1.0,
                    "y": 2.3
                },
                "certificate": "<base64-encoded certificate>",
                "subjectDN": "CN=My Name and Surname, SERIALNUMBER=1234567890, GIVENNAME=MyName, SURNAME=My Surname, C=IT"
            },
            "signed": true
        }
    ]

    getRemoteDeviceListFromPrivateAreaUser

    Available from version 3.0.1

    Example response:

    ℹ️ Only REMOTE (RHI...) devices are shown by this method

    [
      {
        "name": "RHI12345",
        "type": "REMOTE"
      }
      ...
    ]

    This method allow to obtain remote devices belong to a private area username (MyNamirial account) Below the details of this method:

    getRemoteDeviceListFromPrivateAreaUser

    NameTypeDescriptionIN/OUTIncluded from SWS version
    usernameStringUsername for which you want to obtain the list of device namesIN3.0.1
    devicesList<DeviceDTO>List of devices (with type) belonging to the specified usernameOUT"

    The "DeviceDTO" object is composed by:

    NameTypeDescription
    nameStringname of device name (therefore the value of "credentials.username")
    typeStringtype of device name (can be REMOTE, AUTOMATIC, SEAL)