Package org.apache.abdera.security

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


    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

      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, "A Valid Signature is required");
          return;
        }
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

    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));
   
  }
 
}
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);
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

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.