Rudiments
tls.h
1 // Copyright (c) 2016 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 
55  void setCertificateChainFile(const char *filename);
56 
60  const char *getCertificateChainFile();
61 
68  void setPrivateKeyPassword(const char *password);
69 
76  const char *getPrivateKeyPassword();
77 
91  void setCiphers(const char *ciphers);
92 
95  const char *getCiphers();
96 
100  void setValidatePeer(bool validatepeer);
101 
105  bool getValidatePeer();
106 
130  void setValidationDepth(uint16_t depth);
131 
135  uint16_t getValidationDepth();
136 
151  void setCertificateAuthority(const char *ca);
152 
156  const char *getCertificateAuthority();
157 
161  void setFileDescriptor(filedescriptor *fd);
162 
166  filedescriptor *getFileDescriptor();
167 
168 
179  bool connect();
180 
181 
192  bool accept();
193 
200  tlscertificate *getPeerCertificate();
201 
206  ssize_t read(void *buf, ssize_t count);
207 
212  ssize_t write(const void *buf, ssize_t count);
213 
216  ssize_t pending();
217 
220  bool close();
221 
222 
225  ssize_t getSizeMax();
226 
227 
229  int32_t getError();
230 
233  const char *getErrorString();
234 
235  #include <rudiments/private/tlscontext.h>
236 };
237 
238 class RUDIMENTS_DLLSPEC tlscertificate {
239  public:
241  tlscertificate();
242 
244  ~tlscertificate();
245 
247  uint32_t getVersion();
248 
250  uint64_t getSerialNumber();
251 
253  const char *getSignatureAlgorithm();
254 
256  const char *getIssuer();
257 
259  datetime *getValidFrom();
260 
262  datetime *getValidTo();
263 
265  const char *getSubject();
266 
268  const char *getCommonName();
269 
271  const char *getPublicKeyAlgorithm();
272 
274  const unsigned char *getPublicKey();
275 
278  uint64_t getPublicKeyByteLength();
279 
282  uint64_t getPublicKeyBitLength();
283 
285  linkedlist< char * > *getSubjectAlternateNames();
286 
287  #include <rudiments/private/tlscertificate.h>
288 };
289 
290 #endif
Definition: linkedlist.h:60
Definition: datetime.h:14
Definition: filedescriptor.h:14
Definition: security.h:16
Definition: tls.h:9
Definition: tls.h:18
Definition: tls.h:238