GDCM 3.2.1

gdcmOpenSSLCryptographicMessageSyntax.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 GDCMOPENSSLCRYPTOGRAPHICMESSAGESYNTAX_H
15#define GDCMOPENSSLCRYPTOGRAPHICMESSAGESYNTAX_H
16
17#include "gdcmCryptographicMessageSyntax.h"
18#include <openssl/cms.h>
19#include <openssl/evp.h>
20
21 namespace gdcm
22{
23
24 class GDCM_EXPORT OpenSSLCryptographicMessageSyntax : public CryptographicMessageSyntax
25{
26 public:
27 OpenSSLCryptographicMessageSyntax();
28 ~OpenSSLCryptographicMessageSyntax();
29
30 // X.509
31 bool ParseCertificateFile( const char *filename );
32 bool ParseKeyFile( const char *filename );
33
34 // PBE
35 bool SetPassword(const char * pass, size_t passLen);
36
39 void SetCipherType(CipherTypes type);
40 CipherTypes GetCipherType() const;
42 bool Encrypt(char *output, size_t &outlen, const char *array, size_t len) const;
44 bool Decrypt(char *output, size_t &outlen, const char *array, size_t len) const;
45
46 private:
47//#ifdef GDCM_HAVE_CMS_RECIPIENT_PASSWORD
48// ::stack_st_X509 *recips;
49//#else
50 STACK_OF(X509) *recips;
51//#endif
52 ::EVP_PKEY *pkey;
53 const EVP_CIPHER *internalCipherType;
54 char * password;
55 size_t passwordLength;
56 CipherTypes cipherType;
57
58 private:
59 OpenSSLCryptographicMessageSyntax(const OpenSSLCryptographicMessageSyntax&); // Not implemented.
60 void operator=(const OpenSSLCryptographicMessageSyntax&); // Not implemented.
61 const EVP_CIPHER *CreateCipher( CryptographicMessageSyntax::CipherTypes ciphertype);
62
63};
64
65} // end namespace gdcm
66
67#endif //GDCMOPENSSLCRYPTOGRAPHICMESSAGESYNTAX_H
gdcm::CryptographicMessageSyntax::CipherTypes
CipherTypes
Definition gdcmCryptographicMessageSyntax.h:31
gdcm::CryptographicMessageSyntax::CryptographicMessageSyntax
CryptographicMessageSyntax()=default
gdcm::OpenSSLCryptographicMessageSyntax::ParseKeyFile
bool ParseKeyFile(const char *filename)
gdcm::OpenSSLCryptographicMessageSyntax::ParseCertificateFile
bool ParseCertificateFile(const char *filename)
gdcm::OpenSSLCryptographicMessageSyntax::GetCipherType
CipherTypes GetCipherType() const
gdcm::OpenSSLCryptographicMessageSyntax::Encrypt
bool Encrypt(char *output, size_t &outlen, const char *array, size_t len) const
create a CMS envelopedData structure
gdcm::OpenSSLCryptographicMessageSyntax::OpenSSLCryptographicMessageSyntax
OpenSSLCryptographicMessageSyntax()
gdcm::OpenSSLCryptographicMessageSyntax::~OpenSSLCryptographicMessageSyntax
~OpenSSLCryptographicMessageSyntax()
gdcm::OpenSSLCryptographicMessageSyntax::Decrypt
bool Decrypt(char *output, size_t &outlen, const char *array, size_t len) const
decrypt content from a PKCS#7 envelopedData structure
gdcm::OpenSSLCryptographicMessageSyntax::SetPassword
bool SetPassword(const char *pass, size_t passLen)
gdcm::OpenSSLCryptographicMessageSyntax::SetCipherType
void SetCipherType(CipherTypes type)
gdcmCryptographicMessageSyntax.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21