OwlServerRegistration (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

org.bouncycastle.crypto.agreement.owl

## Class OwlServerRegistration

- java.lang.Object
- - org.bouncycastle.crypto.agreement.owl.OwlServerRegistration

-     public class OwlServerRegistration
      extends java.lang.Object

  A server in the Owl key exchange protocol specifically for the user registration phase.

  See `OwlClientRegistration` for more details on the user registration in Owl.

  This class is stateful and NOT threadsafe. Each instance should only be used for ONE complete Owl registration phase (i.e. a new `OwlServerRegistration` and `OwlClientRegistration` should be constructed for each new Owl exchange).

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `REGISTRATION_CALLED`
    `static boolean` | `REGISTRATION_NOT_CALLED`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OwlServerRegistration(java.lang.String serverId)` Convenience constructor for a new `OwlServerRegistration` that uses the `OwlCurves.NIST_P256` elliptic curve, a SHA-256 digest, and a default `SecureRandom` implementation.
    `OwlServerRegistration(java.lang.String serverId, OwlCurve curve)` Convenience constructor for a new `OwlServerRegistration` that uses a SHA-256 digest and a default `SecureRandom` implementation.
    `OwlServerRegistration(java.lang.String serverId, OwlCurve curve, Digest digest, java.security.SecureRandom random)` Construct a new `OwlServerRegistration`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `getRegistrationState()` Check's the status of the user registration I.E. whether or not this server has registered a user already.
    `OwlFinishRegistration` | `registerUseronServer(OwlInitialRegistration userLoginRegistrationReceived)` Receives the payload sent by the client as part of user registration, and stores necessary values in the server.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### REGISTRATION_NOT_CALLED

          public static final boolean REGISTRATION_NOT_CALLED

      See Also:
        Constant Field Values

    - #### REGISTRATION_CALLED

          public static final boolean REGISTRATION_CALLED

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### OwlServerRegistration

          public OwlServerRegistration(java.lang.String serverId)

      Convenience constructor for a new `OwlServerRegistration` that uses the `OwlCurves.NIST_P256` elliptic curve, a SHA-256 digest, and a default `SecureRandom` implementation.

      After construction, the `registrationState` will be `REGISTRATION_NOT_CALLED`.

      Parameters:
        `serverId` - unique identifier of this server. The server and client in the exchange must NOT share the same id.
      Throws:
        `java.lang.NullPointerException` - if any argument is null

    - #### OwlServerRegistration

          public OwlServerRegistration(java.lang.String serverId,
                                       OwlCurve curve)

      Convenience constructor for a new `OwlServerRegistration` that uses a SHA-256 digest and a default `SecureRandom` implementation.

      After construction, the `registrationState` will be `REGISTRATION_NOT_CALLED`.

      Parameters:
        `serverId` - unique identifier of this server. The server and client in the exchange must NOT share the same id.
        `curve` - elliptic curve See `OwlCurves` for standard curves.
      Throws:
        `java.lang.NullPointerException` - if any argument is null

    - #### OwlServerRegistration

          public OwlServerRegistration(java.lang.String serverId,
                                       OwlCurve curve,
                                       Digest digest,
                                       java.security.SecureRandom random)

      Construct a new `OwlServerRegistration`.

      After construction, the `registrationState` will be `REGISTRATION_NOT_CALLED`.

      Parameters:
        `serverId` - unique identifier of this server. The client and server in the exchange must NOT share the same id.
        `curve` - elliptic curve; see `OwlCurves` for standard curves
        `digest` - 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:
        `java.lang.NullPointerException` - if any argument is null

  - ### Method Detail

    - #### getRegistrationState

          public boolean getRegistrationState()

      Check's the status of the user registration I.E. whether or not this server has registered a user already. See the `REGSITRATION_*` constants for possible values.
      Returns:
        true if the user has been registered or false otherwise

    - #### registerUseronServer

          public OwlFinishRegistration registerUseronServer(OwlInitialRegistration userLoginRegistrationReceived)
                                                     throws CryptoException

      Receives the payload sent by the client as part of user registration, and stores necessary values in the server.

      Must be called after `OwlClientRegistration.initiateUserRegistration()` by the `OwlClient`.

      Parameters:
        `userLoginRegistrationReceived` - `OwlInitialRegistration`
      Returns:
        `OwlFinishRegistration`
      Throws:
        `java.lang.IllegalStateException` - if this functions is called more than once.
        `CryptoException` - if validation of the payload fails