XRootD
XrdCryptosslRSA.cc
Go to the documentation of this file.
1 /******************************************************************************/
2 /* */
3 /* X r d C r y p t o S s l R S A . c c */
4 /* */
5 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */
6 /* Produced by Gerri Ganis for CERN */
7 /* */
8 /* This file is part of the XRootD software suite. */
9 /* */
10 /* XRootD is free software: you can redistribute it and/or modify it under */
11 /* the terms of the GNU Lesser General Public License as published by the */
12 /* Free Software Foundation, either version 3 of the License, or (at your */
13 /* option) any later version. */
14 /* */
15 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
16 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
17 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
18 /* License for more details. */
19 /* */
20 /* You should have received a copy of the GNU Lesser General Public License */
21 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
22 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
23 /* */
24 /* The copyright holder's institutional names and contributor's names may not */
25 /* be used to endorse or promote products derived from this software without */
26 /* specific prior written permission of the institution or contributor. */
27 /******************************************************************************/
28 
29 /* ************************************************************************** */
30 /* */
31 /* OpenSSL implementation of XrdCryptoRSA */
32 /* */
33 /* ************************************************************************** */
34 
35 #include "XrdSut/XrdSutRndm.hh"
39 
40 #include <cstring>
41 
42 #include <openssl/bio.h>
43 #include <openssl/err.h>
44 #include <openssl/pem.h>
45 #if OPENSSL_VERSION_NUMBER >= 0x30000000L
46 #include <openssl/core_names.h>
47 #endif
48 
49 #if OPENSSL_VERSION_NUMBER < 0x10100000L
50 static RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
51 {
52  if (pkey->type != EVP_PKEY_RSA) {
53  return NULL;
54  }
55  return pkey->pkey.rsa;
56 }
57 
58 static void RSA_get0_key(const RSA *r,
59  const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
60 {
61  if (n != NULL)
62  *n = r->n;
63  if (e != NULL)
64  *e = r->e;
65  if (d != NULL)
66  *d = r->d;
67 }
68 #endif
69 
70 static int XrdCheckRSA (EVP_PKEY *pkey) {
71  int rc;
72 #if OPENSSL_VERSION_NUMBER < 0x10101000L
73  RSA *rsa = EVP_PKEY_get0_RSA(pkey);
74  if (rsa)
75  rc = RSA_check_key(rsa);
76  else
77  rc = -2;
78 #else
79  EVP_PKEY_CTX *ckctx = EVP_PKEY_CTX_new(pkey, 0);
80  rc = EVP_PKEY_check(ckctx);
81  EVP_PKEY_CTX_free(ckctx);
82 #endif
83  return rc;
84 }
85 
86 //_____________________________________________________________________________
88 {
89  // Constructor
90  // Generate a RSA asymmetric key pair
91  // Length will be 'bits' bits (min 2048, default 2048), public
92  // exponent `pubex` (default 65537).
93  EPNAME("RSA::XrdCryptosslRSA");
94 
95  publen = -1;
96  prilen = -1;
97 
98  // Minimum is XrdCryptoMinRSABits
99  bits = (bits >= XrdCryptoMinRSABits) ? bits : XrdCryptoDefRSABits;
100 
101  // If pubex is not odd, use default
102  if (!(exp & 1))
103  exp = XrdCryptoDefRSAExp; // 65537 (0x10001)
104 
105  DEBUG("bits: "<<bits<<", exp: "<<exp);
106 
107  // Try Key Generation
108  BIGNUM *e = BN_new();
109  if (!e) {
110  DEBUG("cannot allocate new exponent");
111  return;
112  }
113 
114  BN_set_word(e, exp);
115 
116  EVP_PKEY_CTX *pkctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, 0);
117  EVP_PKEY_keygen_init(pkctx);
118  EVP_PKEY_CTX_set_rsa_keygen_bits(pkctx, bits);
119 #if OPENSSL_VERSION_NUMBER >= 0x30000000L
120  EVP_PKEY_CTX_set1_rsa_keygen_pubexp(pkctx, e);
121  BN_free(e);
122 #else
123  EVP_PKEY_CTX_set_rsa_keygen_pubexp(pkctx, e);
124 #endif
125  EVP_PKEY_keygen(pkctx, &fEVP);
126  EVP_PKEY_CTX_free(pkctx);
127 
128  // Update status flag
129  if (fEVP) {
130  if (XrdCheckRSA(fEVP) == 1) {
131  status = kComplete;
132  DEBUG("basic length: "<<EVP_PKEY_size(fEVP)<<" bytes");
133  } else {
134  DEBUG("WARNING: generated key is invalid");
135  // Generated an invalid key: cleanup
136  EVP_PKEY_free(fEVP);
137  fEVP = 0;
138  }
139  }
140 }
141 
142 //_____________________________________________________________________________
143 XrdCryptosslRSA::XrdCryptosslRSA(const char *pub, int lpub)
144 {
145  // Constructor
146  // Allocate a RSA key pair and fill the public part importing
147  // from string representation (pub) to internal representation.
148  // If lpub>0 use the first lpub bytes; otherwise use strlen(pub)
149  // bytes.
150 
151  fEVP = 0;
152  publen = -1;
153  prilen = -1;
154 
155  // Import key
156  ImportPublic(pub,lpub);
157 }
158 
159 //_____________________________________________________________________________
160 XrdCryptosslRSA::XrdCryptosslRSA(EVP_PKEY *key, bool check)
161 {
162  // Constructor to import existing key
163  EPNAME("RSA::XrdCryptosslRSA_key");
164 
165  fEVP = 0;
166  publen = -1;
167  prilen = -1;
168 
169  // Create container, first
170  if (!key) {
171  DEBUG("no input key");
172  return;
173  }
174 
175  if (check) {
176  // Check consistency
177  if (XrdCheckRSA(key) == 1) {
178  fEVP = key;
179  // Update status
180  status = kComplete;
181  } else {
182  DEBUG("key contains inconsistent information");
183  }
184  } else {
185  // Accept in any case (for incomplete keys)
186  fEVP = key;
187  // Update status
188  status = kPublic;
189  }
190 }
191 
192 
193 //____________________________________________________________________________
195 {
196  // Copy Constructor
197  EPNAME("RSA::XrdCryptosslRSA_copy");
198 
199  fEVP = 0;
200  publen = -1;
201  prilen = -1;
202 
203  if (!r.fEVP) {
204  DEBUG("input key is empty");
205  return;
206  }
207 
208  // If the given key is set, copy it via a bio
209 #if OPENSSL_VERSION_NUMBER >= 0x30000000L
210  BIGNUM *d = BN_new();
211  bool publiconly =
212  (EVP_PKEY_get_bn_param(r.fEVP, OSSL_PKEY_PARAM_RSA_D, &d) != 1);
213  BN_free(d);
214 #else
215  const BIGNUM *d = 0;
216  RSA_get0_key(EVP_PKEY_get0_RSA(r.fEVP), 0, 0, &d);
217  bool publiconly = (d == 0);
218 #endif
219  //
220  // Bio for exporting the pub key
221  BIO *bcpy = BIO_new(BIO_s_mem());
222  if (bcpy) {
223  bool ok;
224  if (publiconly) {
225  // Write kref public key to BIO
226  ok = (PEM_write_bio_PUBKEY(bcpy, r.fEVP) != 0);
227  } else {
228  // Write kref private key to BIO
229  ok = (PEM_write_bio_PrivateKey(bcpy,r.fEVP,0,0,0,0,0) != 0);
230  }
231  if (ok) {
232  if (publiconly) {
233  // Read public key from BIO
234  if ((fEVP = PEM_read_bio_PUBKEY(bcpy, 0, 0, 0))) {
235  status = kPublic;
236  }
237  } else {
238  if ((fEVP = PEM_read_bio_PrivateKey(bcpy,0,0,0))) {
239  // Check consistency only if original was not marked complete
240  if (r.status == kComplete || XrdCheckRSA(fEVP) == 1) {
241  // Update status
242  status = kComplete;
243  }
244  }
245  }
246  }
247  // Cleanup bio
248  BIO_free(bcpy);
249  }
250 }
251 
252 //_____________________________________________________________________________
254 {
255  // Destructor
256  // Destroy the RSA asymmetric key pair
257 
258  if (fEVP)
259  EVP_PKEY_free(fEVP);
260  fEVP = 0;
261 }
262 
263 //_____________________________________________________________________________
265 {
266  // Get minimal length of output buffer
267 
268  int lcmax = EVP_PKEY_size(fEVP) - 42;
269 
270  return ((lin / lcmax) + 1) * EVP_PKEY_size(fEVP);
271 }
272 
273 //_____________________________________________________________________________
274 int XrdCryptosslRSA::ImportPublic(const char *pub, int lpub)
275 {
276  // Import a public key
277  // Allocate a RSA key pair and fill the public part importing
278  // from string representation (pub) to internal representation.
279  // If lpub>0 use the first lpub bytes; otherwise use strlen(pub)
280  // bytes.
281  // Return 0 in case of success, -1 in case of failure
282 
283  int rc = -1;
284  if (fEVP)
285  EVP_PKEY_free(fEVP);
286  fEVP = 0;
287  publen = -1;
288  prilen = -1;
289 
290  // Temporary key
291  EVP_PKEY *keytmp = 0;
292 
293  // Bio for exporting the pub key
294  BIO *bpub = BIO_new(BIO_s_mem());
295 
296  // Check length
297  lpub = (lpub <= 0) ? strlen(pub) : lpub;
298 
299  // Write key from pubexport to BIO
300  BIO_write(bpub,(void *)pub,lpub);
301 
302  // Read pub key from BIO
303  if ((keytmp = PEM_read_bio_PUBKEY(bpub, 0, 0, 0))) {
304  fEVP = keytmp;
305  // Update status
306  status = kPublic;
307  rc = 0;
308  }
309  BIO_free(bpub);
310  return rc;
311 }
312 
313 //_____________________________________________________________________________
314 int XrdCryptosslRSA::ImportPrivate(const char *pri, int lpri)
315 {
316  // Import a private key
317  // Fill the private part importing from string representation (pub) to
318  // internal representation.
319  // If lpub>0 use the first lpub bytes; otherwise use strlen(pub)
320  // bytes.
321  // Return 0 in case of success, -1 in case of failure
322 
323  if (!fEVP)
324  return -1;
325 
326  int rc = -1;
327  prilen = -1;
328 
329  // Bio for exporting the pub key
330  BIO *bpri = BIO_new(BIO_s_mem());
331 
332  // Check length
333  lpri = (lpri <= 0) ? strlen(pri) : lpri;
334 
335  // Write key from private export to BIO
336  BIO_write(bpri,(void *)pri,lpri);
337 
338  // Read private key from BIO
339  if (PEM_read_bio_PrivateKey(bpri, &fEVP, 0, 0)) {
340  // Update status
341  status = kComplete;
342  rc = 0;
343  }
344  BIO_free(bpri);
345  return rc;
346 }
347 
348 //_____________________________________________________________________________
350 {
351  // Dump some info about the key
352  EPNAME("RSA::Dump");
353 
354  DEBUG("---------------------------------------");
355  DEBUG("address: "<<this);
356  if (IsValid()) {
357  char *btmp = new char[GetPublen()+1];
358  if (btmp) {
359  ExportPublic(btmp,GetPublen()+1);
360  DEBUG("export pub key:"<<std::endl<<btmp);
361  delete[] btmp;
362  } else {
363  DEBUG("cannot allocate memory for public key");
364  }
365  } else {
366  DEBUG("key is invalid");
367  }
368  DEBUG("---------------------------------------");
369 }
370 
371 //_____________________________________________________________________________
373 {
374  // Minimum length of export format of public key
375 
376  if (publen < 0) {
377  // Bio for exporting the pub key
378  BIO *bkey = BIO_new(BIO_s_mem());
379  // Write public key to BIO
380  PEM_write_bio_PUBKEY(bkey,fEVP);
381  // data length
382  char *cbio = 0;
383  publen = (int) BIO_get_mem_data(bkey, &cbio);
384  BIO_free(bkey);
385  }
386  return publen;
387 }
388 //_____________________________________________________________________________
389 int XrdCryptosslRSA::ExportPublic(char *out, int)
390 {
391  // Export the public key into buffer out. The length of the buffer should be
392  // at least GetPublen()+1 bytes. The buffer out must be passed-by and it
393  // responsability-of the caller.
394  // Return 0 in case of success, -1 in case of failure
395  EPNAME("RSA::ExportPublic");
396 
397  // Make sure we have a valid key
398  if (!IsValid()) {
399  DEBUG("key not valid");
400  return -1;
401  }
402 
403  // Check output buffer
404  if (!out) {
405  DEBUG("output buffer undefined!");
406  return -1;
407  }
408 
409  // Bio for exporting the pub key
410  BIO *bkey = BIO_new(BIO_s_mem());
411 
412  // Write public key to BIO
413  PEM_write_bio_PUBKEY(bkey,fEVP);
414 
415  // data length
416  char *cbio = 0;
417  int lbio = (int) BIO_get_mem_data(bkey, &cbio);
418  if (lbio <= 0 || !cbio) {
419  DEBUG("problems attaching to BIO content");
420  return -1;
421  }
422 
423  // Read key from BIO to buf
424  memcpy(out, cbio, lbio);
425  // Null terminate
426  out[lbio] = 0;
427  DEBUG("("<<lbio<<" bytes) "<< std::endl <<out);
428  BIO_free(bkey);
429 
430  return 0;
431 }
432 
433 //_____________________________________________________________________________
435 {
436  // Minimum length of export format of private key
437 
438  if (prilen < 0) {
439  // Bio for exporting the private key
440  BIO *bkey = BIO_new(BIO_s_mem());
441  // Write public key to BIO
442  PEM_write_bio_PrivateKey(bkey,fEVP,0,0,0,0,0);
443  // data length
444  char *cbio = 0;
445  prilen = (int) BIO_get_mem_data(bkey, &cbio);
446  BIO_free(bkey);
447  }
448  return prilen;
449 }
450 
451 //_____________________________________________________________________________
453 {
454  // Export the private key into buffer out. The length of the buffer should be
455  // at least GetPrilen()+1 bytes. The buffer out must be passed-by and it
456  // responsability-of the caller.
457  // Return 0 in case of success, -1 in case of failure
458  EPNAME("RSA::ExportPrivate");
459 
460  // Make sure we have a valid key
461  if (!IsValid()) {
462  DEBUG("key not valid");
463  return -1;
464  }
465 
466  // Check output buffer
467  if (!out) {
468  DEBUG("output buffer undefined!");
469  return -1;
470  }
471 
472  // Bio for exporting the pub key
473  BIO *bkey = BIO_new(BIO_s_mem());
474 
475  // Write public key to BIO
476  PEM_write_bio_PrivateKey(bkey,fEVP,0,0,0,0,0);
477 
478  // data length
479  char *cbio = 0;
480  int lbio = (int) BIO_get_mem_data(bkey, &cbio);
481  if (lbio <= 0 || !cbio) {
482  DEBUG("problems attaching to BIO content");
483  return -1;
484  }
485 
486  // Read key from BIO to buf
487  memcpy(out, cbio, lbio);
488  // Null terminate
489  out[lbio] = 0;
490  DEBUG("("<<lbio<<" bytes) "<< std::endl <<out);
491  BIO_free(bkey);
492 
493  return 0;
494 }
495 
496 //_____________________________________________________________________________
497 int XrdCryptosslRSA::EncryptPrivate(const char *in, int lin, char *out, int loutmax)
498 {
499  // Encrypt lin bytes at 'in' using the internal private key.
500  // The output buffer 'out' is allocated by the caller for max lout bytes.
501  // The number of meaningful bytes in out is returned in case of success
502  // (never larger that loutmax); -1 in case of error.
503  EPNAME("RSA::EncryptPrivate");
504 
505  // Make sure we got something to encrypt
506  if (!in || lin <= 0) {
507  DEBUG("input buffer undefined");
508  return -1;
509  }
510 
511  // Make sure we got a buffer where to write
512  if (!out || loutmax <= 0) {
513  DEBUG("output buffer undefined");
514  return -1;
515  }
516 
517  //
518  // Private encoding ...
519  size_t lcmax = EVP_PKEY_size(fEVP) - 11; // Magic number (= 2*sha1_outlen + 2)
520  size_t lout = 0;
521  size_t len = lin;
522  int kk = 0;
523  int ke = 0;
524 
525  EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(fEVP, 0);
526  EVP_PKEY_sign_init(ctx);
527  EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING);
528  while (len > 0 && ke <= int(loutmax - lout)) {
529  size_t lc = (len > lcmax) ? lcmax : len;
530  lout = loutmax - ke;
531  if (EVP_PKEY_sign(ctx, (unsigned char *)&out[ke], &lout,
532  (unsigned char *)&in[kk], lc) <= 0) {
533  EVP_PKEY_CTX_free(ctx);
534  char serr[120];
535  ERR_error_string(ERR_get_error(), serr);
536  DEBUG("error: " <<serr);
537  return -1;
538  }
539  kk += lc;
540  ke += lout;
541  len -= lc;
542  }
543  EVP_PKEY_CTX_free(ctx);
544  if (len > 0 && ke > int(loutmax - lout))
545  DEBUG("buffer truncated");
546  lout = ke;
547 
548  return lout;
549 }
550 
551 //_____________________________________________________________________________
552 int XrdCryptosslRSA::EncryptPublic(const char *in, int lin, char *out, int loutmax)
553 {
554  // Encrypt lin bytes at 'in' using the internal public key.
555  // The output buffer 'out' is allocated by the caller for max lout bytes.
556  // The number of meaningful bytes in out is returned in case of success
557  // (never larger that loutmax); -1 in case of error.
558  EPNAME("RSA::EncryptPublic");
559 
560  // Make sure we got something to encrypt
561  if (!in || lin <= 0) {
562  DEBUG("input buffer undefined");
563  return -1;
564  }
565 
566  // Make sure we got a buffer where to write
567  if (!out || loutmax <= 0) {
568  DEBUG("output buffer undefined");
569  return -1;
570  }
571 
572  //
573  // Public encoding ...
574  size_t lcmax = EVP_PKEY_size(fEVP) - 42; // Magic number (= 2*sha1_outlen + 2)
575  size_t lout = 0;
576  size_t len = lin;
577  int kk = 0;
578  int ke = 0;
579 
580  EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(fEVP, 0);
581  EVP_PKEY_encrypt_init(ctx);
582  EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_OAEP_PADDING);
583  while (len > 0 && ke <= int(loutmax - lout)) {
584  size_t lc = (len > lcmax) ? lcmax : len;
585  lout = loutmax - ke;
586  if (EVP_PKEY_encrypt(ctx, (unsigned char *)&out[ke], &lout,
587  (unsigned char *)&in[kk], lc) <= 0) {
588  EVP_PKEY_CTX_free(ctx);
589  char serr[120];
590  ERR_error_string(ERR_get_error(), serr);
591  DEBUG("error: " <<serr);
592  return -1;
593  }
594  kk += lc;
595  ke += lout;
596  len -= lc;
597  }
598  EVP_PKEY_CTX_free(ctx);
599  if (len > 0 && ke > int(loutmax - lout))
600  DEBUG("buffer truncated");
601  lout = ke;
602 
603  return lout;
604 }
605 
606 //_____________________________________________________________________________
607 int XrdCryptosslRSA::DecryptPrivate(const char *in, int lin, char *out, int loutmax)
608 {
609  // Decrypt lin bytes at 'in' using the internal private key
610  // The output buffer 'out' is allocated by the caller for max lout bytes.
611  // The number of meaningful bytes in out is returned in case of success
612  // (never larger that loutmax); -1 in case of error.
613  EPNAME("RSA::DecryptPrivate");
614 
615  // Make sure we got something to decrypt
616  if (!in || lin <= 0) {
617  DEBUG("input buffer undefined");
618  return -1;
619  }
620 
621  // Make sure we got a buffer where to write
622  if (!out || loutmax <= 0) {
623  DEBUG("output buffer undefined");
624  return -1;
625  }
626 
627  size_t lout = 0;
628  size_t len = lin;
629  size_t lcmax = EVP_PKEY_size(fEVP);
630  int kk = 0;
631  int ke = 0;
632 
633  //
634  // Private decoding ...
635  EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(fEVP, 0);
636  EVP_PKEY_decrypt_init(ctx);
637  EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_OAEP_PADDING);
638  while (len > 0 && ke <= int(loutmax - lout)) {
639  lout = loutmax - ke;
640  if (EVP_PKEY_decrypt(ctx, (unsigned char *)&out[ke], &lout,
641  (unsigned char *)&in[kk], lcmax) <= 0) {
642  EVP_PKEY_CTX_free(ctx);
643  char serr[120];
644  ERR_error_string(ERR_get_error(), serr);
645  DEBUG("error: " <<serr);
646  return -1;
647  }
648  kk += lcmax;
649  len -= lcmax;
650  ke += lout;
651  }
652  EVP_PKEY_CTX_free(ctx);
653  if (len > 0 && ke > int(loutmax - lout))
654  PRINT("buffer truncated");
655  lout = ke;
656 
657  return lout;
658 }
659 
660 //_____________________________________________________________________________
661 int XrdCryptosslRSA::DecryptPublic(const char *in, int lin, char *out, int loutmax)
662 {
663  // Decrypt lin bytes at 'in' using the internal public key
664  // The output buffer 'out' is allocated by the caller for max lout bytes.
665  // The number of meaningful bytes in out is returned in case of success
666  // (never larger that loutmax); -1 in case of error.
667  EPNAME("RSA::DecryptPublic");
668 
669  // Make sure we got something to decrypt
670  if (!in || lin <= 0) {
671  DEBUG("input buffer undefined");
672  return -1;
673  }
674 
675  // Make sure we got a buffer where to write
676  if (!out || loutmax <= 0) {
677  DEBUG("output buffer undefined");
678  return -1;
679  }
680 
681  size_t lout = 0;
682  size_t len = lin;
683  size_t lcmax = EVP_PKEY_size(fEVP);
684  int kk = 0;
685  int ke = 0;
686 
687  //
688  // Private decoding ...
689  EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(fEVP, 0);
690  EVP_PKEY_verify_recover_init(ctx);
691  EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING);
692  while (len > 0 && ke <= int(loutmax - lout)) {
693  lout = loutmax - ke;
694  if (EVP_PKEY_verify_recover(ctx, (unsigned char *)&out[ke], &lout,
695  (unsigned char *)&in[kk], lcmax) <= 0) {
696  EVP_PKEY_CTX_free(ctx);
697  char serr[120];
698  ERR_error_string(ERR_get_error(), serr);
699  PRINT("error: " <<serr);
700  return -1;
701  }
702  kk += lcmax;
703  len -= lcmax;
704  ke += lout;
705  }
706  EVP_PKEY_CTX_free(ctx);
707  if (len > 0 && ke > int(loutmax - lout))
708  PRINT("buffer truncated");
709  lout = ke;
710 
711  return lout;
712 }
#define DEBUG(x)
Definition: XrdBwmTrace.hh:54
#define EPNAME(x)
Definition: XrdBwmTrace.hh:56
#define XrdCryptoMinRSABits
Definition: XrdCryptoAux.hh:52
#define XrdCryptoDefRSAExp
Definition: XrdCryptoAux.hh:54
#define XrdCryptoDefRSABits
Definition: XrdCryptoAux.hh:53
static int XrdCheckRSA(EVP_PKEY *pkey)
static void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
static RSA * EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
#define PRINT(y)
ERSAStatus status
Definition: XrdCryptoRSA.hh:58
bool IsValid()
Definition: XrdCryptoRSA.hh:69
int EncryptPrivate(const char *in, int lin, char *out, int lout)
int ExportPublic(char *out, int lout)
int ImportPublic(const char *in, int lin)
XrdCryptosslRSA(int bits=XrdCryptoMinRSABits, int exp=XrdCryptoDefRSAExp)
int DecryptPrivate(const char *in, int lin, char *out, int lout)
int ExportPrivate(char *out, int lout)
int ImportPrivate(const char *in, int lin)
int GetOutlen(int lin)
virtual ~XrdCryptosslRSA()
int EncryptPublic(const char *in, int lin, char *out, int lout)
int DecryptPublic(const char *in, int lin, char *out, int lout)