@Override public DSSDocument signDocument(final byte[] signatureValue) throws DSSException {
  if (!built) {
    build();
  }
  final EncryptionAlgorithm encryptionAlgorithm=params.getEncryptionAlgorithm();
  final byte[] signatureValueBytes=DSSSignatureUtils.convertToXmlDSig(encryptionAlgorithm,signatureValue);
  final String signatureValueBase64Encoded=Base64.encodeBase64String(signatureValueBytes);
  final Text signatureValueNode=documentDom.createTextNode(signatureValueBase64Encoded);
  signatureValueDom.appendChild(signatureValueNode);
  byte[] documentBytes=DSSXMLUtils.transformDomToByteArray(documentDom);
  final InMemoryDocument inMemoryDocument=new InMemoryDocument(documentBytes);
  inMemoryDocument.setMimeType(MimeType.XML);
  return inMemoryDocument;
}

@ Override public DSSDocument signDocument ( final byte [ ] signatureValue ) throws DSSException { if ( ! built ) { build ( ) ; } final EncryptionAlgorithm encryptionAlgorithm = params . getEncryptionAlgorithm ( ) ; final byte [ ] signatureValueBytes = DSSSignatureUtils . convertToXmlDSig ( encryptionAlgorithm , signatureValue ) ; final String signatureValueBase64Encoded = Base64 . encodeBase64String ( signatureValueBytes ) ; final Text signatureValueNode = documentDom . createTextNode ( signatureValueBase64Encoded ) ; signatureValueDom . appendChild ( signatureValueNode ) ; byte [ ] documentBytes = DSSXMLUtils . transformDomToByteArray ( documentDom ) ; final InMemoryDocument inMemoryDocument = new InMemoryDocument ( documentBytes ) ; inMemoryDocument . setMimeType ( MimeType . XML ) ; return inMemoryDocument ; }
adds signature value to the signature and returns xml signature ( inmemorydocument )
