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.

97 lines
4.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: SIPObj.hxx (base)
  8. //
  9. // Contents: Microsoft SIP Provider
  10. //
  11. // History: 15-Feb-1997 pberkman created
  12. //
  13. //--------------------------------------------------------------------------
  14. #ifndef SIPOBJ_HXX
  15. #define SIPOBJ_HXX
  16. #include "global.hxx"
  17. class SIPObject_
  18. {
  19. public:
  20. SIPObject_(DWORD id);
  21. virtual ~SIPObject_(void);
  22. virtual BOOL GetSignedDataMsg(SIP_SUBJECTINFO *pSI,DWORD dwIdx,
  23. DWORD *pdwDLen,BYTE *pbData,
  24. DWORD *pdwEncodeType);
  25. virtual BOOL PutSignedDataMsg(SIP_SUBJECTINFO *pSI,DWORD *dwIdx,
  26. DWORD dwDLen,BYTE *pbData,
  27. DWORD dwEncodeType);
  28. virtual BOOL RemoveSignedDataMsg(SIP_SUBJECTINFO *pSI,DWORD dwIdx) { return(FALSE); }
  29. virtual BOOL CreateIndirectData(SIP_SUBJECTINFO *pSI,DWORD *pdwDLen,
  30. SIP_INDIRECT_DATA *psData);
  31. virtual BOOL VerifyIndirectData(SIP_SUBJECTINFO *pSI,
  32. SIP_INDIRECT_DATA *psData);
  33. virtual char *GetDataObjectID(void) { return(NULL); }
  34. virtual char *GetDataOIDHint(void) { return(NULL); }
  35. void set_CertVersion(DWORD dwNewCertVersion);
  36. DWORD get_CertVersion(void) { return(uCertVersion); }
  37. protected:
  38. HANDLE hFile;
  39. BOOL fUseFileMap;
  40. BYTE *pbFileMap;
  41. DWORD cbFileMap;
  42. HANDLE hMappedFile;
  43. DWORD dwFileAccess;
  44. HCRYPTPROV hProv;
  45. BOOL bCloseFile;
  46. BOOL fSizeFileOnly;
  47. UINT uSubjectForm;
  48. DWORD uCertVersion;
  49. void *SIPNew(DWORD cbytes);
  50. virtual DWORD GetDigestFlags(SIP_SUBJECTINFO *pSI) { return(0); }
  51. virtual void *GetMyStructure(SIP_SUBJECTINFO *pSI) { return(NULL); }
  52. virtual DWORD GetMyStructureSize(void) { return(0); }
  53. virtual BOOL PutMessageInFile(SIP_SUBJECTINFO *pSI,
  54. WIN_CERTIFICATE *pWinCert,DWORD *pdwIndex)
  55. { return(FALSE); }
  56. virtual BOOL GetMessageFromFile(SIP_SUBJECTINFO *pSI,
  57. WIN_CERTIFICATE *pWinCert,DWORD dwIndex,
  58. DWORD *pcbCert)
  59. { return(FALSE); }
  60. virtual BOOL GetDigestStream(DIGEST_DATA *pDigestData,
  61. DIGEST_FUNCTION pfnCallBack, DWORD dwFlags)
  62. { return(FALSE); }
  63. virtual BOOL FileHandleFromSubject(SIP_SUBJECTINFO *pSubject,
  64. DWORD dwAccess = GENERIC_READ,
  65. DWORD dwShared = FILE_SHARE_READ);
  66. BYTE *DigestFile(HCRYPTPROV hProv, DWORD dwFlags, // allocates digest
  67. char *pszAlgObjId, DWORD *cbDigest); // delete it after use!!!
  68. BOOL OpenFile(LPCWSTR wFileName, DWORD dwAccess, DWORD dwShared);
  69. void AllocateAndFillCryptBitBlob(CRYPT_BIT_BLOB *bb,DWORD Flags,
  70. DWORD cUnusedBits);
  71. void DestroyCryptBitBlob(CRYPT_BIT_BLOB *bb);
  72. DWORD CryptBitBlobToFlags(CRYPT_BIT_BLOB *bb);
  73. BOOL LoadDefaultProvider(void);
  74. BOOL SeekAndReadFile(DWORD lFileOffset, BYTE *pb, DWORD cb);
  75. BOOL SeekAndWriteFile(DWORD lFileOffset,BYTE *pb, DWORD cb);
  76. BOOL MapFile(void);
  77. BOOL UnmapFile(void);
  78. };
  79. #endif // SIPOBJ_HXX