open-license-manager
2014-09-16 1e166c13aaabe8d2aad1d604c77020a14dc577cd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * CryptpHelperLinux.h
 *
 *  Created on: Sep 14, 2014
 *      
 */
 
#ifndef CRYPTPHELPERLINUX_H_
#define CRYPTPHELPERLINUX_H_
#include <openssl/rsa.h>
#include <cstddef>
#include <string>
 
namespace license {
using namespace std;
 
class CryptoHelperLinux {
private:
    static const int kBits = 1024;
    static const int kExp = 65537;
    RSA * rsa;
    const string Opensslb64Encode(size_t slen, unsigned char* signature) const;
public:
    CryptoHelperLinux();
 
    virtual void generateKeyPair();
    virtual const string exportPrivateKey() const;
    virtual const string exportPublicKey() const;
 
    virtual string signString(const void* privateKey, size_t pklen,
            const string& license) const;
    virtual ~CryptoHelperLinux();
};
 
} /* namespace license */
 
#endif /* CRYPTPHELPERLINUX_H_ */