From 852dc2056835679e2beb4b1ee9bfe4385ab27bf2 Mon Sep 17 00:00:00 2001
From: open-license-manager <rillf@maildrop.cc>
Date: 周一, 13 10月 2014 00:28:17 +0800
Subject: [PATCH] windows

---
 src/tools/base_lib/win/CryptoHelperWindows.h |   80 ++++++++++++++++++++++-----------------
 1 files changed, 45 insertions(+), 35 deletions(-)

diff --git a/src/tools/base_lib/win/CryptoHelperWindows.h b/src/tools/base_lib/win/CryptoHelperWindows.h
index 293f4e9..e0e8753 100644
--- a/src/tools/base_lib/win/CryptoHelperWindows.h
+++ b/src/tools/base_lib/win/CryptoHelperWindows.h
@@ -1,35 +1,45 @@
-/*
- * CryptoHelperWindows.h
- *
- *  Created on: Sep 14, 2014
- *
- */
-
-#ifndef CRYPTOHELPERWINDOWS_H_
-#define CRYPTOHELPERWINDOWS_H_
-
-#define _WIN32_WINNT 0x0400
-#include <windows.h>
-#include <wincrypt.h>
-#include <tchar.h>
-#include "../CryptoHelper.h"
-
-namespace license {
-
-class CryptoHelperWindows: public CryptoHelper {
-public:
-	CryptoHelperWindows();
-
-	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 ~CryptoHelperWindows();
-};
-
-} /* namespace license */
-
-#endif /* CRYPTOHELPERWINDOWS_H_ */
+/*
+ * CryptoHelperWindows.h
+ *
+ *  Created on: Sep 14, 2014
+ *
+ */
+
+#ifndef CRYPTOHELPERWINDOWS_H_
+#define CRYPTOHELPERWINDOWS_H_
+
+//#define _WIN32_WINNT 0x0400
+#include <windows.h>
+#include <wincrypt.h>
+#include <tchar.h>
+#include <string>
+#include "../CryptoHelper.h"
+
+
+
+namespace license {
+using namespace std;
+
+class CryptoHelperWindows: public CryptoHelper {
+private :
+	void acquireContext();
+	//	Handle to the cryptography provider.
+	HCRYPTPROV m_hCryptProv;
+	//	Handle to the cryptography key.
+	HCRYPTKEY m_hCryptKey;
+public:
+	CryptoHelperWindows();
+
+	virtual void generateKeyPair();
+	virtual const string exportPrivateKey() const;
+	virtual const string exportPublicKey() const;
+
+	virtual const string signString(const void* privateKey, size_t pklen,
+			const string& license) const;
+
+	virtual ~CryptoHelperWindows();
+};
+
+} /* namespace license */
+
+#endif /* CRYPTOHELPERWINDOWS_H_ */

--
Gitblit v1.9.1