/**
   * Test that signs (twice) and verifies a WS-Security envelope. The test uses the ThumbprintSHA1
   * key identifier type.
   *
   * <p>
   *
   * @throws java.lang.Exception Thrown when there is any problem in signing or verification
   */
  public void testDoubleX509SignatureThumb() throws Exception {
    WSSecSignature builder = new WSSecSignature();
    builder.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
    // builder.setUserInfo("john", "keypass");
    builder.setKeyIdentifierType(WSConstants.THUMBPRINT_IDENTIFIER);
    Document doc = unsignedEnvelope.getAsDocument();

    WSSecHeader secHeader = new WSSecHeader();
    secHeader.insertSecurityHeader(doc);

    Document signedDoc = builder.build(doc, crypto, secHeader);
    Document signedDoc1 = builder.build(signedDoc, crypto, secHeader);
    verify(signedDoc1);
  }
  /**
   * Test that signs and verifies a WS-Security envelope. The test uses the ThumbprintSHA1 key
   * identifier type.
   *
   * <p>
   *
   * @throws java.lang.Exception Thrown when there is any problem in signing or verification
   */
  public void testX509SignatureThumb() throws Exception {
    WSSecSignature builder = new WSSecSignature();
    builder.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
    builder.setKeyIdentifierType(WSConstants.THUMBPRINT_IDENTIFIER);
    // builder.setUserInfo("john", "keypass");
    LOG.info("Before Signing ThumbprintSHA1....");
    Document doc = unsignedEnvelope.getAsDocument();

    WSSecHeader secHeader = new WSSecHeader();
    secHeader.insertSecurityHeader(doc);

    Document signedDoc = builder.build(doc, crypto, secHeader);

    if (LOG.isDebugEnabled()) {
      LOG.debug("Signed message with ThumbprintSHA1 key identifier:");
      String outputString = org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(signedDoc);
      LOG.debug(outputString);
    }
    LOG.info("After Signing ThumbprintSHA1....");
    verify(signedDoc);
  }