Package org.jboss.resteasy.security.smime

Examples of org.jboss.resteasy.security.smime.PKCS7SignatureInput


      Project project = projects.getList().get(0);
      admin.projects().addUserRole(project.getId(), user.getId(), role.getId());

      String signed = new SkeletonKeyClientBuilder().username("jsmith").password("foobar").idp(target).obtainSignedToken("Skeleton Key");
      System.out.println(signed);
      PKCS7SignatureInput input = new PKCS7SignatureInput(signed);
      input.setCertificate(certificate);
      Assert.assertTrue(input.verify());
      client.close();
   }
View Full Code Here


   @Context
   Providers providers;

   protected Access signed(String header)
   {
      PKCS7SignatureInput input = null;
      boolean verify = false;
      try
      {
         input = new PKCS7SignatureInput(header);
         input.setProviders(providers);
         verify = input.verify(certificate);
      }
      catch (Exception e)
      {
         throw new WebApplicationException(403);
      }
      if (!verify) throw new WebApplicationException(403);
      try
      {
         return (Access)input.getEntity(Access.class, MediaType.APPLICATION_JSON_TYPE);
      }
      catch (Exception e)
      {
         logger.error("Failed to unmarshall", e);
         throw new WebApplicationException(403);
View Full Code Here

   @Test
   public void testPKCS7SignedOutput() throws Exception
   {
      ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/smime/pkcs7-signature"));
      PKCS7SignatureInput signed = request.getTarget(PKCS7SignatureInput.class);
      String output = (String) signed.getEntity(String.class, MediaType.TEXT_PLAIN_TYPE);
      System.out.println(output);
      Assert.assertEquals("hello world", output);
   }
View Full Code Here

   public void testPKCS7SignedTextOutput() throws Exception
   {
      ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/smime/pkcs7-signature/text"));
      String base64 = request.getTarget(String.class);
      System.out.println(base64);
      PKCS7SignatureInput signed = new PKCS7SignatureInput(base64);
      signed.setProviders(request.getProviderFactory());

      String output = (String) signed.getEntity(String.class, MediaType.TEXT_PLAIN_TYPE);
      System.out.println(output);
      Assert.assertEquals("hello world", output);
      Assert.assertTrue(signed.verify(cert));
   }
View Full Code Here

      {
         throw new LoginException("Could not get certificate from keyStore");
      }
      try
      {
         PKCS7SignatureInput input = new PKCS7SignatureInput(tokenHeader);
         if (input.verify(certificate) == false) throw new LoginException("Bad Signature");
         access = (Access)input.getEntity(Access.class, MediaType.APPLICATION_JSON_TYPE);

      }
      catch (LoginException le)
      {
         throw le;
View Full Code Here

      Client client = ClientBuilder.newClient();
      WebTarget target = client.target("http://localhost:8080/modules-test/jaxrs");


      target = target.path("test/signed/pkcs7-signature");
      PKCS7SignatureInput signed = target.request().get(PKCS7SignatureInput.class);
      String output = (String) signed.getEntity(String.class, MediaType.TEXT_PLAIN_TYPE);
      System.out.println(output);
      Assert.assertEquals("hello world", output);
   }
View Full Code Here

TOP

Related Classes of org.jboss.resteasy.security.smime.PKCS7SignatureInput

Copyright © 2018 www.massapicom. 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.