Interface EncryptionUtils

  • All Known Implementing Classes:
    DefaultEncryptionUtils

    public interface EncryptionUtils
    Various encryption utility methods.
    Since:
    4.0
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean authenticate​(javax.servlet.http.HttpServletRequest req, byte[] decryptedBody)
      Authenticate the http request: validate the MAC, check that the remote IP is as expected and that the timestamp is recent.
      boolean authenticateResponse​(org.apache.commons.httpclient.HttpMethod method, String remoteIP, byte[] decryptedBody)
      Authenticate the http method response: validate the MAC, check that the remote IP is as expected and that the timestamp is recent.
      byte[] decryptBody​(javax.servlet.http.HttpServletRequest req)
      Decrypt the body of the http request
      byte[] decryptResponseBody​(org.apache.commons.httpclient.HttpMethod method)
      Decrypt the response body of the http method
      void setRequestAlgorithmParameters​(org.apache.commons.httpclient.HttpMethod method, AlgorithmParameters params)
      Set the algorithm parameters header on the method request
      void setRequestAuthentication​(org.apache.commons.httpclient.HttpMethod method, byte[] message)
      Encrypt the http method request body
      void setResponseAuthentication​(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, byte[] responseBody, AlgorithmParameters params)
      Sets authentication headers on the HTTP response.
    • Method Detail

      • decryptResponseBody

        byte[] decryptResponseBody​(org.apache.commons.httpclient.HttpMethod method)
                            throws IOException
        Decrypt the response body of the http method
        Parameters:
        method -
        Returns:
        decrypted response body
        Throws:
        IOException
      • decryptBody

        byte[] decryptBody​(javax.servlet.http.HttpServletRequest req)
                    throws IOException
        Decrypt the body of the http request
        Parameters:
        req -
        Returns:
        decrypted response body
        Throws:
        IOException
      • authenticateResponse

        boolean authenticateResponse​(org.apache.commons.httpclient.HttpMethod method,
                                     String remoteIP,
                                     byte[] decryptedBody)
        Authenticate the http method response: validate the MAC, check that the remote IP is as expected and that the timestamp is recent.
        Parameters:
        method -
        remoteIP -
        decryptedBody -
        Returns:
        true if the method reponse is authentic, false otherwise
      • authenticate

        boolean authenticate​(javax.servlet.http.HttpServletRequest req,
                             byte[] decryptedBody)
        Authenticate the http request: validate the MAC, check that the remote IP is as expected and that the timestamp is recent.
        Parameters:
        req -
        decryptedBody -
        Returns:
        true if the method request is authentic, false otherwise
      • setRequestAuthentication

        void setRequestAuthentication​(org.apache.commons.httpclient.HttpMethod method,
                                      byte[] message)
                               throws IOException
        Encrypt the http method request body
        Parameters:
        method -
        message -
        Throws:
        IOException
      • setResponseAuthentication

        void setResponseAuthentication​(javax.servlet.http.HttpServletRequest httpRequest,
                                       javax.servlet.http.HttpServletResponse httpResponse,
                                       byte[] responseBody,
                                       AlgorithmParameters params)
                                throws IOException
        Sets authentication headers on the HTTP response.
        Parameters:
        httpRequest -
        httpResponse -
        responseBody -
        params -
        Throws:
        IOException
      • setRequestAlgorithmParameters

        void setRequestAlgorithmParameters​(org.apache.commons.httpclient.HttpMethod method,
                                           AlgorithmParameters params)
                                    throws IOException
        Set the algorithm parameters header on the method request
        Parameters:
        method -
        params -
        Throws:
        IOException