KHtml

kopenssl.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2001-2003 George Staikos <[email protected]>
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 // IF YOU ARE USING THIS CLASS, YOU ARE MAKING A MISTAKE.
20 
21 #ifndef __KOPENSSLPROXY_H
22 #define __KOPENSSLPROXY_H
23 
24 #define KOSSL KOpenSSLProxy
25 class KOpenSSLProxyPrivate;
26 
27 #include <ksslconfig.h>
28 
29 #if KSSL_HAVE_SSL
30 #define crypt _openssl_crypt
31 #include <openssl/ssl.h>
32 #include <openssl/x509.h>
33 #include <openssl/x509v3.h>
34 #include <openssl/pem.h>
35 #include <openssl/bio.h>
36 #include <openssl/rand.h>
37 #include <openssl/asn1.h>
38 #include <openssl/pkcs7.h>
39 #include <openssl/pkcs12.h>
40 #include <openssl/evp.h>
41 #include <openssl/stack.h>
42 #include <openssl/bn.h>
43 #undef crypt
44 #if OPENSSL_VERSION_NUMBER >= 0x10000000L
45 #define STACK _STACK
46 #define OSSL_SKVALUE_RTYPE void
47 #define OSSL_MORECONST const
48 #else
49 #define OSSL_SKVALUE_RTYPE char
50 #define OSSL_MORECONST
51 #endif
52 #endif
53 
54 /**
55  * Dynamically load and wrap OpenSSL.
56  *
57  * @author George Staikos <[email protected]>
58  * @see KSSL
59  * @short KDE OpenSSL Wrapper
60  * @internal
61  */
63 {
64 public:
65 
66  /**
67  * Return an instance of class KOpenSSLProxy *
68  * You cannot delete this object. It is a singleton class.
69  */
70  static KOpenSSLProxy *self();
71 
72  /**
73  * Return true of libcrypto was found and loaded
74  */
75  bool hasLibCrypto() const;
76 
77  /**
78  * Return true of libssl was found and loaded
79  */
80  bool hasLibSSL() const;
81 
82  /**
83  * Destroy the class and start over - don't use this unless you know
84  * what you are doing.
85  */
86  void destroy();
87 
88  // Here are the symbols that we need.
89 #if KSSL_HAVE_SSL
90 
91  /*
92  * SSL_connect - initiate the TLS/SSL handshake with an TLS/SSL server
93  */
94  int SSL_connect(SSL *ssl);
95 
96  /*
97  * SSL_accept - initiate the TLS/SSL handshake with an TLS/SSL server
98  */
99  int SSL_accept(SSL *ssl);
100 
101  /*
102  * SSL_get_error - get the error code
103  */
104  int SSL_get_error(SSL *ssl, int rc);
105 
106  /*
107  * SSL_read - read bytes from a TLS/SSL connection.
108  */
109  int SSL_read(SSL *ssl, void *buf, int num);
110 
111  /*
112  * SSL_write - write bytes to a TLS/SSL connection.
113  */
114  int SSL_write(SSL *ssl, const void *buf, int num);
115 
116  /*
117  * SSL_new - create a new SSL structure for a connection
118  */
119  SSL *SSL_new(SSL_CTX *ctx);
120 
121  /*
122  * SSL_free - free an allocated SSL structure
123  */
124  void SSL_free(SSL *ssl);
125 
126  /*
127  * SSL_shutdown - shutdown an allocated SSL connection
128  */
129  int SSL_shutdown(SSL *ssl);
130 
131  /*
132  * SSL_CTX_new - create a new SSL_CTX object as framework for TLS/SSL enabled functions
133  */
134  SSL_CTX *SSL_CTX_new(SSL_METHOD *method);
135 
136  /*
137  * SSL_CTX_free - free an allocated SSL_CTX object
138  */
139  void SSL_CTX_free(SSL_CTX *ctx);
140 
141  /*
142  * SSL_set_fd - connect the SSL object with a file descriptor
143  */
144  int SSL_set_fd(SSL *ssl, int fd);
145 
146  /*
147  * SSL_pending - obtain number of readable bytes buffered in an SSL object
148  */
149  int SSL_pending(SSL *ssl);
150 
151  /*
152  * SSL_peek - obtain bytes buffered in an SSL object
153  */
154  int SSL_peek(SSL *ssl, void *buf, int num);
155 
156  /*
157  * SSL_CTX_set_cipher_list - choose list of available SSL_CIPHERs
158  */
159  int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str);
160 
161  /*
162  * SSL_CTX_set_verify - set peer certificate verification parameters
163  */
164  void SSL_CTX_set_verify(SSL_CTX *ctx, int mode,
165  int (*verify_callback)(int, X509_STORE_CTX *));
166 
167  /*
168  * SSL_use_certificate - load certificate
169  */
170  int SSL_use_certificate(SSL *ssl, X509 *x);
171 
172  /*
173  * SSL_get_current_cipher - get SSL_CIPHER of a connection
174  */
175  SSL_CIPHER *SSL_get_current_cipher(SSL *ssl);
176 
177  /*
178  * SSL_set_options - manipulate SSL engine options
179  * Note: These are all mapped to SSL_ctrl so call them as the comment
180  * specifies but know that they use SSL_ctrl. They are #define
181  * so they will map to the one in this class if called as a
182  * member function of this class.
183  */
184  /* long SSL_set_options(SSL *ssl, long options); */
185  /* Returns 0 if not reused, 1 if session id is reused */
186  /* int SSL_session_reused(SSL *ssl); */
187  long SSL_ctrl(SSL *ssl, int cmd, long larg, char *parg);
188 
189  /*
190  * RAND_egd - set the path to the EGD
191  */
192  int RAND_egd(const char *path);
193 
194  /*
195  * RAND_file_name
196  */
197  const char *RAND_file_name(char *buf, size_t num);
198 
199  /*
200  * RAND_load_file
201  */
202  int RAND_load_file(const char *filename, long max_bytes);
203 
204  /*
205  * RAND_write_file
206  */
207  int RAND_write_file(const char *filename);
208 
209  /*
210  * TLSv1_client_method - return a TLSv1 client method object
211  */
212  SSL_METHOD *TLSv1_client_method();
213 
214  /*
215  * SSLv23_client_method - return a SSLv23 client method object
216  */
217  SSL_METHOD *SSLv23_client_method();
218 
219  /*
220  * SSL_get_peer_certificate - return the peer's certificate
221  */
222  X509 *SSL_get_peer_certificate(SSL *s);
223 
224  /*
225  * SSL_get_peer_cert_chain - get the peer's certificate chain
226  */
227  STACK_OF(X509) *SSL_get_peer_cert_chain(SSL *s);
228 
229  /*
230  * SSL_CIPHER_get_bits - get the number of bits in this cipher
231  */
232  int SSL_CIPHER_get_bits(SSL_CIPHER *c, int *alg_bits);
233 
234  /*
235  * SSL_CIPHER_get_version - get the version of this cipher
236  */
237  char *SSL_CIPHER_get_version(SSL_CIPHER *c);
238 
239  /*
240  * SSL_CIPHER_get_name - get the name of this cipher
241  */
242  const char *SSL_CIPHER_get_name(SSL_CIPHER *c);
243 
244  /*
245  * SSL_CIPHER_description - get the description of this cipher
246  */
247  char *SSL_CIPHER_description(SSL_CIPHER *, char *buf, int size);
248 
249  /*
250  * SSL_CTX_use_PrivateKey - set the private key for the session.
251  * - for use with client certificates
252  */
253  int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey);
254 
255  /*
256  * SSL_CTX_use_certificate - set the client certificate for the session.
257  */
258  int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x);
259 
260  /*
261  * d2i_X509 - Convert a text representation of X509 to an X509 object
262  */
263  X509 *d2i_X509(X509 **a, unsigned char **pp, long length);
264 
265  /*
266  * i2d_X509 - Convert an X509 object into a text representation
267  */
268  int i2d_X509(X509 *a, unsigned char **pp);
269 
270  /*
271  * X509_cmp - compare two X509 objects
272  */
273  int X509_cmp(X509 *a, X509 *b);
274 
275  /*
276  * X509_dup - duplicate an X509 object
277  */
278  X509 *X509_dup(X509 *x509);
279 
280  /*
281  * X509_STORE_CTX_new - create an X509 store context
282  */
283  X509_STORE_CTX *X509_STORE_CTX_new(void);
284 
285  /*
286  * X509_STORE_CTX_free - free up an X509 store context
287  */
288  void X509_STORE_CTX_free(X509_STORE_CTX *v);
289 
290  /*
291  * X509_STORE_CTX_set_chain - set the certificate chain
292  */
293  void X509_STORE_CTX_set_chain(X509_STORE_CTX *v, STACK_OF(X509)* x);
294 
295  /*
296  * X509_STORE_CTX_set_purpose - set the purpose of the certificate
297  */
298  void X509_STORE_CTX_set_purpose(X509_STORE_CTX *v, int purpose);
299 
300  /*
301  * X509_verify_cert - verify the certificate
302  */
303  int X509_verify_cert(X509_STORE_CTX *v);
304 
305  /*
306  * X509_STORE_new - create an X509 store
307  */
308  X509_STORE *X509_STORE_new(void);
309 
310  /*
311  * X509_STORE_free - free up an X509 store
312  */
313  void X509_STORE_free(X509_STORE *v);
314 
315  /*
316  * X509_free - free up an X509
317  */
318  void X509_free(X509 *v);
319 
320  /*
321  * X509_NAME_oneline - return the X509 data in a string
322  */
323  char *X509_NAME_oneline(X509_NAME *a, char *buf, int size);
324 
325  /*
326  * X509_get_subject_name - return the X509_NAME for the subject field
327  */
328  X509_NAME *X509_get_subject_name(X509 *a);
329 
330  /*
331  * X509_get_issuer_name - return the X509_NAME for the issuer field
332  */
333  X509_NAME *X509_get_issuer_name(X509 *a);
334 
335  /*
336  * X509_STORE_add_lookup - add a lookup file/method to an X509 store
337  */
338  X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);
339 
340  /*
341  * X509_LOOKUP_file - Definition of the LOOKUP_file method
342  */
343  X509_LOOKUP_METHOD *X509_LOOKUP_file(void);
344 
345  /*
346  * X509_LOOKUP_free - Free an X509_LOOKUP
347  */
348  void X509_LOOKUP_free(X509_LOOKUP *x);
349 
350  /*
351  * X509_LOOKUP_ctrl - This is not normally called directly (use macros)
352  */
353  int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl, char **ret);
354 
355  /*
356  * X509_STORE_CTX_init - initialize an X509 STORE context
357  */
358  void X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, STACK_OF(X509) *chain);
359 
360  /*
361  * CRYPTO_free - free up an internally allocated object
362  */
363  void CRYPTO_free(void *x);
364 
365  /*
366  * BIO_new - create new BIO
367  */
368  BIO *BIO_new(BIO_METHOD *type);
369 
370  /*
371  * BIO methods - only one defined here yet
372  */
373  BIO_METHOD *BIO_s_mem(void);
374 
375  /*
376  * BIO_new_fp - nastiness called BIO - used to create BIO* from FILE*
377  */
378  BIO *BIO_new_fp(FILE *stream, int close_flag);
379 
380  /*
381  * BIO_new_mem_buf - read only BIO from memory region
382  */
383  BIO *BIO_new_mem_buf(void *buf, int len);
384 
385  /*
386  * BIO_free - nastiness called BIO - used to destroy BIO*
387  */
388  int BIO_free(BIO *a);
389 
390  /*
391  * BIO_ctrl - BIO control method
392  */
393  long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg);
394 
395  /*
396  * BIO_write - equivalent to ::write for BIO
397  */
398  int BIO_write(BIO *b, const void *data, int len);
399 
400  /*
401  * PEM_write_bio_X509 - write a PEM encoded cert to a BIO*
402  */
403  int PEM_write_bio_X509(BIO *bp, X509 *x);
404 
405  /*
406  * ASN1_item_i2d_fp - used for netscape output
407  */
408  int ASN1_item_i2d_fp(FILE *out, unsigned char *x);
409 
410  /*
411  * ASN1_d2i_fp - read an X509 from a DER encoded file (buf can be NULL)
412  */
413  X509 *X509_d2i_fp(FILE *out, X509 **buf);
414 
415  /*
416  * X509_print - print the text form of an X509
417  */
418  int X509_print(FILE *fp, X509 *x);
419 
420  /*
421  * Read a PKCS#12 cert from fp
422  */
423  PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12);
424 
425  /*
426  * Change the password on a PKCS#12 cert
427  */
428  int PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass);
429 
430  /*
431  * Write a PKCS#12 to mem
432  */
433  int i2d_PKCS12(PKCS12 *p12, unsigned char **p);
434 
435  /*
436  * Write a PKCS#12 to FILE*
437  */
438  int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12);
439 
440  /*
441  * Create a new PKCS#12 object
442  */
443  PKCS12 *PKCS12_new(void);
444 
445  /*
446  * Destroy that PKCS#12 that you created!
447  */
448  void PKCS12_free(PKCS12 *a);
449 
450  /*
451  * Parse the PKCS#12
452  */
453  int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey,
454  X509 **cert, STACK_OF(X509) **ca);
455 
456  /*
457  * Free the Private Key
458  */
459  void EVP_PKEY_free(EVP_PKEY *x);
460 
461  /*
462  * Pop off the stack
463  */
464  char *sk_pop(STACK *s);
465 
466  /*
467  * Free the stack
468  */
469  void sk_free(STACK *s);
470 
471 #if OPENSSL_VERSION_NUMBER >= 0x10000000L
472  void sk_free(void *s)
473  {
474  return sk_free(reinterpret_cast<STACK *>(s));
475  }
476 #endif
477 
478  /*
479  * Number of elements in the stack
480  */
481  int sk_num(STACK *s);
482 
483  /*
484  * Value of element n in the stack
485  */
486  char *sk_value(STACK *s, int n);
487 
488 #if OPENSSL_VERSION_NUMBER >= 0x10000000L
489  char *sk_value(void *s, int n)
490  {
491  return sk_value(reinterpret_cast<STACK *>(s), n);
492  }
493 #endif
494 
495  /*
496  * Create a new stack
497  */
498  STACK *sk_new(int (*cmp)());
499 
500  /*
501  * Add an element to the stack
502  */
503  int sk_push(STACK *s, char *d);
504 
505 #if OPENSSL_VERSION_NUMBER >= 0x10000000L
506  int sk_push(void *s, void *d)
507  {
508  return sk_push(reinterpret_cast<STACK *>(s), reinterpret_cast<char *>(d));
509  }
510 #endif
511 
512  /*
513  * Duplicate the stack
514  */
515  STACK *sk_dup(STACK *s);
516 
517  /*
518  * Convert an ASN1_INTEGER to its text form
519  */
520  char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint);
521 
522  /*
523  * Get the certificate's serial number
524  */
525  ASN1_INTEGER *X509_get_serialNumber(X509 *x);
526 
527  /*
528  * Get the certificate's public key
529  */
530  EVP_PKEY *X509_get_pubkey(X509 *x);
531 
532  /*
533  * Convert the public key to a decimal form
534  */
535  int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp);
536 
537  /*
538  * Check the private key of a PKCS bundle against the X509
539  */
540  int X509_check_private_key(X509 *x, EVP_PKEY *p);
541 
542  /*
543  * Convert a BIGNUM to a hex string
544  */
545  char *BN_bn2hex(const BIGNUM *a);
546 
547  /*
548  * Compute the digest of an X.509
549  */
550  int X509_digest(const X509 *x, const EVP_MD *t, unsigned char *md, unsigned int *len);
551 
552  /*
553  * EVP_md5
554  */
555  EVP_MD *EVP_md5();
556 
557  /*
558  * ASN1_INTEGER free
559  */
560  void ASN1_INTEGER_free(ASN1_INTEGER *x);
561 
562  /*
563  * ASN1_STRING_data
564  */
565  unsigned char *ASN1_STRING_data(ASN1_STRING *x);
566 
567  /*
568  * ASN1_STRING_length
569  */
570  int ASN1_STRING_length(ASN1_STRING *x);
571 
572  /*
573  *
574  */
575  int OBJ_obj2nid(ASN1_OBJECT *o);
576 
577  /*
578  *
579  */
580  const char *OBJ_nid2ln(int n);
581 
582  /*
583  * get the number of extensions
584  */
585  int X509_get_ext_count(X509 *x);
586 
587  /*
588  *
589  */
590  int X509_get_ext_by_NID(X509 *x, int nid, int lastpos);
591 
592  /*
593  *
594  */
595  int X509_get_ext_by_OBJ(X509 *x, ASN1_OBJECT *obj, int lastpos);
596 
597  /*
598  *
599  */
600  X509_EXTENSION *X509_get_ext(X509 *x, int loc);
601 
602  /*
603  *
604  */
605  X509_EXTENSION *X509_delete_ext(X509 *x, int loc);
606 
607  /*
608  *
609  */
610  int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);
611 
612  /*
613  *
614  */
615  void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx);
616 
617  /*
618  *
619  */
620  char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5);
621 
622  /*
623  *
624  */
625  int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
626 
627  /*
628  *
629  */
630  PKCS7 *PKCS7_new(void);
631 
632  /*
633  *
634  */
635  void PKCS7_free(PKCS7 *a);
636 
637  /*
638  *
639  */
640  void PKCS7_content_free(PKCS7 *a);
641 
642  /*
643  *
644  */
645  int i2d_PKCS7(PKCS7 *a, unsigned char **pp);
646 
647  /*
648  *
649  */
650  PKCS7 *d2i_PKCS7(PKCS7 **a, unsigned char **pp, long length);
651 
652  /*
653  *
654  */
655  int i2d_PKCS7_fp(FILE *fp, PKCS7 *p7);
656 
657  /*
658  *
659  */
660  PKCS7 *d2i_PKCS7_fp(FILE *fp, PKCS7 **p7);
661 
662  /*
663  *
664  */
665  int i2d_PKCS7_bio(BIO *bp, PKCS7 *p7);
666 
667  /*
668  *
669  */
670  PKCS7 *d2i_PKCS7_bio(BIO *bp, PKCS7 **p7);
671 
672  /*
673  *
674  */
675  PKCS7 *PKCS7_dup(PKCS7 *p7);
676 
677  /*
678  * Create a PKCS7 signature / signed message
679  */
680  PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
681  BIO *data, int flags);
682 
683  /*
684  * Verify a PKCS7 signature.
685  */
686  int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
687  BIO *indata, BIO *out, int flags);
688 
689  /*
690  * Get signers of a verified PKCS7 signature
691  */
692  STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags);
693 
694  /*
695  * PKCS7 encrypt message
696  */
697  PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, EVP_CIPHER *cipher,
698  int flags);
699 
700  /*
701  * decrypt PKCS7 message
702  */
703  int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags);
704 
705  /*
706  * Load a CA list file.
707  */
708  STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);
709 
710  /*
711  * Load a file of PEM encoded objects.
712  */
713  STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
714  pem_password_cb *cb, void *u);
715 
716  /*
717  * Get the number of purposes available
718  */
719  int X509_PURPOSE_get_count();
720 
721  /*
722  * Get the ID of a purpose
723  */
724  int X509_PURPOSE_get_id(X509_PURPOSE *);
725 
726  /*
727  * Check the existence of purpose id "id" in x. for CA, set ca = 1, else 0
728  */
729  int X509_check_purpose(X509 *x, int id, int ca);
730 
731  /*
732  * Get the purpose with index #idx
733  */
734  X509_PURPOSE *X509_PURPOSE_get0(int idx);
735 
736  /*
737  * Create a new Private KEY
738  */
739  EVP_PKEY *EVP_PKEY_new();
740 
741  /*
742  * Assign a private key
743  */
744  int EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key);
745 
746  /*
747  * Generate a RSA key
748  */
749  RSA *RSA_generate_key(int bits, unsigned long e, void
750  (*callback)(int, int, void *), void *cb_arg);
751 
752  /*
753  * Create/destroy a certificate request
754  */
755  X509_REQ *X509_REQ_new();
756  void X509_REQ_free(X509_REQ *a);
757 
758  /*
759  * Set the public key in the REQ object
760  */
761  int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);
762 
763  /* for testing */
764  int i2d_X509_REQ_fp(FILE *fp, X509_REQ *x);
765 
766  /* SMime support */
767  STACK *X509_get1_email(X509 *x);
768  void X509_email_free(STACK *sk);
769 
770  /* Ciphers needed for SMime */
771  EVP_CIPHER *EVP_des_ede3_cbc();
772  EVP_CIPHER *EVP_des_cbc();
773  EVP_CIPHER *EVP_rc2_cbc();
774  EVP_CIPHER *EVP_rc2_64_cbc();
775  EVP_CIPHER *EVP_rc2_40_cbc();
776 
777  /* clear the current error - use this often*/
778  void ERR_clear_error();
779 
780  /* retrieve the latest error */
781  unsigned long ERR_get_error();
782 
783  /* Print the errors to this stream */
784  void ERR_print_errors_fp(FILE *fp);
785 
786  /* Get a pointer to the SSL session id (reference counted) */
787  SSL_SESSION *SSL_get1_session(SSL *ssl);
788 
789  /* Frees a pointer to the SSL session id (reference decremented if needed) */
790  void SSL_SESSION_free(SSL_SESSION *session);
791 
792  /* Set the SSL session to reuse. */
793  int SSL_set_session(SSL *ssl, SSL_SESSION *session);
794 
795  /* Decode ASN.1 to SSL_SESSION */
796  SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp, long length);
797  /* Encode SSL_SESSION to ASN.1 */
798  int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp);
799 
800  /* Write privatekey to FILE stream */
801  int i2d_PrivateKey_fp(FILE *, EVP_PKEY *);
802 
803  /* Write PKCS#8privatekey to FILE stream */
804  int i2d_PKCS8PrivateKey_fp(FILE *, EVP_PKEY *, const EVP_CIPHER *, char *, int, pem_password_cb *, void *);
805 
806  /* Free RSA structure */
807  void RSA_free(RSA *);
808 
809  /* Get a blowfish CBC pointer */
810  EVP_CIPHER *EVP_bf_cbc();
811 
812  /* Sign a CSR */
813  int X509_REQ_sign(X509_REQ *, EVP_PKEY *, const EVP_MD *);
814 
815  /* add a name entry */
816  int X509_NAME_add_entry_by_txt(X509_NAME *, char *, int, unsigned char *, int, int, int);
817 
818  /* Create a name */
819  X509_NAME *X509_NAME_new();
820 
821  /* Set the subject */
822  int X509_REQ_set_subject_name(X509_REQ *, X509_NAME *);
823 
824  /* get list of available SSL_CIPHER's sorted by preference */
825  STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl);
826 
827 #endif
828 
829 private:
830  friend class KOpenSSLProxyPrivate;
831  KOpenSSLProxy();
832  ~KOpenSSLProxy();
833  KOpenSSLProxyPrivate *const d;
834 };
835 
836 #endif
bool hasLibCrypto() const
Return true of libcrypto was found and loaded.
Definition: kopenssl.cpp:222
Dynamically load and wrap OpenSSL.
Definition: kopenssl.h:62
bool hasLibSSL() const
Return true of libssl was found and loaded.
Definition: kopenssl.cpp:217
void destroy()
Destroy the class and start over - don&#39;t use this unless you know what you are doing.
Definition: kopenssl.cpp:227
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Oct 26 2021 22:48:06 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.