Rudiments
tls.h
1 // Copyright (c) 1999-2018 David Muse
2 // See the COPYING file for more information.
3 
4 #ifndef RUDIMENTS_TLS_H
5 #define RUDIMENTS_TLS_H
6 
7 #include <rudiments/private/tlsincludes.h>
8 
9 class RUDIMENTS_DLLSPEC tls {
10  public:
13  static bool supported();
14 
15  #include <rudiments/private/tls.h>
16 };
17 
18 class RUDIMENTS_DLLSPEC tlscontext : public securitycontext {
19  public:
21  tlscontext();
22 
24  virtual ~tlscontext();
25 
33  void setProtocolVersion(const char *version);
34 
37  const char *getProtocolVersion();
38 
106  void setCertificateChainFile(const char *filename);
107 
111  const char *getCertificateChainFile();
112 
129  void setPrivateKeyFile(const char *filename);
130 
134  const char *getPrivateKeyFile();
135 
142  void setPrivateKeyPassword(const char *password);
143 
150  const char *getPrivateKeyPassword();
151 
165  void setCiphers(const char *ciphers);
166 
169  const char *getCiphers();
170 
174  void setValidatePeer(bool validatepeer);
175 
179  bool getValidatePeer();
180 
204  void setValidationDepth(uint16_t depth);
205 
209  uint16_t getValidationDepth();
210 
265  void setCertificateAuthority(const char *ca);
266 
270  const char *getCertificateAuthority();
271 
275  void setFileDescriptor(filedescriptor *fd);
276 
280  filedescriptor *getFileDescriptor();
281 
282 
293  bool connect();
294 
295 
306  bool accept();
307 
314  tlscertificate *getPeerCertificate();
315 
320  ssize_t read(void *buf, ssize_t count);
321 
326  ssize_t write(const void *buf, ssize_t count);
327 
330  ssize_t pending();
331 
334  bool close();
335 
336 
339  ssize_t getSizeMax();
340 
341 
343  int32_t getError();
344 
347  const char *getErrorString();
348 
349  #include <rudiments/private/tlscontext.h>
350 };
351 
352 class RUDIMENTS_DLLSPEC tlscertificate {
353  public:
355  tlscertificate();
356 
358  ~tlscertificate();
359 
361  uint32_t getVersion();
362 
364  uint64_t getSerialNumber();
365 
367  const char *getSignatureAlgorithm();
368 
370  const char *getIssuer();
371 
373  datetime *getValidFrom();
374 
376  datetime *getValidTo();
377 
379  const char *getSubject();
380 
382  const char *getCommonName();
383 
385  const char *getPublicKeyAlgorithm();
386 
388  const unsigned char *getPublicKey();
389 
392  uint64_t getPublicKeyByteLength();
393 
396  uint64_t getPublicKeyBitLength();
397 
399  linkedlist< char * > *getSubjectAlternateNames();
400 
401  #include <rudiments/private/tlscertificate.h>
402 };
403 
404 #endif
Definition: linkedlist.h:60
Definition: datetime.h:12
Definition: filedescriptor.h:13
Definition: security.h:16
Definition: tls.h:9
Definition: tls.h:18
Definition: tls.h:352