Class PublicKeyUtil


  • public class PublicKeyUtil
    extends Object
    Utility class containing various methods used by controllers when working with server RSA public key.
    • Method Detail

      • isPublicKeyExpired

        public static boolean isPublicKeyExpired​(@NotNull
                                                 javax.servlet.http.HttpServletRequest request)
        Compares public key from the request (parameter with name 'publicKey') and current public key used by the server and returns true if they are differ. This means that public key used by web page has expired (for example this can happen if server restarted).
        Parameters:
        request - request
        Returns:
        true if public key specified in the request has expired
      • writePublicKeyExpiredError

        public static void writePublicKeyExpiredError​(@NotNull
                                                      org.jdom.Element xmlResponse)
        Writes error with id PUBLIC_KEY_EXPIRED_ERR to the specified XML response. The content of this error will be public key currently used by the server.
        Parameters:
        xmlResponse - XML response
      • generatePublicKey

        public static String generatePublicKey()
        Generates public key that should be set as PUBLIC_KEY_PARAM argument to request
        Returns:
        public key