Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: CryptAttr.cpp
  8. //
  9. // History: 31-Mar-1997 pberkman created
  10. //
  11. //--------------------------------------------------------------------------
  12. #include "global.hxx"
  13. #include "CryptAttr.hxx"
  14. CryptAttribute_::CryptAttribute_(void)
  15. {
  16. sAttribute.pszObjId = NULL;
  17. sAttribute.Value.pbData = NULL;
  18. }
  19. CryptAttribute_::~CryptAttribute_(void)
  20. {
  21. DELETE_OBJECT(sAttribute.pszObjId);
  22. DELETE_OBJECT(sAttribute.rgValue->pbData);
  23. }
  24. BOOL CryptAttribute_::Fill(DWORD cbAttributeData, BYTE *pbAttributeData, char *pszObjId)
  25. {
  26. DELETE_OBJECT(sAttribute.pszObjId);
  27. DELETE_OBJECT(sAttribute.Value.pbData);
  28. sAttribute.pszObjId = new char[strlen(pszObjId) + 1];
  29. strcpy(&sAttribute.pszObjId[0], pszObjId);
  30. if (CryptEncodeObject( X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
  31. pszObjId,
  32. sAttribute.Value.pbData = new BYTE[cbAttributeData];
  33. sAttribute.Value.cbData = cbAttributeData;
  34. memcpy(&sAttribute.Value.pbData, pbAttributeData, cbAttributeData);
  35. return(TRUE);
  36. }