Hi! How do I calculate the value of dwBloblen of pbKeyBlob read from a file.Even if i use the number of byted read returned from the CFile read function the key import function fail.How does the know the receiving side know the size of KEYBLOB. ////read KEYBLOB from a received file CFile file; BYTE *pbKeyBlob1 = NULL; DWORD dwBlobLen1=512; //just for testing but doesnt work for RSA //signature pbKeyBlob1 = (BYTE*)malloc(dwBlobLen1); // Read the key BLOB from the file. if(file.Open("key.txt",CFile::modeRead)) { file.Read(pbKeyBlob1,dwBlobLen1); file.Close(); } // call CryptImportKey if(CryptImportKey( hProv, pbKeyBlob1, dwBlobLen1, 0, 0, &hPubKey)) { MessageBox("The key has been imported"); } else { MessageBox("The key import failed"); }
User 2070738
Posts
-
cryptImportkey -
HexEncoder class to CStringThnx for (late) reply but ive done it and through the same method as u told. Since Im stuck in cryptography stuff nad Im using CryptoAPI Ive some data of type BYTE* (PUBLICKEYBLOB)I want to write it in a file then send it across the network and then read from file and use that public key.SIGH!!!! now to write it in the file i covert BYTE* to CHAR* and then inverse to read ...but to dont get the same value back. Do u have any better idea to do this?? Thanx again for ur help.
-
HexEncoder class to CStringOK as u suggested i used ostringstream to store hex vaue as a string and then convert it into a CString form to show in the edit control of dialog box.It gives no error but at the time of execution of this code "illegal operation error" message box is displayed.Where Im doing wrong? std::string s(""); ECDSA sig1(sk, OS2IP(hash)); // generate the signature DER der_str (sig1); //DER class function HexEncoder hex_str(der_str); //Hexencoder class function std::ostringstream str; str<SetWindowText(cs); Hope ull reply soon.
-
HexEncoder class to CStringOK as u suggested i used ostringstream to store hex vaue as a string and then convert it into a CString form to show in the edit control of dialog box.It gives no error but at the time of execution of this code "illegal operation error" message box is displayed.Where Im doing wrong? std::string s(""); ECDSA sig1(sk, OS2IP(hash)); // generate the signature DER der_str (sig1); //DER class function HexEncoder hex_str(der_str); //Hexencoder class function std::ostringstream str; str<(GetDlgItem(IDC_EDIT3)); poEdit->SetWindowText(cs);
-
HexEncoder class to CStringYup it worked fine...thanx.But that converts Octant string to Hex String....here i want to convert Hexadecimal to char* or CString to show in edit box....I dont know if the same method can be applied here?
-
HexEncoder class to CStringIm using boZoi library to implement Elliptic curve cryptography to my VC project.The functions output r in the format of hexadecimal and OCTETSTR(octant string) now if i want to show the output in the edit box control of a dialog box...???. ECDSA sig; HexEncoder hex(sig); CEdit* poEdit = static_cast(GetDlgItem(IDC_EDIT3)); poEdit->SetWindowText(hex); HexEncoder is a class which converts to hexadecimal format & i want to convert it converted to CString or LPCTSTR...How i do that? borZoi can be found at: http://dragongate-technologies.com/products.html[^]
-
linking errosIf I remove these two functions i.e use_NIST_B_163 (); EC_Domain_Parameters dp = NIST_B_163; I dont get any link errors. another thing is that the library Im using doent have any .lib file u can find the library here "http://dragongate-technologies.com/products.html#borZoi" plz help me.
-
linking errosuse_NIST_B_163 (); EC_Domain_Parameters dp = NIST_B_163; I write this two lines of code and get these errors Linking... DSProjDlg.obj : error LNK2001: unresolved external symbol "public: __thiscall BigInt::~BigInt(void)" (??1BigInt@@QAE@XZ) DSProjDlg.obj : error LNK2001: unresolved external symbol "public: __thiscall BigInt::BigInt(class BigInt const &)" (??0BigInt@@QAE@ABV0@@Z) DSProjDlg.obj : error LNK2001: unresolved external symbol "void __cdecl str_to_BigInt(class std::basic_string,class std::allocator > const &,class BigInt &,int)" (?str_to_BigInt@@YAXABV?$basic_string@DU?$char _traits@D@std@@V?$allocator@D@2@@std@@AAVBigInt@@H@Z) DSProjDlg.obj : error LNK2001: unresolved external symbol "public: __thiscall BigInt::BigInt(void)" (??0BigInt@@QAE@XZ) DSProjDlg.obj : error LNK2001: unresolved external symbol "public: __thiscall F2M::~F2M(void)" (??1F2M@@QAE@XZ) DSProjDlg.obj : error LNK2001: unresolved external symbol "void __cdecl str_to_F2M(class std::basic_string,class std::allocator > const &,class F2M &)" (?str_to_F2M@@YAXABV?$basic_string@DU?$char_traits@D@std @@V?$allocator@D@2@@std@@AAVF2M@@@Z) DSProjDlg.obj : error LNK2001: unresolved external symbol "public: __thiscall F2M::F2M(void)" (??0F2M@@QAE@XZ) DSProjDlg.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_ostream > & __thiscall EC_Domain_Parameters::put(class std::basic_ostream > &)const " ( ?put@EC_Domain_Parameters@@UBEAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV23@@Z) DSProjDlg.obj : error LNK2001: unresolved external symbol "public: class Point & __thiscall Point::operator=(class Point const &)" (??4Point@@QAEAAV0@ABV0@@Z) DSProjDlg.obj : error LNK2001: unresolved external symbol "public: class BigInt & __thiscall BigInt::operator=(class BigInt const &)" (??4BigInt@@QAEAAV0@ABV0@@Z) DSProjDlg.obj : error LNK2001: unresolved external symbol "public: class F2M & __thiscall F2M::operator=(class F2M const &)" (??4F2M@@QAEAAV0@ABV0@@Z) DSProjDlg.obj : error LNK2001: unresolved external symbol "public: __thiscall F2X::~F2X(void)" (??1F2X@@QAE@XZ) DSProjDlg.obj : error LNK2001: unresolved external symbol "void __cdecl setModulus(class F2X const &)" (?setModulus@@YAXABVF2X@@@Z) DSProjDlg.obj : error LNK2001: unresolved external symbol "class F2X __cdecl Pentanomial(unsigned short,unsigned short,unsigned short,unsigned short,unsigned short)
-
type conversionIve used this code but the compiler gives v as undeclared identifier.whas v?? Thanx for ur help
-
type conversionTwo type definitions are used in borZoi can anyone explain it to me. 1.typedef unsigned char OCTET; This represents an unsigned 8 bit type. It is called octet rather than byte in order to be consistent with the various standards. 2.typedef std::vector OCTETSTR; This is a vector of octets and represents an octet string as described in various standards.
-
type conversionIm using boZoi library to implement Elliptic curve cryptography to my VC project.The functions output r in the format of hexadecimal and OCTETSTR(octant string) now if i want to show the output in the edit box control of a dialog box...its not working. OCTETSTR str; HexEncoder hex(str); CEdit* poEdit = static_cast(GetDlgItem(IDC_EDIT3)); poEdit->SetWindowText(hex); hex cant b converted to CString or LPCTSTR...it gives type casting errors.
-
using open source library// DSProjDlg.cpp : implementation file // #include "borzoi.h" #include "nist_curves.h" #include "stdafx.h" #include "DSProj.h" #include "NewDlg.h" #include "SignDlg.h" #include "DSProjDlg.h" Yup Ive included the files and Ive included the USE_MPI in Project->settings->C/C++ ->prepocessor->preprocessor definitions Is it OK?
-
using open source libraryIm using borZoi to implement ECC in my project Ive uncluded all the header files and other things according to its manual but when i call its functions i get undeclared function errors. I call use_NIST_B_163 (); and get error e:\vc\myprojects\project\malloc1\dsprojdlg.cpp(212) : error C2065: 'use_NIST_B_163' : undeclared identifier
-
passing values b/w Dialog boxesjee haan app ka code is definitly cofusing....dont u think this can be done by making one dialog class parent of another....Ive done this and it works...but the problem is that I want to pass all the values of child dialogs back to the main dialog. Thanx for the reply AH
-
passing values b/w Dialog boxesI want to pass member variable values b/w different dialog boxes of my application.How I do that....do I have to make one dialog box class parent of another??how i do that??
-
reset dialog boxI want to have a reset button on my dialog box which restore the control values to their original values.Any clue which function shud I call in the reset button function??
-
header files?Suppose im using an open source library borZoi-1.0.2.I copy its folder to my project and the header files r in borZoi-1.0.2\src directory so what will b the relative path with respect to DSW file
-
header files?How do i include a header files directory of another library to my project's include file path.