jetbrains.buildServer.controllers
Class PublicKeyUtil

java.lang.Object
  extended by jetbrains.buildServer.controllers.PublicKeyUtil

public class PublicKeyUtil
extends java.lang.Object

Utility class containing various methods used by controllers when working with server RSA public key.


Field Summary
static java.lang.String PUBLIC_KEY_EXPIRED_ERR
           
static java.lang.String PUBLIC_KEY_PARAM
           
 
Method Summary
static java.lang.String generatePublicKey()
          Generates public key that should be set as PUBLIC_KEY_PARAM argument to request
static boolean isPublicKeyExpired(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.
static void writePublicKeyExpiredError(org.jdom.Element xmlResponse)
          Writes error with id PUBLIC_KEY_EXPIRED_ERR to the specified XML response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PUBLIC_KEY_PARAM

public static final java.lang.String PUBLIC_KEY_PARAM
See Also:
Constant Field Values

PUBLIC_KEY_EXPIRED_ERR

public static final java.lang.String PUBLIC_KEY_EXPIRED_ERR
See Also:
Constant Field Values
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 java.lang.String generatePublicKey()
Generates public key that should be set as PUBLIC_KEY_PARAM argument to request

Returns:
public key