CPACE_CTX_new function

  1. @RecordUse.new()
  2. @Native<Pointer<CPACE_CTX> Function(UnsignedInt, Pointer<Uint8>, Size, Pointer<Uint8>, Size, Pointer<Uint8>, Size, Pointer<Uint8>, Size)>(ffi.UnsignedInt, ffi.Pointer<ffi.Uint8>, ffi.Size, ffi.Pointer<ffi.Uint8>, ffi.Size, ffi.Pointer<ffi.Uint8>, ffi.Size, ffi.Pointer<ffi.Uint8>, ffi.Size)>(symbol: 'bssl_dart_CPACE_CTX_new')
Pointer<CPACE_CTX> CPACE_CTX_new(
  1. int role,
  2. Pointer<Uint8> password,
  3. int password_len,
  4. Pointer<Uint8> channel_id,
  5. int channel_id_len,
  6. Pointer<Uint8> assoc_data,
  7. int assoc_data_len,
  8. Pointer<Uint8> session_id,
  9. int session_id_len,
)

CPACE_CTX_new returns a newly-allocated CPACE_CTX object that implements one side of the CPace protocol, or nullptr on error. This function implements CPACE-X25519-SHA512 in initiator-responder mode, acting as role and with password as the password-related string (PRS).

channel_id and session_id are the channel identifier (CI) and session identifier (sid) values, respectively. Both values must match for the exchange to proceed. assoc_data is the cleartext associated data (ADa or ADb) to be sent to the peer. These values may be empty if not used. See Section 4.1 of draft-irtf-cfrg-cpace-21 for details.

The application-level identities of each party in the protocol should be incorporated into either channel_id or each party's respective assoc_data values. See Section 10.1 of draft-irtf-cfrg-cpace-21.

Once a CPACE_CTX is successfully created, the caller should call CPACE_generate_msg to generate the message to send to the peer.

Implementation

@meta.RecordUse()
@ffi.Native<
  ffi.Pointer<CPACE_CTX> Function(
    ffi.UnsignedInt,
    ffi.Pointer<ffi.Uint8>,
    ffi.Size,
    ffi.Pointer<ffi.Uint8>,
    ffi.Size,
    ffi.Pointer<ffi.Uint8>,
    ffi.Size,
    ffi.Pointer<ffi.Uint8>,
    ffi.Size,
  )
>(symbol: 'bssl_dart_CPACE_CTX_new')
external ffi.Pointer<CPACE_CTX> CPACE_CTX_new(
  int role,
  ffi.Pointer<ffi.Uint8> password,
  int password_len,
  ffi.Pointer<ffi.Uint8> channel_id,
  int channel_id_len,
  ffi.Pointer<ffi.Uint8> assoc_data,
  int assoc_data_len,
  ffi.Pointer<ffi.Uint8> session_id,
  int session_id_len,
);