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:
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 
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 
276 
281 
282 
293  bool connect();
294 
295 
306  bool accept();
307 
315 
320  ssize_t read(void *buf, ssize_t size);
321 
326  ssize_t write(const void *buf, ssize_t size);
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:
356 
359 
361  uint32_t getVersion();
362 
364  uint64_t getSerialNumber();
365 
367  const char *getSignatureAlgorithm();
368 
370  const char *getIssuer();
371 
374 
377 
379  const char *getSubject();
380 
382  const char *getCommonName();
383 
385  const char *getPublicKeyAlgorithm();
386 
388  const unsigned char *getPublicKey();
389 
393 
397 
400 
401  #include <rudiments/private/tlscertificate.h>
402 };
403 
404 #endif
Definition: datetime.h:12
Definition: filedescriptor.h:13
Definition: linkedlist.h:60
Definition: security.h:16
Definition: tls.h:9
static bool supported()
Definition: tls.h:352
datetime * getValidFrom()
const char * getIssuer()
uint64_t getPublicKeyBitSize()
datetime * getValidTo()
const char * getSignatureAlgorithm()
uint64_t getSerialNumber()
const char * getCommonName()
const char * getSubject()
uint64_t getPublicKeyByteSize()
const char * getPublicKeyAlgorithm()
uint32_t getVersion()
linkedlist< char * > * getSubjectAlternateNames()
const unsigned char * getPublicKey()
Definition: tls.h:18
const char * getCertificateAuthority()
tlscertificate * getPeerCertificate()
void setProtocolVersion(const char *version)
const char * getProtocolVersion()
void setPrivateKeyPassword(const char *password)
void setCertificateAuthority(const char *ca)
const char * getErrorString()
const char * getPrivateKeyPassword()
ssize_t pending()
filedescriptor * getFileDescriptor()
const char * getCiphers()
int32_t getError()
void setValidationDepth(uint16_t depth)
bool close()
ssize_t read(void *buf, ssize_t size)
void setCertificateChainFile(const char *filename)
ssize_t getSizeMax()
ssize_t write(const void *buf, ssize_t size)
const char * getPrivateKeyFile()
void setValidatePeer(bool validatepeer)
bool connect()
bool getValidatePeer()
void setFileDescriptor(filedescriptor *fd)
const char * getCertificateChainFile()
bool accept()
uint16_t getValidationDepth()
void setPrivateKeyFile(const char *filename)
virtual ~tlscontext()
void setCiphers(const char *ciphers)