GDCM: gdcmCAPICryptographicMessageSyntax.h Source File

GDCM 3.2.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
17#include "gdcmCryptographicMessageSyntax.h"
18#include <windows.h>
19#include <wincrypt.h>
20#include <vector>
21
22namespace gdcm
23{
24
25 class GDCM_EXPORT CAPICryptographicMessageSyntax : public CryptographicMessageSyntax
26{
27public:
28 CAPICryptographicMessageSyntax();
29 ~CAPICryptographicMessageSyntax();
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
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
gdcm::CAPICryptographicMessageSyntax::SetCipherType
void SetCipherType(CipherTypes type)
gdcm::CAPICryptographicMessageSyntax::GetInitialized
bool GetInitialized() const
Definition gdcmCAPICryptographicMessageSyntax.h:47
gdcm::CAPICryptographicMessageSyntax::ParseKeyFile
bool ParseKeyFile(const char *filename)
gdcm::CAPICryptographicMessageSyntax::Encrypt
bool Encrypt(char *output, size_t &outlen, const char *array, size_t len) const
create a CMS envelopedData structure
gdcm::CAPICryptographicMessageSyntax::SetPassword
bool SetPassword(const char *pass, size_t passLen)
gdcm::CAPICryptographicMessageSyntax::CAPICryptographicMessageSyntax
CAPICryptographicMessageSyntax()
gdcm::CAPICryptographicMessageSyntax::Decrypt
bool Decrypt(char *output, size_t &outlen, const char *array, size_t len) const
decrypt content from a CMS envelopedData structure
gdcm::CAPICryptographicMessageSyntax::GetCipherType
CipherTypes GetCipherType() const
gdcm::CAPICryptographicMessageSyntax::~CAPICryptographicMessageSyntax
~CAPICryptographicMessageSyntax()
gdcm::CAPICryptographicMessageSyntax::ParseCertificateFile
bool ParseCertificateFile(const char *filename)
gdcm::CryptographicMessageSyntax::CipherTypes
CipherTypes
Definition gdcmCryptographicMessageSyntax.h:31
gdcm::CryptographicMessageSyntax::CryptographicMessageSyntax
CryptographicMessageSyntax()=default
gdcmCryptographicMessageSyntax.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21