Java API
HSM Dinamo
Loading...
Looking for...
No entries found
XML

Detailed description

XML Signature, including Electronic Invoice (NF-e)

Consult the HSM technical documentation

Functions

byte[] signXML (byte bHashMode, int nFlags, String strKeyId, String strCertId, byte[] baUnsignedXml, byte[] baFilter) throws TacException
 Digitally signs an XML document using the W3C XML digital signature standards.
 
byte[] signXML (String strPrivKeyName, int nHashAlg, String strCertId, byte[] baUnsignedXml, byte[] baFilter) throws TacException
 Digitally signs an XML document using the W3C XML digital signature standards.
 
byte[] signXML (byte[] hKey, byte[] hHash, String strCertId, int nUnsignedXml, byte[] baUnsignedXml, int[] naSignedXmlSize, int nFilterSize, byte[] baFilter) throws TacException
 Digitally signs an XML document using the W3C XML digital signature standards.
 

Functions

signXML() [1/3]

byte[] signXML ( byte bHashMode,
int nFlags,
String strKeyId,
String strCertId,
byte[] baUnsignedXml,
byte[] baFilter ) throws TacException

Digitally signs an XML document using the W3C XML digital signature standards.

Parameters
bHashModeType of hash used in the signature. The values in the table below are accepted.
Value Meaning
TacNDJavaLib.ALG_MD5_InclC14N MD5 with InclC14N canonicalization
TacNDJavaLib.ALG_SHA1_InclC14N SHA1 with InclC14N canonicalization
TacNDJavaLib.ALG_SHA256_InclC14N SHA256 with InclC14N canonicalization
TacNDJavaLib.ALG_SHA384_InclC14N SHA384 with InclC14N canonicalization
TacNDJavaLib.ALG_SHA512_InclC14N SHA512 with InclC14N canonicalization
TacNDJavaLib.ALG_SHA224_InclC14N SHA224 with InclC14N canonicalization
TacNDJavaLib.ALG_MD5_ExclC14N MD5 with ExclC14N canonicalization
TacNDJavaLib.ALG_SHA1_ExclC14N SHA1 with ExclC14N canonicalization
TacNDJavaLib.ALG_MD5_InclC14NWithComments MD5 with InclC14NWithComments canonicalization
TacNDJavaLib.ALG_SHA1_InclC14NWithComments SHA1 with canonicalization InclC14NWithComments
TacNDJavaLib.ALG_MD5_ExclC14NWithComments MD5 with ExclC14NWithComments canonicalization
TacNDJavaLib.ALG_SHA1_ExclC14NWithComments SHA1 with canonicalization ExclC14NWithComments
TacNDJavaLib.ALG_SHA256_ExclC14N SHA256 with ExclC14N canonicalization
TacNDJavaLib.ALG_SHA256_InclC14NWithComments SHA256 with canonicalization InclC14NWithComment
TacNDJavaLib.ALG_SHA256_ExclC14NWithComments SHA256 with ExclC14NWithComment canonicalization
TacNDJavaLib.ALG_SHA384_ExclC14N SHA384 with ExclC14N canonicalization
TacNDJavaLib.ALG_SHA384_InclC14NWithComments SHA384 with canonicalization InclC14NWithComment
TacNDJavaLib.ALG_SHA384_ExclC14NWithComments SHA384 with ExclC14NWithComment canonicalization
TacNDJavaLib.ALG_SHA512_ExclC14N SHA512 with ExclC14N canonicalization
TacNDJavaLib.ALG_SHA512_InclC14NWithComments SHA512 with canonicalization InclC14NWithComment
TacNDJavaLib.ALG_SHA512_ExclC14NWithComments SHA512 with ExclC14NWithComment canonicalization
TacNDJavaLib.ALG_SHA224_ExclC14N SHA224 with ExclC14N canonicalization
TacNDJavaLib.ALG_SHA224_InclC14NWithComments SHA224 with canonicalization InclC14NWithComment
TacNDJavaLib.ALG_SHA224_ExclC14NWithComments SHA224 with ExclC14NWithComment canonicalization.
nFlagsFlags containing the subscription options. The table below is accepted.
Value Meaning
TacNDJavaLib.XML_SIGN_FLAGS_NOL Disables the generation of single-line XML. This option generates the output XML in multiple lines.
strKeyIdName of the private key in the HSM.
strCertIdName of the certificate in HSM.
baUnsignedXmlXML to be signed.
baFilterFilter for digitally signing parts of the XML document. Use of the filter is optional. See Using XML filters.
Return
Array of original XML bytes digitally signed in the specified format.
Exceptions
TacExceptionThrows exception in case of signature errors

signXML() [2/3]

byte[] signXML ( String strPrivKeyName,
int nHashAlg,
String strCertId,
byte[] baUnsignedXml,
byte[] baFilter ) throws TacException

Digitally signs an XML document using the W3C XML digital signature standards.

It receives the parameters in byte array format.

Parameters
strPrivKeyNameIdentifier internal to the HSM referring to the key to be used for signing the XML document.
nHashAlgHash algorithm used. The table below is accepted.
Value Meaning
TacNDJavaLib.ALG_MD5 Uses TacNDJavaLib.ALG_MD5_InclC14N.
TacNDJavaLib.ALG_SHA1 Uses TacNDJavaLib.ALG_SHA1_InclC14N.
TacNDJavaLib.ALG_SHA256 Uses TacNDJavaLib.ALG_SHA256_InclC14N.
strCertIdIdentifier internal to the HSM referring to the digital certificate to be used for signing the XML document.
baUnsignedXmlParameter containing the XML to be signed.
baFilterFilter for digitally signing parts of the XML document. Use of the filter is optional. See Using XML filters.
Return
Array of bytes containing the original digitally signed XML document in the specified format.
Exceptions
TacExceptionThrows exception in case of signature errors

signXML() [3/3]

byte[] signXML ( byte[] hKey,
byte[] hHash,
String strCertId,
int nUnsignedXml,
byte[] baUnsignedXml,
int[] naSignedXmlSize,
int nFilterSize,
byte[] baFilter ) throws TacException

Digitally signs an XML document using the W3C XML digital signature standards.

Receives parameters in string format.

Parameters
hKeyIdentifier internal to the HSM referring to the key to be used for signing the XML document.
hHashHash algorithm used.
strCertIdIdentifier internal to the HSM referring to the digital certificate to be used for signing the XML document.
nUnsignedXmlParameter containing the XML to be signed.
baUnsignedXml
naSignedXmlSize
nFilterSize
baFilter
Return
Exceptions
TacExceptionThrows exception in case of signature errors