GDCM 3.0.24
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
22namespace gdcm
23{
24
26{
27public:
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
39
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
52private:
53 bool Initialize();
54 static ALG_ID GetAlgIdByObjId(const char * pszObjId);
55 const char *GetCipherObjId() const;
56 static void ReverseBytes(unsigned char* data, DWORD len);
57 static bool LoadFile(const char * filename, unsigned char* & buffer, DWORD & bufLen);
58
59private:
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
Definition gdcmCAPICryptographicMessageSyntax.h:26
void SetCipherType(CipherTypes type)
bool GetInitialized() const
Definition gdcmCAPICryptographicMessageSyntax.h:47
bool ParseKeyFile(const char *filename)
bool Encrypt(char *output, size_t &outlen, const char *array, size_t len) const
create a CMS envelopedData structure
bool SetPassword(const char *pass, size_t passLen)
bool Decrypt(char *output, size_t &outlen, const char *array, size_t len) const
decrypt content from a CMS envelopedData structure
bool ParseCertificateFile(const char *filename)
Definition gdcmCryptographicMessageSyntax.h:23
CipherTypes
Definition gdcmCryptographicMessageSyntax.h:31
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21