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 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:
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 getPublicKeyByteSize();
393
396 uint64_t getPublicKeyBitSize();
397
399 linkedlist< char * > *getSubjectAlternateNames();
400
401 #include <rudiments/private/tlscertificate.h>
402 };
403
404 #endif
datetime
Definition: datetime.h:12
filedescriptor
Definition: filedescriptor.h:13
linkedlist
Definition: linkedlist.h:60
securitycontext
Definition: security.h:16
tls
Definition: tls.h:9
tls::supported
static bool supported()
tlscertificate
Definition: tls.h:352
tlscertificate::getValidFrom
datetime * getValidFrom()
tlscertificate::getIssuer
const char * getIssuer()
tlscertificate::getPublicKeyBitSize
uint64_t getPublicKeyBitSize()
tlscertificate::getValidTo
datetime * getValidTo()
tlscertificate::~tlscertificate
~tlscertificate()
tlscertificate::getSignatureAlgorithm
const char * getSignatureAlgorithm()
tlscertificate::getSerialNumber
uint64_t getSerialNumber()
tlscertificate::getCommonName
const char * getCommonName()
tlscertificate::getSubject
const char * getSubject()
tlscertificate::getPublicKeyByteSize
uint64_t getPublicKeyByteSize()
tlscertificate::getPublicKeyAlgorithm
const char * getPublicKeyAlgorithm()
tlscertificate::getVersion
uint32_t getVersion()
tlscertificate::getSubjectAlternateNames
linkedlist< char * > * getSubjectAlternateNames()
tlscertificate::getPublicKey
const unsigned char * getPublicKey()
tlscertificate::tlscertificate
tlscertificate()
tlscontext
Definition: tls.h:18
tlscontext::getCertificateAuthority
const char * getCertificateAuthority()
tlscontext::getPeerCertificate
tlscertificate * getPeerCertificate()
tlscontext::tlscontext
tlscontext()
tlscontext::setProtocolVersion
void setProtocolVersion(const char *version)
tlscontext::getProtocolVersion
const char * getProtocolVersion()
tlscontext::setPrivateKeyPassword
void setPrivateKeyPassword(const char *password)
tlscontext::setCertificateAuthority
void setCertificateAuthority(const char *ca)
tlscontext::getErrorString
const char * getErrorString()
tlscontext::getPrivateKeyPassword
const char * getPrivateKeyPassword()
tlscontext::pending
ssize_t pending()
tlscontext::getFileDescriptor
filedescriptor * getFileDescriptor()
tlscontext::getCiphers
const char * getCiphers()
tlscontext::getError
int32_t getError()
tlscontext::setValidationDepth
void setValidationDepth(uint16_t depth)
tlscontext::close
bool close()
tlscontext::read
ssize_t read(void *buf, ssize_t size)
tlscontext::setCertificateChainFile
void setCertificateChainFile(const char *filename)
tlscontext::getSizeMax
ssize_t getSizeMax()
tlscontext::write
ssize_t write(const void *buf, ssize_t size)
tlscontext::getPrivateKeyFile
const char * getPrivateKeyFile()
tlscontext::setValidatePeer
void setValidatePeer(bool validatepeer)
tlscontext::connect
bool connect()
tlscontext::getValidatePeer
bool getValidatePeer()
tlscontext::setFileDescriptor
void setFileDescriptor(filedescriptor *fd)
tlscontext::getCertificateChainFile
const char * getCertificateChainFile()
tlscontext::accept
bool accept()
tlscontext::getValidationDepth
uint16_t getValidationDepth()
tlscontext::setPrivateKeyFile
void setPrivateKeyFile(const char *filename)
tlscontext::~tlscontext
virtual ~tlscontext()
tlscontext::setCiphers
void setCiphers(const char *ciphers)