20 #ifndef CLASSIFIED_CONTENTENCRYPTIONMODEL_H
21 #define CLASSIFIED_CONTENTENCRYPTIONMODEL_H
22 #include <QSqlDatabase>
23 #include "../mcontroller.h"
24 #include "../net/connection.h"
25 #include <openssl/pem.h>
67 const QString& aNewPassword ) ;
85 const QByteArray& aData,
86 QByteArray& aResultingSignature,
87 const QByteArray* aOptionalMetadata = NULL ) ;
93 const QByteArray& aDataToVerify,
94 const QByteArray& aSignatureToVerify,
95 const QByteArray* aOptionalMetadata = NULL,
96 bool emitErrorMessage =
true ) ;
101 bool verify(
const QByteArray& aPemBytesOfSigningKey,
102 const QByteArray& aDataToVerify,
103 const QByteArray& aSignatureToVerify,
104 const QByteArray* aOptionalMetadata = NULL,
105 bool emitErrorMessage =
true ) ;
119 bool encrypt(
const QList<Hash> aRecipients,
120 const QByteArray& aPlainText,
121 QByteArray& aResultingCipherText) ;
132 bool decrypt(
const QByteArray& aCipherText,
133 QByteArray& aResultingPlainText) ;
145 QList<Hash>
listKeys(
bool aPrivateKeys,
146 char *aKeyUidToSearch) ;
157 const Hash& aFingerPrintOfKey,
158 const QString* aDisplayName = NULL ) ;
165 const Hash& aFingerPrintOfKey) ;
180 QByteArray& aPossibleKeyFound,
181 quint32 *aTimeStampOfKeyFound = NULL) ;
191 QByteArray& aPossibleKeyFound) ;
204 bool aEmitErrorMessage =
true ) ;
225 const QString& aExplanation) ;
232 bool doVerify(
const QByteArray& aPemBytesOfSigningKey,
233 const QByteArray& aDataToVerify,
234 const QByteArray& aSignatureToVerify,
235 const QByteArray* aOptionalMetadata = NULL,
236 bool emitErrorMessage =
true ) ;
bool PrivateKey(const Hash &aFingerPrintOfKeyToFind, QByteArray &aPossibleKeyFound)
const MModelProtocolInterface & iModel
Definition: contentencryptionmodel.h:239
int changeKeyPassword(const Hash &aFingerPrint, const QString &aNewPassword)
bool encrypt(const QList< Hash > aRecipients, const QByteArray &aPlainText, QByteArray &aResultingCipherText)
~ContentEncryptionModel()
EVP_PKEY * PublicKeyFromPem(const QByteArray &aPemBytes)
Hash is class that carries 160-bit digest.
Definition: hash.h:37
CAErrorSituation
Definition: mcontroller.h:48
bool doVerify(const QByteArray &aPemBytesOfSigningKey, const QByteArray &aDataToVerify, const QByteArray &aSignatureToVerify, const QByteArray *aOptionalMetadata=NULL, bool emitErrorMessage=true)
int sign(const Hash &aSigningKey, const QByteArray &aData, QByteArray &aResultingSignature, const QByteArray *aOptionalMetadata=NULL)
bool decrypt(const QByteArray &aCipherText, QByteArray &aResultingPlainText)
EVP_PKEY * PrivateKeyFromPem(const QByteArray &aPemBytes, bool aEmitErrorMessage=true)
MController * iController
Definition: contentencryptionmodel.h:238
bool insertOrUpdatePrivateKey(const QByteArray &aPrivateKey, const Hash &aFingerPrintOfKey)
Pure-virtual interface of datamodel for message parser to use.
Definition: mmodelprotocolinterface.h:44
Pure-virtual interface class for controller. This is spammed across parties needing access to applica...
Definition: mcontroller.h:39
Hash hashOfPublicKey(const QByteArray &aPemBytes)
ContentEncryptionModel(MController *aMController, const MModelProtocolInterface &aModel)
void error(MController::CAErrorSituation aError, const QString &aExplanation)
bool insertOrUpdatePublicKey(const QByteArray &aPublicKey, const Hash &aFingerPrintOfKey, const QString *aDisplayName=NULL)
bool PublicKey(const Hash &aFingerPrintOfKeyToFind, QByteArray &aPossibleKeyFound, quint32 *aTimeStampOfKeyFound=NULL)
QList< Hash > listKeys(bool aPrivateKeys, char *aKeyUidToSearch)
bool deleteKeyPair(const Hash &aHash)
bool verify(const Hash &aPresumedSigningKey, const QByteArray &aDataToVerify, const QByteArray &aSignatureToVerify, const QByteArray *aOptionalMetadata=NULL, bool emitErrorMessage=true)
This is content-crypto-operations-specific part of the datamodel.
Definition: contentencryptionmodel.h:36