[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
'EncodedParams' error in CreateDHCryptoKeys
Hello Robert
I'm working with the ('smimeR1.5' on a WinNT OS) and my goal is to create a
certificate and use it.
As far as I know, in order to create and use the cert' I need:
PublicKey + AlgParameters (for creating the cert')
PrivateKey. (for using the cert')
To generate DH PublicKey + AlgParameters + PrivateKey I used code that is
used in the
'CertWindowDlg.cpp' in 'smimeR1.6', the 'CertificateBuilder.dsp'.
The code is:
//
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
pCryptoDH = SM_BuildCryptoKeysDH(NULL, password);
if(pCryptoDH != NULL)
{
stat = pCryptoDH->GenerateKeys( &XPriv, &YPub, P, G, Q,
nKeyBits, readParams , ¶ms );
}
if(stat != SM_NO_ERROR)
{
// handle the ERROR
}
else
{
if(subPubKeyInfPtr == NULL)
{
subPubKeyInfPtr = new SubjectPublicKeyInfo;
}
subPubKeyInfPtr = pCryptoDH->LoadSNACCPublicKeyInfo( ¶ms , &YPub );
//encrypt private key
CSM_Alg *alg = new CSM_Alg(*subPubKeyInfPtr->algorithm);
encryptPrivPtr = pCryptoDH->WrapPrivateKey(XPriv,password,alg);
}
//
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
so...
1) Are the 'CSM_Buffer YPub' + 'CSM_Buffer params' are the
PublicKey+AlgParameters needed to create and use the cert' ?
When I used them as the 'PublicKey=...' and 'EncodedParams=...' in the
'xxDH.cfg'
the output cert' of the 'auto_hid.exe' was corrupted and could not be
opened.
2)Is the 'CSM_Buffer* encryptPrivPtr' is the PrivateKey needed to
encrypt/decrypt using the cert' ?
3) Is the 'SubjectPublicKeyInfo* subPubKeyInfPtr' is the cert's
certificateToSign->subjectPublicKeyInfo ?
4) How the 'dh_params.dat' and 'BugsDhY.dat' were built ?
My goal...
is to create a cert' but when I use all the 'subPubKeyInfPtr' as the cert's
certificateToSign->subjectPublicKeyInfo I got a cert' the has a 'DH (0
Bits)' in the 'PublicKey' parameter in the Microsoft cert' viewer and my
application fails to use this Cert' + PrivateKey to encrypt/decrypt.
Thanks in advance
Alon Barak
Vanguard Security Technologies Ltd.
Tel: 972-4-9891311 (Ext. 221);
Fax: 972-4-9891322
mailto:Alon@xxxxxxxxxx