[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: eboudreault@xxxxxxxxx
**************************************************************************