Package org.apache.abdera.security

Examples of org.apache.abdera.security.Signature.verify()


        Document<Element> doc = resp.getDocument();
        Element root = doc.getRoot();
        AbderaSecurity security = new AbderaSecurity(abdera);
        Signature sig = security.getSignature();
        assertTrue(sig.isSigned(root));
        assertTrue(sig.verify(root, sig.getDefaultSignatureOptions()));
    }

    private static final String keystoreFile = "/key.jks";
    private static final String keystoreType = "JKS";
    private static final String keystorePass = "testing";
View Full Code Here


        entry.writeTo(out); // do not use the pretty writer, it will break the signature
        ByteArrayInputStream bais = new ByteArrayInputStream(out.toByteArray());
        Document<Entry> entry_doc = abdera.getParser().parse(bais);
        entry = entry_doc.getRoot();

        System.out.println("Valid? " + sig.verify(entry, null));

        entry.setTitle("Change the title");

        System.out.println("Valid after changing the title? " + sig.verify(entry, null));
View Full Code Here

        System.out.println("Valid? " + sig.verify(entry, null));

        entry.setTitle("Change the title");

        System.out.println("Valid after changing the title? " + sig.verify(entry, null));

        entry = sig.removeInvalidSignatures(entry, options);

    }
View Full Code Here

        Signature sig = security.getSignature();
        String method = request.getMethod();
        if (method.equals("POST") || method.equals("PUT")) {
            try {
                Document<Element> doc = request.getDocument();
                boolean valid = sig.verify(doc.getRoot(), null);
                if (!valid)
                    return ProviderHelper.badrequest(request, Localizer.get("VALID.SIGNATURE.REQUIRED"));
                request.setAttribute(VALID, valid);
                request.setAttribute(CERTS, sig.getValidSignatureCertificates(doc.getRoot(), null));
            } catch (Exception e) {
View Full Code Here

            }
            if (existingEntryXml != null) {
                log.trace("Skipping validation for existing entry: "
                        + entry.getId());
            } else {
                if (!signature.verify(entry, options)) {
                    // failed validation
                    Element activity = entry.getExtension(new QName(
                            "http://activitystrea.ms/spec/1.0/", "verb",
                            "activity"));
                    // if not a 'deleted' entry
View Full Code Here

                .getExtensions("http://a9.com/-/spec/opensearch/1.1/")) {
            e.discard();
        }

        // now validate feed signature sans entries
        if (!signature.verify(feed, options)) {
            log.warn("Could not verify signature for feed with id: "
                    + feed.getId());
            throw new XMLSignatureException(
                    "Could not verify signature for feed with id: "
                            + feed.getId());
View Full Code Here

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    entry.writeTo(out); // do not use the pretty writer, it will break the signature
    ByteArrayInputStream bais = new ByteArrayInputStream(out.toByteArray());
    Document<Entry> entry_doc = abdera.getParser().parse(bais);
    entry = entry_doc.getRoot();
    assertTrue(sig.verify(entry, null))// the signature better still be valid
   
    entry.setTitle("Change the title");
   
    assertFalse(sig.verify(entry, null)); // the signature better be invalid
   
View Full Code Here

    entry = entry_doc.getRoot();
    assertTrue(sig.verify(entry, null))// the signature better still be valid
   
    entry.setTitle("Change the title");
   
    assertFalse(sig.verify(entry, null)); // the signature better be invalid
   
  }
 
}
View Full Code Here

    Document<Element> doc = resp.getDocument();
    Element root = doc.getRoot();
    AbderaSecurity security = new AbderaSecurity(abdera);
    Signature sig = security.getSignature();
    assertTrue(sig.isSigned(root));
    assertTrue(sig.verify(root, sig.getDefaultSignatureOptions()));
  }
 
  private static final String keystoreFile = "/key.jks";
  private static final String keystoreType = "JKS";
  private static final String keystorePass = "testing";
View Full Code Here

      try {
        Abdera abdera = new Abdera();
        AbderaSecurity absec = new AbderaSecurity(abdera);
        Signature sig = absec.getSignature();
        Document<Element> doc = abdera.getParser().parse(wrapper.getInputStream());
        boolean valid = sig.verify(doc.getRoot(), null);
        if (!valid) {
          ((HttpServletResponse)response).sendError(
            400, Messages.get("VALID.SIGNATURE.REQUIRED"));
          return;
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.