GDCM  2.4.5
gdcmCAPICryptographicMessageSyntax.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: GDCM (Grassroots DICOM). A DICOM library
4 
5  Copyright (c) 2006-2011 Mathieu Malaterre
6  All rights reserved.
7  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 #ifndef GDCMCAPICRYPTOGRAPHICMESSAGESYNTAX_H
15 #define GDCMCAPICRYPTOGRAPHICMESSAGESYNTAX_H
16 
18 #include <windows.h>
19 #include <wincrypt.h>
20 #include <vector>
21 
22 namespace gdcm
23 {
24 
26 {
27 public:
30 
31  // X.509
32  bool ParseCertificateFile( const char *filename );
33  bool ParseKeyFile( const char *filename );
34 
35  // PBE
36  bool SetPassword(const char * pass, size_t passLen);
37 
38  void SetCipherType(CipherTypes type);
39 
40  CipherTypes GetCipherType() const;
41 
43  bool Encrypt(char *output, size_t &outlen, const char *array, size_t len) const;
45  bool Decrypt(char *output, size_t &outlen, const char *array, size_t len) const;
46 
47  bool GetInitialized() const
48  {
49  return initialized;
50  }
51 
52 private:
53  bool Initialize();
54  static ALG_ID GetAlgIdByObjId(const char * pszObjId);
55  const char *GetCipherObjId() const;
56  static void ReverseBytes(BYTE* data, DWORD len);
57  static bool LoadFile(const char * filename, BYTE* & buffer, DWORD & bufLen);
58 
59 private:
60  bool initialized;
61  HCRYPTPROV hProv;
62  std::vector<PCCERT_CONTEXT> certifList;
63  HCRYPTKEY hRsaPrivK;
64  CipherTypes cipherType;
65 };
66 
67 } // end namespace gdcm
68 
69 #endif //GDCMCAPICRYPTOGRAPHICMESSAGESYNTAX_H
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
Definition: gdcmCAPICryptographicMessageSyntax.h:25
bool GetInitialized() const
Definition: gdcmCAPICryptographicMessageSyntax.h:47
Definition: gdcmCryptographicMessageSyntax.h:22
Definition: gdcmASN1.h:20

Generated on Fri Sep 25 2015 17:58:22 for GDCM by doxygen 1.8.9.1
SourceForge.net Logo