Class OwlServer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionConvenience constructor for a newOwlServerthat uses theOwlCurves.NIST_P256elliptic curve, a SHA-256 digest, and a defaultSecureRandomimplementation.Convenience constructor for a newOwlServerthat uses a SHA-256 digest and a defaultSecureRandomimplementation.OwlServer(String serverId, OwlCurve curve, Digest digest, SecureRandom random) Construct a newOwlServer. -
Method Summary
Modifier and TypeMethodDescriptionvoidauthenticationServerEnd(OwlAuthenticationFinish authenticationFinish) Validates the payload received from the client during the third pass of the Owl protocol.authenticationServerResponse(OwlAuthenticationInitiate authenticationInitiate, OwlFinishRegistration userLoginCredentials) Validates the payload sent byOwlClient.authenticationInitiate()byOwlClient, and then creates a newOwlAuthenticationServerResponsepayload and sends it to theOwlClient.Calculates and returns the key material.intgetState()Gets the current state of this server.initiateKeyConfirmation(BigInteger keyingMaterial) Creates and returns the payload to send to the client as part of Key Confirmation.voidvalidateKeyConfirmation(OwlKeyConfirmation keyConfirmationPayload, BigInteger keyingMaterial) Validates the payload received from the client as part of Key Confirmation.
-
Field Details
-
STATE_INITIALISED
public static final int STATE_INITIALISED- See Also:
-
STATE_LOGIN_INITIALISED
public static final int STATE_LOGIN_INITIALISED- See Also:
-
STATE_LOGIN_FINISHED
public static final int STATE_LOGIN_FINISHED- See Also:
-
STATE_KEY_CALCULATED
public static final int STATE_KEY_CALCULATED- See Also:
-
STATE_KC_INITIALISED
public static final int STATE_KC_INITIALISED- See Also:
-
STATE_KC_VALIDATED
public static final int STATE_KC_VALIDATED- See Also:
-
-
Constructor Details
-
OwlServer
Convenience constructor for a newOwlServerthat uses theOwlCurves.NIST_P256elliptic curve, a SHA-256 digest, and a defaultSecureRandomimplementation.After construction, the
statewill beSTATE_INITIALISED.- Parameters:
serverId- unique identifier of this server. The server and client in the exchange must NOT share the same id.- Throws:
NullPointerException- if any argument is null
-
OwlServer
Convenience constructor for a newOwlServerthat uses a SHA-256 digest and a defaultSecureRandomimplementation.After construction, the
statewill beSTATE_INITIALISED.- Parameters:
serverId- unique identifier of this server. The server and client in the exchange must NOT share the same id.curve- elliptic curve SeeOwlCurvesfor standard curves.- Throws:
NullPointerException- if any argument is null
-
OwlServer
Construct a newOwlServer.After construction, the
statewill beSTATE_INITIALISED.- Parameters:
serverId- unique identifier of this server. The client and server in the exchange must NOT share the same id.curve- elliptic curve SeeOwlCurvesfor standard curvesdigest- digest to use during zero knowledge proofs and key confirmation (SHA-256 or stronger preferred)random- source of secure random data for x3 and x4, and for the zero knowledge proofs- Throws:
NullPointerException- if any argument is null
-
-
Method Details
-
getState
public int getState()Gets the current state of this server. See theSTATE_*constants for possible values.- Returns:
- The state of the server
-
authenticationServerResponse
public OwlAuthenticationServerResponse authenticationServerResponse(OwlAuthenticationInitiate authenticationInitiate, OwlFinishRegistration userLoginCredentials) throws CryptoException Validates the payload sent byOwlClient.authenticationInitiate()byOwlClient, and then creates a newOwlAuthenticationServerResponsepayload and sends it to theOwlClient.Must be called prior to
authenticationServerEnd(OwlAuthenticationFinish).After execution, the
statewill beSTATE_LOGIN_INITIALISED.- Parameters:
authenticationInitiate- payload sent byOwlClient.authenticationInitiate()to be validated and used for further calculation.userLoginCredentials- comes from the server where it stored the user login credentials as part of the user login registration.- Returns:
OwlAuthenticationServerResponse- Throws:
CryptoException- if validation fails.IllegalStateException- if called multiple times.
-
authenticationServerEnd
public void authenticationServerEnd(OwlAuthenticationFinish authenticationFinish) throws CryptoException Validates the payload received from the client during the third pass of the Owl protocol. Must be called prior tocalculateKeyingMaterial().After execution, the
statewill beSTATE_LOGIN_FINISHED.- Parameters:
authenticationFinish- payload sent byOwlClient.authenticationFinish(OwlAuthenticationServerResponse)to be validated.- Throws:
CryptoException- if validation fails.IllegalStateException- if called prior toauthenticationServerResponse(OwlAuthenticationInitiate, OwlFinishRegistration), or multiple times
-
calculateKeyingMaterial
Calculates and returns the key material. A session key must be derived from this key material using a secure key derivation function (KDF). The KDF used to derive the key is handled externally (i.e. not byOwlServer).The keying material will be identical for client and server if and only if the login password is the same as the password stored by the server. i.e. If the client and server do not share the same password, then each will derive a different key. Rememeber, the server does not explicitly hold the password, but a secret value derived from the password sent to the server by the client during user registration. Therefore, if you immediately start using a key derived from the keying material, then you must handle detection of incorrect keys. Validation of the r value also detects if passwords are different between user registration and user login. If you want to check the equality of the key materials derived at the two sides explicitly, you can perform explicit key confirmation. See
OwlServerfor details on how to execute key confirmation.authenticationServerEnd(OwlAuthenticationFinish)must be called prior to this method.After execution, the
statewill beSTATE_KEY_CALCULATED.- Returns:
- The raw key material produced by the Owl key exchange process
- Throws:
IllegalStateException- if called prior toauthenticationServerEnd(OwlAuthenticationFinish), or if called multiple times.
-
initiateKeyConfirmation
Creates and returns the payload to send to the client as part of Key Confirmation.See
OwlClientfor more details on Key Confirmation.After execution, the
statewill beSTATE_KC_INITIALISED.- Parameters:
keyingMaterial- The keying material as returned fromcalculateKeyingMaterial().- Returns:
OwlKeyConfirmation- Throws:
IllegalStateException- if called prior tocalculateKeyingMaterial(), or multiple times
-
validateKeyConfirmation
public void validateKeyConfirmation(OwlKeyConfirmation keyConfirmationPayload, BigInteger keyingMaterial) throws CryptoException Validates the payload received from the client as part of Key Confirmation.See
OwlClientfor more details on Key Confirmation.After execution, the
statewill beSTATE_KC_VALIDATED.- Parameters:
keyConfirmationPayload- The key confirmation payload received from the client..keyingMaterial- The keying material as returned fromcalculateKeyingMaterial().- Throws:
CryptoException- if validation fails.IllegalStateException- if called prior tocalculateKeyingMaterial(), or multiple times
-