0 Replies Latest reply on Jun 3, 2013 3:08 AM by amit kumar

    Resteasy encryption using jboss

    amit kumar Newbie

      i have made one web service now i want to encrypt that json data using  rest easy encryption at server side

       

      in this i generate the certificate by Java keytool command-line interface.

       

      @Path("/All")

                 @GET

                  @Produces("text/plain")

       

                  @GZIP

                  public EnvelopedOutput getAllOpenMeetings(@QueryParam("batchsize")

                  int batchSize, @QueryParam("offset")

                  int offset, @Context

                  HttpServletRequest req) {

       

       

                    String ipAddress = req.getRemoteAddr();

       

       

       

                    EnvelopedOutput output=null;

                    CustomerBean bean=null;

                    try {

                       bean=new CustomerBean();

                      bean.setDesc("abc");

                      bean.setName("xyz");

       

                      //certificate generation

                      FileInputStream stream = new FileInputStream("d:/my_keystore.pfx");

       

                                  KeyStore store = KeyStore.getInstance("pkcs12", "SunJSSE");

       

                                  store.load(stream, "my_password".toCharArray());

       

                                  Enumeration<String> aliases = store.aliases();

       

                                  while (aliases.hasMoreElements()) {

                                      System.err.println(aliases.nextElement());

                                  }

       

                                  X509Certificate certificate = (X509Certificate)store.getCertificate("my_certificate"); 

       

                                             

                       output = new EnvelopedOutput(bean, MediaType.APPLICATION_XML_TYPE);

       

                      output.setCertificate(certificate);

       

       

                    }  catch (Exception ex) {

       

                      String result = "Error 500 - Internal Server Error";

      System.out.println("exception=="+ex.getMessage());

      //                throw new WebApplicationException(Response.status(500).entity(result).build());

                    }

       

       

                    return output;

                  }

       

       

      but i am not getting output in encrypted form where is the problem please tell me ...

       

      please help me

      Thank you