| | |
| | | KEYLENGTH | CRYPT_EXPORTABLE, &m_hCryptKey)) {
|
| | | dwErrCode = GetLastError();
|
| | | throw logic_error(
|
| | | string("Error generating keys ") + to_string(dwErrCode));
|
| | | string("Error generating keys ") + to_string(static_cast<long long>(dwErrCode)));
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | dwErrCode = GetLastError();
|
| | | throw logic_error(
|
| | | string("Error calculating size of public key ")
|
| | | + to_string(dwErrCode));
|
| | | + to_string(static_cast<long long>(dwErrCode)));
|
| | | }
|
| | | // Allocate memory for the pbKeyBlob.
|
| | | if ((pbKeyBlob = new BYTE[dwBlobLen]) == NULL) {
|
| | |
| | | delete pbKeyBlob;
|
| | | dwErrCode = GetLastError();
|
| | | throw logic_error(
|
| | | string("Error exporting public key ") + to_string(dwErrCode));
|
| | | string("Error exporting public key ") + to_string(static_cast<long long>(dwErrCode)));
|
| | | } else {
|
| | | ss << "\t";
|
| | | for (unsigned int i = 0; i < dwBlobLen; i++) {
|
| | |
| | | ss << "\\" << endl << "\t";
|
| | | }
|
| | | }
|
| | | ss << to_string(pbKeyBlob[i]);
|
| | | ss << to_string(static_cast<long long>(pbKeyBlob[i]));
|
| | | }
|
| | | delete pbKeyBlob;
|
| | | }
|
| | |
| | | dwErrCode = GetLastError();
|
| | | throw logic_error(
|
| | | string("Error calculating size of private key ")
|
| | | + to_string(dwErrCode));
|
| | | + to_string(static_cast<long long>(dwErrCode)));
|
| | | }
|
| | | // Allocate memory for the pbKeyBlob.
|
| | | if ((pbKeyBlob = new BYTE[dwBlobLen]) == NULL) {
|
| | |
| | | delete pbKeyBlob;
|
| | | dwErrCode = GetLastError();
|
| | | throw logic_error(
|
| | | string("Error exporting private key ") + to_string(dwErrCode));
|
| | | string("Error exporting private key ") + to_string(static_cast<long long>(dwErrCode)));
|
| | | } else {
|
| | | ss << "\t";
|
| | | for (unsigned int i = 0; i < dwBlobLen; i++) {
|
| | |
| | | ss << "\\" << endl << "\t";
|
| | | }
|
| | | }
|
| | | ss << to_string(pbKeyBlob[i]);
|
| | | ss << to_string(static_cast<long long>(pbKeyBlob[i]));
|
| | | }
|
| | | delete pbKeyBlob;
|
| | | }
|
| | |
| | | &hKey)) {
|
| | | throw logic_error(
|
| | | string("Error in importing the PrivateKey ")
|
| | | + to_string(GetLastError()));
|
| | | + to_string(static_cast<long long>(GetLastError())));
|
| | | }
|
| | |
|
| | | //-------------------------------------------------------------------
|