TsgcHTTP_OAuth2_ClientMethods › GenerateDPoPKeyPair

GenerateDPoPKeyPair Method

Creates a DPoP-compliant key pair and populates DPoPOptions.

Syntax

procedure GenerateDPoPKeyPair;

Remarks

Generates a fresh public/private key pair according to DPoPOptions.Algorithm (dpopES256 produces an EC P-256 pair; dpopRS256 expects keys to be provided externally). On success, the method writes the private key PEM into DPoPOptions.PrivateKey and the public key JWK JSON into DPoPOptions.PublicKeyJWK, ready for signing DPoP proofs as described in RFC 9449. Requires OpenSSL EC support to be compiled in (SGC_SSL_EC); raises an exception otherwise.

Example

oAuth2.DPoPOptions.Enabled := True;
oAuth2.DPoPOptions.Algorithm := dpopES256;
oAuth2.GenerateDPoPKeyPair;
// DPoPOptions.PrivateKey and DPoPOptions.PublicKeyJWK are now populated
oAuth2.Start;

Back to Methods