RE: SecretBag::BDecPdu
"Colestock, Robert" <[email protected]> Wed, 8 Aug 2001 13:00:34 -0400
| Newsgroups | gmane.ietf.sfl |
|---|---|
| Message-ID | <[email protected]> |
Eric:
I have been working on improving the SNACC ANY DEFINED BY logic; I broke
this logic with the DER encoding rule and CSM_Buffer ANY logic (the original
SNACC simply called "abort()" when an ANY was encountered).
The new improved SNACC has not been released. You are encountering the
problems I set out to fix. I can send you this new version (in a separate
e-mail to avoid full distribution for those who are not interested). It
should behave better with respect to the ANY DEFINED BY logic. The other
alternative is to not register the ANY data type and simply treat the ANY
logic as a CSM_Buffer (as is done throughout the existing SFL).
Specifically:
DO NOT CALL "AsnAny::InstallAnyByOid(id, 3, mtStruct);"
This will force the default VDA logic that simply loads the ANY as a
CSM_Buffer. There are a few macros in sm_vdasnacc.h that assist, but
basically you simply reference the ANY as a (CSM_Buffer *).
<<<< from SNACC/c++-lib/inc/sm_vdasnacc.h >>>>
...
#define SM_EXTRACT_ANYBUF(pSS, asnAny)\
{\
if ((asnAny)->value)\
(pSS) = new CSM_Buffer(*(AsnAnyBuffer *)(asnAny)->value);\
}
Bob Colestock
VDA
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, August 08, 2001 9:42 AM
To: [email protected]
Subject: SecretBag::BDecPdu
Hi,
I try to use one of my structure inserted into Free3 librabrary and i have
problems to use it. There is the problem :
The class inserted into Free3 library:
/* OCTET STRING */
typedef AsnOcts MTSecretStruct;
extern const AsnOid motus_pkcs12_secret_id;
How i use it to create a secret bag in a PKCS-12: (every thing is working
at that point)
AsnOcts *mtStruct = new AsnOcts;
AsnOid id = motus_pkcs12_secret_id;
AsnAny::InstallAnyByOid(id, 3, mtStruct);
SecretBag *bag = new SecretBag;
bag->secretTypeId = secretTypeId;
AsnOcts *octetString = new AsnOcts;
octetString->Set(secrteValue.DataPtr(), secrteValue.DataLen());
MT_ENCODE_ANY(*octetString, bag->secretValue);
How i use it to read a secret bag in a PKCS-12: (there is where my
program crash)
bag = new SecretBag;
ListeTemp.Retrieve(secretValue);
MTEncodeDecode<SecretBag>::Decode(secretValue, *bag)
{
size_t bytesDecoded = 0;
try
{
output.BDecPdu(input, bytesDecoded); <--------------- crash
if (input.ReadError())
{
throw ERROR_BAD_SNACC_DECODE;
}
}
catch (...)
{
throw;
}
};
The bug appear to be here :
void AsnAny::SetTypeByOid (AsnOid &id)
{
Hash hash;
void *anyInfo;
/* use encoded oid as hash string */
hash = MakeHash (id.Str(), id.Len());
if (CheckForAndReturnValue (oidHashTbl, hash, &anyInfo))
<-------------
ai = (AnyInfo*) anyInfo; <---------------- ai->typeToClone is
incorrect
else
ai = NULL; /* indicates failure */
} /* SetAnyTypeByOid */
What can i do to correct this bug ????
What can i do to use correctly my class into Free3 library ?????
Thanks.
**************************************************************************
Eric Boudreault
------------------------------------------------
Programmeur
------------------------------------------------
Motus Technologies
390, St-Vallier Est
Bureau 100
Québec, Qc
G1K 3P6
Tél.: 521-2100 ext.#242
Fax.: 521-2101
courriel: [email protected]
**************************************************************************