00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00026 #ifndef FADE_POLICY_FOR_CLIENT_H
00027 #define FADE_POLICY_FOR_CLIENT_H
00028
00029 #include <string>
00030 #include <openssl/rsa.h>
00031
00032 using namespace std;
00033
00037 class PolicyForClient
00038 {
00039 string policyName;
00040 RSA *rsa;
00041 BN_CTX *ctx;
00042 bool hasPublicKey() const;
00043 bool getPublicKey(bool allowNewPolicy) const;
00044 public:
00048 PolicyForClient(const string &policyName);
00049
00050 ~PolicyForClient()
00051 {
00052 RSA_free(rsa);
00053 BN_CTX_free(ctx);
00054 }
00055
00060 string getPolicyName() const
00061 {
00062 return policyName;
00063 }
00064
00069 void setPolicyName(const string &policyName)
00070 {
00071 this->policyName = policyName;
00072 }
00073
00078 int getRSASize() const
00079 {
00080 return 128;
00081 }
00082
00089 bool encrypt(unsigned char *key) const;
00090
00097 bool decrypt(unsigned char *key) const;
00098 };
00099
00100 #endif