Klasse JAPSignature
- public class JAPSignature
signingInstance
private static JAPSignature signingInstance
- Stores the instance of JAPSignature, which we use for signing of our own messages (Singleton).
getSigningInstance
public static JAPSignature getSigningInstance()
- Returns the instance of the JAPSignature, which we use for signing of own messages (Singleton). If there is no instance, there is a new one created (for the first use, it must be initialized with initSignAlgorithm()).
- Returns:
- The signing instance of JAPSignature.
initSign
public void initSign(PrivateKey ownPrivateKey)
- Initializes a JAPSignature instance for signing messages. This method needs only to be called once (before the first use of the signing methods). If you have called initVerify() before calling this method, the JAPSignature instance is switched from verifying to signing. Verifying will not work until you call initVerify() on this instance.
- Parameters:
ownPrivateKey
- The private key of a asymmetric algorithm (DSA at the moment) for signing the messages.
signXmlDoc
public void signXmlDoc(Document toSign)
- Signs an XML document with the own private key. The signature is directly inserted as a child of the root node of the document, so there is nothing returned. If there is already a signature in the document, it is removed.
- Parameters:
toSign
- The document you want to sign.
signXmlNode
public void signXmlNode(Element toSign)
- Signs an XML node with the own private key. The signature is directly inserted as a child of the node, so there is nothing returned. If there is already a signature in the tree under the node, it is removed.
- Parameters:
toSign
- The document you want to sign.
nodeToCanonical
private ByteArrayOutputStream nodeToCanonical(Node inputNode)
- Creates a bytestream out of the abstract tree of the node.
- Parameters:
inputNode
- The node (incl. the whole tree) which is flattened to a bytestream.
- Returns:
- The bytestream of the node (incl. the whole tree).