HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_RSA.h
Go to the documentation of this file.
1 // RSA public key encryption
2 
3 #ifndef __UT_RSA__
4 #define __UT_RSA__
5 
6 #include "UT_API.h"
7 #include "UT_VeryLong.h"
8 
10 {
11 public:
12  UT_VeryLong myM; // My modulus
13  UT_VeryLong myE; // My public exponent
14 
15  // Requires 0 <= plain < m
16  UT_VeryLong encrypt( const UT_VeryLong &plain );
17  void encrypt(unsigned char *dest, const unsigned char *src,
18  unsigned &len);
19 
20  void setE(const unsigned *e, int ewords);
21  void setM(const unsigned *m, int mwords);
22  void setE(UT_VeryLong &e) { myE = e; }
23  void setM(UT_VeryLong &m) { myM = m; }
24 };
25 
27 {
28 public:
29  UT_VeryLong myD; // My private key
30  UT_VeryLong decrypt(const UT_VeryLong &cipher);
31  void decrypt(unsigned char *dest, const unsigned char *src,
32  unsigned &len);
33 
34  void setPassword(const char *passwd);
35  // r1 and r2 should be null terminated random strings
36  // each of length around 35 characters (for a 500 bit modulus)
37  void create(const char *r1, const char *r2, const char *passwd);
38  void setD(const unsigned *d, int dwords);
39  void setD(UT_VeryLong &d) { myD = d; }
40 
41  // Print code containing modulus and public/private keys
42  void printCode();
43 };
44 
45 #endif
46 
UT_VeryLong myD
Definition: UT_RSA.h:29
void setM(UT_VeryLong &m)
Definition: UT_RSA.h:23
UT_VeryLong myE
Definition: UT_RSA.h:13
#define UT_API
Definition: UT_API.h:12
void setE(UT_VeryLong &e)
Definition: UT_RSA.h:22
UT_VeryLong myM
Definition: UT_RSA.h:12
void setD(UT_VeryLong &d)
Definition: UT_RSA.h:39
GLenum src
Definition: glcorearb.h:1792