Skip to content

Commit 20671c9

Browse files
committed
libvncclient: add API to provide expected X.509 cert fingerprint
1 parent d96100e commit 20671c9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

include/rfb/rfbclient.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ typedef union _rfbCredential
149149
char *x509ClientCertFile;
150150
char *x509ClientKeyFile;
151151
uint8_t x509CrlVerifyMode; /* Only required for OpenSSL - see meanings below */
152+
uint8_t *x509ExpectedFingerprint; /**< When none of the x509*CertFile paths are given, this can be used to
153+
convey to the library the expected SHA256 fingerprint of the remote's
154+
certificate. When not NULL, must be 32 bytes. */
152155
} x509Credential;
153156
/** Plain (VeNCrypt), MSLogon (UltraVNC) */
154157
struct
@@ -215,6 +218,17 @@ typedef void (*GotFrameBufferUpdateProc)(struct _rfbClient* client, int x, int y
215218
typedef void (*FinishedFrameBufferUpdateProc)(struct _rfbClient* client);
216219
typedef char* (*GetPasswordProc)(struct _rfbClient* client);
217220
typedef rfbCredential* (*GetCredentialProc)(struct _rfbClient* client, int credentialType);
221+
/**
222+
Callback that is invoked with the remote's cert's details if the remote cert
223+
could not be validated against the system CA and, failing that, its fingerprint
224+
does not match the one indicated in rfbCredential.x509Credential.x509ExpectedFingerprint.
225+
*/
226+
typedef rfbBool (*GetX509CertFingerprintMismatchDecisionProc)(struct _rfbClient* client,
227+
const char *remote_cert_subject,
228+
time_t remote_cert_valid_from,
229+
time_t remote_cert_valid_until,
230+
const uint8_t *remote_cert_sha256_fingerprint,
231+
size_t remote_cert_sha256_fingerprint_len);
218232
typedef rfbBool (*MallocFrameBufferProc)(struct _rfbClient* client);
219233
typedef void (*GotXCutTextProc)(struct _rfbClient* client, const char *text, int textlen);
220234
typedef void (*GotXCutTextUTF8Proc)(struct _rfbClient* client, const char* buffer, int buffer_len);
@@ -489,6 +503,8 @@ typedef struct _rfbClient {
489503

490504
/* flag to indicate wheter updateRect is managed by lib or user */
491505
rfbBool isUpdateRectManagedByLib;
506+
507+
GetX509CertFingerprintMismatchDecisionProc GetX509CertFingerprintMismatchDecision;
492508
} rfbClient;
493509

494510
/* cursor.c */

0 commit comments

Comments
 (0)