• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/kssl
 

tdeio/kssl

  • tdeio
  • kssl
kopenssl.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2001-2003 George Staikos <staikos@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 
20 // IF YOU ARE USING THIS CLASS, YOU ARE MAKING A MISTAKE.
21 
22 #ifndef __KOPENSSLPROXY_H
23 #define __KOPENSSLPROXY_H
24 
25 #define KOSSL KOpenSSLProxy
26 class KOpenSSLProxyPrivate;
27 
28 #include <klibloader.h>
29 
30 #ifdef TQ_WS_WIN
31 #include "ksslconfig_win.h"
32 #else
33 #include "ksslconfig.h"
34 #endif
35 
36 #ifdef KSSL_HAVE_SSL
37 #define crypt _openssl_crypt
38 #include <openssl/ssl.h>
39 #include <openssl/x509.h>
40 #include <openssl/x509v3.h>
41 #include <openssl/pem.h>
42 #include <openssl/bio.h>
43 #include <openssl/rand.h>
44 #include <openssl/asn1.h>
45 #include <openssl/pkcs7.h>
46 #include <openssl/pkcs12.h>
47 #include <openssl/evp.h>
48 #include <openssl/stack.h>
49 #include <openssl/bn.h>
50 #undef crypt
51 
52 #if !defined(LIBRESSL_VERSION_NUMBER)
53 #define STACK OPENSSL_STACK
54 #else
55 #define STACK _STACK
56 #endif
57 
58 #endif // KSSL_HAVE_SSL
59 
60 #include <kstaticdeleter.h>
61 
70 class TDEIO_EXPORT KOpenSSLProxy {
71 friend class KStaticDeleter<KOpenSSLProxy>;
72 public:
73 
78  static KOpenSSLProxy *self();
79 
83  bool hasLibCrypto() const;
84 
88  bool hasLibSSL() const;
89 
94  void destroy();
95 
96  // Here are the symbols that we need.
97 #ifdef KSSL_HAVE_SSL
98 
99  /*
100  * SSL_connect - initiate the TLS/SSL handshake with an TLS/SSL server
101  */
102  int SSL_connect(SSL *ssl);
103 
104  /*
105  * SSL_accept - initiate the TLS/SSL handshake with an TLS/SSL server
106  */
107  int SSL_accept(SSL *ssl);
108 
109  /*
110  * SSL_get_error - get the error code
111  */
112  int SSL_get_error(SSL *ssl, int rc);
113 
114  /*
115  * SSL_read - read bytes from a TLS/SSL connection.
116  */
117  int SSL_read(SSL *ssl, void *buf, int num);
118 
119  /*
120  * SSL_write - write bytes to a TLS/SSL connection.
121  */
122  int SSL_write(SSL *ssl, const void *buf, int num);
123 
124  /*
125  * SSL_new - create a new SSL structure for a connection
126  */
127  SSL *SSL_new(SSL_CTX *ctx);
128 
129  /*
130  * SSL_free - free an allocated SSL structure
131  */
132  void SSL_free(SSL *ssl);
133 
134  /*
135  * SSL_shutdown - shutdown an allocated SSL connection
136  */
137  int SSL_shutdown(SSL *ssl);
138 
139  /*
140  * SSL_CTX_new - create a new SSL_CTX object as framework for TLS/SSL enabled functions
141  */
142  SSL_CTX *SSL_CTX_new(SSL_METHOD *method);
143 
144  /*
145  * SSL_CTX_free - free an allocated SSL_CTX object
146  */
147  void SSL_CTX_free(SSL_CTX *ctx);
148 
149  /*
150  * SSL_set_fd - connect the SSL object with a file descriptor
151  */
152  int SSL_set_fd(SSL *ssl, int fd);
153 
154  /*
155  * SSL_pending - obtain number of readable bytes buffered in an SSL object
156  */
157  int SSL_pending(SSL *ssl);
158 
159  /*
160  * SSL_peek - obtain bytes buffered in an SSL object
161  */
162  int SSL_peek(SSL *ssl, void *buf, int num);
163 
164  /*
165  * SSL_CTX_set_cipher_list - choose list of available SSL_CIPHERs
166  */
167  int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str);
168 
169  /*
170  * SSL_CTX_set_verify - set peer certificate verification parameters
171  */
172  void SSL_CTX_set_verify(SSL_CTX *ctx, int mode,
173  int (*verify_callback)(int, X509_STORE_CTX *));
174 
175  /*
176  * SSL_use_certificate - load certificate
177  */
178  int SSL_use_certificate(SSL *ssl, X509 *x);
179 
180  /*
181  * SSL_get_current_cipher - get SSL_CIPHER of a connection
182  */
183  SSL_CIPHER *SSL_get_current_cipher(SSL *ssl);
184 
185  /* SSL_set_options - manipulate SSL engine options */
186  long _SSL_set_options(SSL *ssl, long options);
187 
188  /* Returns 0 if not reused, 1 if session id is reused */
189  int _SSL_session_reused(SSL *ssl);
190 
191  /* SSL control */
192  long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg);
193 
194  /*
195  * RAND_egd - set the path to the EGD
196  */
197  int RAND_egd(const char *path);
198 
199 
200  /*
201  * RAND_file_name
202  */
203  const char *RAND_file_name(char *buf, size_t num);
204 
205 
206  /*
207  * RAND_load_file
208  */
209  int RAND_load_file(const char *filename, long max_bytes);
210 
211 
212  /*
213  * RAND_write_file
214  */
215  int RAND_write_file(const char *filename);
216 
217 
218  /*
219  * TLSv1_client_method - return a TLSv1 client method object
220  */
221  SSL_METHOD *TLSv1_client_method();
222 
223 
224  /*
225  * SSLv2_client_method - return a SSLv2 client method object
226  */
227  SSL_METHOD *SSLv2_client_method();
228 
229 
230  /*
231  * SSLv3_client_method - return a SSLv3 client method object
232  */
233  SSL_METHOD *SSLv3_client_method();
234 
235 
236  /*
237  * TLS_client_method - return client method object
238  */
239  SSL_METHOD *TLS_client_method();
240 
241 
242  /*
243  * SSL_get_peer_certificate - return the peer's certificate
244  */
245  X509 *SSL_get_peer_certificate(SSL *s);
246 
247 
248  /*
249  * SSL_get_peer_cert_chain - get the peer's certificate chain
250  */
251  STACK_OF(X509) *SSL_get_peer_cert_chain(SSL *s);
252 
253  /*
254  * SSL_CIPHER_get_bits - get the number of bits in this cipher
255  */
256  int SSL_CIPHER_get_bits(SSL_CIPHER *c,int *alg_bits);
257 
258 
259  /*
260  * SSL_CIPHER_get_version - get the version of this cipher
261  */
262  char *SSL_CIPHER_get_version(SSL_CIPHER *c);
263 
264 
265  /*
266  * SSL_CIPHER_get_name - get the name of this cipher
267  */
268  const char *SSL_CIPHER_get_name(SSL_CIPHER *c);
269 
270 
271  /*
272  * SSL_CIPHER_description - get the description of this cipher
273  */
274  char *SSL_CIPHER_description(SSL_CIPHER *,char *buf,int size);
275 
276 
277  /*
278  * SSL_CTX_use_PrivateKey - set the private key for the session.
279  * - for use with client certificates
280  */
281  int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey);
282 
283 
284  /*
285  * SSL_CTX_use_certificate - set the client certificate for the session.
286  */
287  int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x);
288 
289 
290  /*
291  * d2i_X509 - Covert a text representation of X509 to an X509 object
292  */
293  X509 * d2i_X509(X509 **a,unsigned char **pp,long length);
294 
295  /*
296  * d2i_X509 - Covert a text representation of X509 CRL to an X509_CRL object
297  */
298  X509_CRL * d2i_X509_CRL(X509_CRL **a,unsigned char **pp,long length);
299 
300 
301  /*
302  * i2d_X509 - Covert an X509 object into a text representation
303  */
304  int i2d_X509(X509 *a,unsigned char **pp);
305 
306 
307  /*
308  * X509_cmp - compare two X509 objects
309  */
310  int X509_cmp(X509 *a, X509 *b);
311 
312 
313  /*
314  * X509_subject_name_cmp - compare subject name of two X509 objects
315  */
316  int X509_subject_name_cmp(const X509 *a, const X509 *b);
317 
318 
319  /*
320  * X509_dup - duplicate an X509 object
321  */
322  X509 *X509_dup(X509 *x509);
323 
324 
325  /*
326  * X509_get0_signature - get signature and algorithm
327  */
328  void X509_get0_signature(const ASN1_BIT_STRING **psig,
329  const X509_ALGOR **palg, const X509 *x);
330 
331 
332 
333  /*
334  *
335  */
336  ASN1_TIME *X509_getm_notAfter(const X509 *x);
337 
338 
339  /*
340  *
341  */
342  ASN1_TIME *X509_getm_notBefore(const X509 *x);
343 
344 
345  /*
346  * X509_STORE_CTX_new - create an X509 store context
347  */
348  X509_STORE_CTX *X509_STORE_CTX_new(void);
349 
350 
351  /*
352  * X509_STORE_CTX_free - free up an X509 store context
353  */
354  void X509_STORE_CTX_free(X509_STORE_CTX *v);
355 
356 
357  /*
358  * X509_STORE_CTX_set0_untrusted - set the certificate chain
359  */
360  void X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *v, STACK_OF(X509)* x);
361 
362 
363  /*
364  * X509_STORE_CTX_set_purpose - set the purpose of the certificate
365  */
366  void X509_STORE_CTX_set_purpose(X509_STORE_CTX *v, int purpose);
367 
368 
369  /*
370  *
371  */
372  X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
373 
374 
375  /*
376  *
377  */
378  int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx);
379 
380 
381  /*
382  *
383  */
384  int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
385 
386 
387  /*
388  *
389  */
390  void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s);
391 
392 
393  /*
394  *
395  */
396  void X509_STORE_set_verify_cb(X509_STORE *ctx,
397  X509_STORE_CTX_verify_cb verify_cb);
398 
399 
400  /*
401  *
402  */
403  STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *v);
404 
405 
406  /*
407  *
408  */
409  X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a);
410 
411 
412  /*
413  *
414  */
415  X509 *X509_OBJECT_get0_X509(const X509_OBJECT *a);
416 
417 
418  /*
419  * X509_verify_cert - verify the certificate
420  */
421  int X509_verify_cert(X509_STORE_CTX *v);
422 
423 
424  /*
425  * X509_STORE_new - create an X509 store
426  */
427  X509_STORE *X509_STORE_new(void);
428 
429 
430  /*
431  * X509_STORE_free - free up an X509 store
432  */
433  void X509_STORE_free(X509_STORE *v);
434 
435 
436  /*
437  * X509_free - free up an X509
438  */
439  void X509_free(X509 *v);
440 
441  /*
442  * X509_CRL_free - free up an X509 CRL
443  */
444  void X509_CRL_free(X509_CRL *v);
445 
446 
447  /*
448  *
449  */
450  const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl);
451 
452 
453  /*
454  *
455  */
456  const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl);
457 
458 
459  /*
460  * X509_NAME_oneline - return the X509 data in a string
461  */
462  char *X509_NAME_oneline(X509_NAME *a, char *buf, int size);
463 
464 
465  /*
466  * X509_get_subject_name - return the X509_NAME for the subject field
467  */
468  X509_NAME *X509_get_subject_name(X509 *a);
469 
470 
471  /*
472  * X509_get_issuer_name - return the X509_NAME for the issuer field
473  */
474  X509_NAME *X509_get_issuer_name(X509 *a);
475 
476 
477  /*
478  * X509_STORE_add_lookup - add a lookup file/method to an X509 store
479  */
480  X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);
481 
482 
483  /*
484  * X509_LOOKUP_file - Definition of the LOOKUP_file method
485  */
486  X509_LOOKUP_METHOD *X509_LOOKUP_file(void);
487 
488 
489  /*
490  * X509_LOOKUP_free - Free an X509_LOOKUP
491  */
492  void X509_LOOKUP_free(X509_LOOKUP *x);
493 
494 
495  /*
496  * X509_LOOKUP_ctrl - This is not normally called directly (use macros)
497  */
498  int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl, char **ret);
499 
500 
501  /*
502  * X509_STORE_CTX_init - initialize an X509 STORE context
503  */
504  void X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, STACK_OF(X509) *chain);
505 
506 
507  /*
508  * CRYPTO_free - free up an internally allocated object
509  */
510  void CRYPTO_free(void *x);
511 
512  /*
513  * BIO_new - create new BIO
514  */
515  BIO *BIO_new(BIO_METHOD *type);
516 
517  /*
518  * BIO methods - only one defined here yet
519  */
520  BIO_METHOD *BIO_s_mem(void);
521 
522  /*
523  * BIO_new_fp - nastiness called BIO - used to create BIO* from FILE*
524  */
525  BIO *BIO_new_fp(FILE *stream, int close_flag);
526 
527  /*
528  * BIO_new_mem_buf - read only BIO from memory region
529  */
530  BIO *BIO_new_mem_buf(void *buf, int len);
531 
532  /*
533  * BIO_free - nastiness called BIO - used to destroy BIO*
534  */
535  int BIO_free(BIO *a);
536 
537  /*
538  * BIO_ctrl - BIO control method
539  */
540  long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg);
541 
542  /*
543  * BIO_write - equivalent to ::write for BIO
544  */
545  int BIO_write(BIO *b, const void *data, int len);
546 
547  /*
548  * BIO_get_data - retrieve (custom) data from BIO
549  */
550  void *BIO_get_data(BIO *a);
551 
552  /*
553  * PEM_write_bio_X509 - write a PEM encoded cert to a BIO*
554  */
555  int PEM_write_bio_X509(BIO *bp, X509 *x);
556 
557  /*
558  * ASN1_i2d_fp - used for netscape output
559  */
560  int ASN1_i2d_fp(FILE *out, unsigned char *x);
561 
562 
563  /*
564  * ASN1_d2i_fp - read an X509 from a DER encoded file (buf can be NULL)
565  */
566  X509 *X509_d2i_fp(FILE *out, X509** buf);
567 
568 
569  /*
570  * X509_print - print the text form of an X509
571  */
572  int X509_print(FILE *fp, X509 *x);
573 
574 
575  /*
576  * Read a PKCS#12 cert from fp
577  */
578  PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12);
579 
580 
581  /*
582  * Change the password on a PKCS#12 cert
583  */
584  int PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass);
585 
586 
587  /*
588  * Write a PKCS#12 to mem
589  */
590  int i2d_PKCS12(PKCS12 *p12, unsigned char **p);
591 
592 
593  /*
594  * Write a PKCS#12 to FILE*
595  */
596  int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12);
597 
598 
599  /*
600  * Create a new PKCS#12 object
601  */
602  PKCS12 *PKCS12_new(void);
603 
604 
605  /*
606  * Destroy that PKCS#12 that you created!
607  */
608  void PKCS12_free(PKCS12 *a);
609 
610 
611  /*
612  * Parse the PKCS#12
613  */
614  int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey,
615  X509 **cert, STACK_OF(X509) **ca);
616 
617 
618  /*
619  * Free the Private Key
620  */
621  void EVP_PKEY_free(EVP_PKEY *x);
622 
623 
624  /*
625  * Pop off the stack
626  */
627  char *OPENSSL_sk_pop(STACK *s);
628 
629  char *OPENSSL_sk_pop(void *s) { return OPENSSL_sk_pop(reinterpret_cast<STACK*>(s)); }
630 
631 
632  /*
633  * Free the stack
634  */
635  void OPENSSL_sk_free(STACK *s);
636 
637  void OPENSSL_sk_free(void *s) { OPENSSL_sk_free(reinterpret_cast<STACK*>(s)); }
638 
639  /*
640  * Number of elements in the stack
641  */
642  int OPENSSL_sk_num(STACK *s);
643 
644  int OPENSSL_sk_num(void *s) { return OPENSSL_sk_num(reinterpret_cast<STACK*>(s)); }
645 
646  /*
647  * Value of element n in the stack
648  */
649  char *OPENSSL_sk_value(STACK *s, int n);
650 
651  char *OPENSSL_sk_value(void *s, int n) { return OPENSSL_sk_value(reinterpret_cast<STACK*>(s), n); }
652 
653  /*
654  * Create a new stack
655  */
656  STACK *OPENSSL_sk_new(int (*cmp)());
657 
658 
659  /*
660  * Add an element to the stack
661  */
662  int OPENSSL_sk_push(STACK *s, char *d);
663 
664  int OPENSSL_sk_push(void *s, void *d) { return OPENSSL_sk_push(reinterpret_cast<STACK*>(s), reinterpret_cast<char*>(d)); }
665 
666  /*
667  * Duplicate the stack
668  */
669  STACK *OPENSSL_sk_dup(const STACK *s);
670 
671  STACK *OPENSSL_sk_dup(const void *s) { return OPENSSL_sk_dup(reinterpret_cast<const STACK*>(s)); }
672 
673  /*
674  * Convert an ASN1_INTEGER to it's text form
675  */
676  char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint);
677 
678 
679  /*
680  * Get the certificate's serial number
681  */
682  ASN1_INTEGER *X509_get_serialNumber(X509 *x);
683 
684 
685  /*
686  * Get the certificate's public key
687  */
688  EVP_PKEY *X509_get_pubkey(X509 *x);
689 
690 
691  /*
692  * Convert the public key to a decimal form
693  */
694  int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp);
695 
696 
697  /*
698  * Check the private key of a PKCS bundle against the X509
699  */
700  int X509_check_private_key(X509 *x, EVP_PKEY *p);
701 
702 
703  /*
704  * Convert a BIGNUM to a hex string
705  */
706  char *BN_bn2hex(const BIGNUM *a);
707 
708 
709  /*
710  * Compute the digest of an X.509
711  */
712  int X509_digest(const X509 *x,const EVP_MD *t, unsigned char *md, unsigned int *len);
713 
714 
715  /*
716  * EVP_md5
717  */
718  EVP_MD *EVP_md5();
719 
720 
721  /*
722  * ASN1_INTEGER free
723  */
724  void ASN1_INTEGER_free(ASN1_INTEGER *x);
725 
726 
727  /*
728  * ASN1_STRING_data
729  */
730  unsigned char *ASN1_STRING_data(ASN1_STRING *x);
731 
732  /*
733  * ASN1_STRING_get0_data
734  */
735  const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x);
736 
737  /*
738  * ASN1_STRING_length
739  */
740  int ASN1_STRING_length(const ASN1_STRING *x);
741 
742  /*
743  * ASN1_OCTET_STRING_new
744  */
745  ASN1_OCTET_STRING* ASN1_OCTET_STRING_new();
746 
747  /*
748  * ASN1_OCTET_STRING_free
749  */
750  void ASN1_OCTET_STRING_free(ASN1_OCTET_STRING *x);
751 
752  /*
753  * ASN1_OCTET_STRING_set
754  */
755  int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len);
756 
757  /*
758  *
759  */
760  int OBJ_obj2nid(ASN1_OBJECT *o);
761 
762  /*
763  *
764  */
765  const char * OBJ_nid2ln(int n);
766 
767  /*
768  * get the number of extensions
769  */
770  int X509_get_ext_count(X509 *x);
771 
772  /*
773  *
774  */
775  int X509_get_ext_by_NID(X509 *x, int nid, int lastpos);
776 
777  /*
778  *
779  */
780  int X509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,int lastpos);
781 
782  /*
783  *
784  */
785  X509_EXTENSION *X509_get_ext(X509 *x, int loc);
786 
787  /*
788  *
789  */
790  X509_EXTENSION *X509_delete_ext(X509 *x, int loc);
791 
792  /*
793  *
794  */
795  int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);
796 
797  /*
798  *
799  */
800  void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx);
801 
802  /*
803  *
804  */
805  char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5);
806 
807  /*
808  *
809  */
810  int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
811 
812  /*
813  *
814  */
815  PKCS7 *PKCS7_new(void);
816 
817  /*
818  *
819  */
820  void PKCS7_free(PKCS7 *a);
821 
822  /*
823  *
824  */
825  void PKCS7_content_free(PKCS7 *a);
826 
827  /*
828  *
829  */
830  int i2d_PKCS7(PKCS7 *a, unsigned char **pp);
831 
832  /*
833  *
834  */
835  PKCS7 *d2i_PKCS7(PKCS7 **a, unsigned char **pp,long length);
836 
837  /*
838  *
839  */
840  int i2d_PKCS7_fp(FILE *fp,PKCS7 *p7);
841 
842  /*
843  *
844  */
845  PKCS7 *d2i_PKCS7_fp(FILE *fp,PKCS7 **p7);
846 
847  /*
848  *
849  */
850  int i2d_PKCS7_bio(BIO *bp,PKCS7 *p7);
851 
852  /*
853  *
854  */
855  PKCS7 *d2i_PKCS7_bio(BIO *bp,PKCS7 **p7);
856 
857  /*
858  *
859  */
860  PKCS7 *PKCS7_dup(PKCS7 *p7);
861 
862  /*
863  * Create a PKCS7 signature / signed message
864  */
865  PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
866  BIO *data, int flags);
867 
868  /*
869  * Verify a PKCS7 signature.
870  */
871  int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
872  BIO *indata, BIO *out, int flags);
873 
874  /*
875  * Get signers of a verified PKCS7 signature
876  */
877  STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags);
878 
879  /*
880  * PKCS7 encrypt message
881  */
882  PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, EVP_CIPHER *cipher,
883  int flags);
884 
885  /*
886  * decrypt PKCS7 message
887  */
888  int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags);
889 
890 
891  /*
892  * Load a CA list file.
893  */
894  STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);
895 
896  /*
897  * Load a file of PEM encoded objects.
898  */
899  STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
900  pem_password_cb *cb, void *u);
901 
902  /*
903  * Get the number of purposes available
904  */
905  int X509_PURPOSE_get_count();
906 
907 
908  /*
909  * Get the ID of a purpose
910  */
911  int X509_PURPOSE_get_id(X509_PURPOSE *);
912 
913 
914  /*
915  * Check the existence of purpose id "id" in x. for CA, set ca = 1, else 0
916  */
917  int X509_check_purpose(X509 *x, int id, int ca);
918 
919 
920  /*
921  * Get the purpose with index #idx
922  */
923  X509_PURPOSE * X509_PURPOSE_get0(int idx);
924 
925 
926  /*
927  * Create a new Private KEY
928  */
929  EVP_PKEY* EVP_PKEY_new();
930 
931 
932  /*
933  * Get EVP private key type
934  */
935  int EVP_PKEY_base_id(const EVP_PKEY *pkey);
936 
937 
938  /*
939  * Assign a private key
940  */
941  int EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key);
942 
943 
944  /*
945  * Get RSA key
946  */
947  RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey);
948 
949 
950  /*
951  * Get DSA key
952  */
953  DSA *EVP_PKEY_get0_DSA(EVP_PKEY *pkey);
954 
955 
956  /*
957  * RSA_get0_key - retreive key parameters
958  */
959  void RSA_get0_key(const RSA *r,
960  const BIGNUM **n, const BIGNUM **e, const BIGNUM **d);
961 
962 
963  /*
964  * Generate a RSA key
965  */
966  RSA *RSA_generate_key(int bits, unsigned long e, void
967  (*callback)(int,int,void *), void *cb_arg);
968 
969 
970  /*
971  * DSA_get0_pqg - retreive key parameters
972  */
973  void DSA_get0_pqg(const DSA *d,
974  const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
975 
976 
977  /*
978  * DSA_get0_key - retreive key
979  */
980  void DSA_get0_key(const DSA *d,
981  const BIGNUM **pub_key, const BIGNUM **priv_key);
982 
983 
984  /*
985  * Create/destroy a certificate request
986  */
987  X509_REQ *X509_REQ_new();
988  void X509_REQ_free(X509_REQ *a);
989 
990 
991  /*
992  * Set the public key in the REQ object
993  */
994  int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);
995 
996  /* for testing */
997  int i2d_X509_REQ_fp(FILE *fp, X509_REQ *x);
998 
999  /* SMime support */
1000  STACK *X509_get1_email(X509 *x);
1001  void X509_email_free(STACK *sk);
1002 
1003  /* Ciphers needed for SMime */
1004  EVP_CIPHER *EVP_des_ede3_cbc();
1005  EVP_CIPHER *EVP_des_cbc();
1006  EVP_CIPHER *EVP_rc2_cbc();
1007  EVP_CIPHER *EVP_rc2_64_cbc();
1008  EVP_CIPHER *EVP_rc2_40_cbc();
1009 
1010  /* clear the current error - use this often*/
1011  void ERR_clear_error();
1012 
1013  /* retrieve the latest error */
1014  unsigned long ERR_get_error();
1015 
1016  /* Print the errors to this stream */
1017  void ERR_print_errors_fp(FILE *fp);
1018 
1019  /* Get a pointer to the SSL session id (reference counted) */
1020  SSL_SESSION *SSL_get1_session(SSL *ssl);
1021 
1022  /* Frees a pointer to the SSL session id (reference decremented if needed) */
1023  void SSL_SESSION_free(SSL_SESSION *session);
1024 
1025  /* Set the SSL session to reuse. */
1026  int SSL_set_session(SSL *ssl, SSL_SESSION *session);
1027 
1028  /* Decode ASN.1 to SSL_SESSION */
1029  SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp, long length);
1030  /* Encode SSL_SESSION to ASN.1 */
1031  int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp);
1032 
1033  /* Write privatekey to FILE stream */
1034  int i2d_PrivateKey_fp(FILE*, EVP_PKEY*);
1035 
1036  /* Write PKCS#8privatekey to FILE stream */
1037  int i2d_PKCS8PrivateKey_fp(FILE*, EVP_PKEY*, const EVP_CIPHER*, char*, int, pem_password_cb*, void*);
1038 
1039  /* Free RSA structure */
1040  void RSA_free(RSA*);
1041 
1042  /* Get a blowfish CBC pointer */
1043  EVP_CIPHER *EVP_bf_cbc();
1044 
1045  /* Sign a CSR */
1046  int X509_REQ_sign(X509_REQ*, EVP_PKEY*, const EVP_MD*);
1047 
1048  /* add a name entry */
1049  int X509_NAME_add_entry_by_txt(X509_NAME*, char*, int, unsigned char*, int, int, int);
1050 
1051  /* Create a name */
1052  X509_NAME *X509_NAME_new();
1053 
1054  /* Set the subject */
1055  int X509_REQ_set_subject_name(X509_REQ*,X509_NAME*);
1056 
1057  /* get list of available SSL_CIPHER's sorted by preference */
1058  STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL* ssl);
1059 
1060 
1061  /* cover KOpenSSLProxy API compatibility */
1062 #if OPENSSL_API_COMPAT < 0x10100000L
1063 # undef sk_dup
1064 # undef sk_free
1065 # undef sk_new
1066 # undef sk_num
1067 # undef sk_pop
1068 # undef sk_push
1069 # undef sk_value
1070 # undef X509_STORE_CTX_set_chain
1071 # undef SSLv23_client_method
1072 #endif
1073  STACK *sk_dup(const STACK *s) TDE_DEPRECATED;
1074  void sk_free(STACK *s) TDE_DEPRECATED;
1075  STACK *sk_new(int (*cmp)()) TDE_DEPRECATED;
1076  int sk_num(STACK *s) TDE_DEPRECATED;
1077  char *sk_pop(STACK *s) TDE_DEPRECATED;
1078  int sk_push(STACK *s, char *d) TDE_DEPRECATED;
1079  char *sk_value(STACK *s, int n) TDE_DEPRECATED;
1080  void X509_STORE_CTX_set_chain(X509_STORE_CTX *v, STACK_OF(X509)* x) TDE_DEPRECATED;
1081  SSL_METHOD *SSLv23_client_method() TDE_DEPRECATED;
1082 
1083 #endif
1084 
1085 private:
1086  KOpenSSLProxy();
1087  ~KOpenSSLProxy();
1088  KOpenSSLProxyPrivate *d;
1089 
1090  KLibrary *_sslLib;
1091  KLibrary *_cryptoLib;
1092  static KOpenSSLProxy *_me;
1093 
1094  bool _ok;
1095 };
1096 
1097 #endif
1098 
KOpenSSLProxy
Dynamically load and wrap OpenSSL.
Definition: kopenssl.h:70

tdeio/kssl

Skip menu "tdeio/kssl"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeio/kssl

Skip menu "tdeio/kssl"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/kssl by doxygen 1.9.1
This website is maintained by Timothy Pearson.