21 #ifndef CLASSIFIED_CONTENTENCRYPTIONMODEL_H 22 #define CLASSIFIED_CONTENTENCRYPTIONMODEL_H 23 #include <QSqlDatabase> 24 #include "../mcontroller.h" 25 #include "../net/connection.h" 26 #include <openssl/pem.h> 68 const QString& aNewPassword ) ;
86 const QByteArray& aData,
87 QByteArray& aResultingSignature,
88 const QByteArray* aOptionalMetadata = NULL ) ;
94 const QByteArray& aDataToVerify,
95 const QByteArray& aSignatureToVerify,
96 const QByteArray* aOptionalMetadata = NULL,
97 bool emitErrorMessage =
true ) ;
102 bool verify(
const QByteArray& aPemBytesOfSigningKey,
103 const QByteArray& aDataToVerify,
104 const QByteArray& aSignatureToVerify,
105 const QByteArray* aOptionalMetadata = NULL,
106 bool emitErrorMessage =
true ) ;
120 bool encrypt(
const QList<Hash> aRecipients,
121 const QByteArray& aPlainText,
122 QByteArray& aResultingCipherText) ;
139 bool decrypt(
const QByteArray& aCipherText,
140 QByteArray& aResultingPlainText,
141 bool aEmitErrorOnFailure =
true ) ;
153 QList<Hash>
listKeys(
bool aPrivateKeys,
154 char *aKeyUidToSearch) ;
165 const Hash& aFingerPrintOfKey,
166 const QString* aDisplayName = NULL ) ;
173 const Hash& aFingerPrintOfKey) ;
188 QByteArray& aPossibleKeyFound,
189 quint32 *aTimeStampOfKeyFound = NULL) ;
199 QByteArray& aPossibleKeyFound) ;
212 bool aEmitErrorMessage =
true ) ;
238 const QString& aExplanation) ;
245 bool doVerify(
const QByteArray& aPemBytesOfSigningKey,
246 const QByteArray& aDataToVerify,
247 const QByteArray& aSignatureToVerify,
248 const QByteArray* aOptionalMetadata = NULL,
249 bool emitErrorMessage =
true ) ;
QByteArray randomBytes(int aNumberOfBytes)
bool PrivateKey(const Hash &aFingerPrintOfKeyToFind, QByteArray &aPossibleKeyFound)
const MModelProtocolInterface & iModel
Definition: contentencryptionmodel.h:252
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:38
CAErrorSituation
Definition: mcontroller.h:52
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)
EVP_PKEY * PrivateKeyFromPem(const QByteArray &aPemBytes, bool aEmitErrorMessage=true)
MController * iController
Definition: contentencryptionmodel.h:251
bool insertOrUpdatePrivateKey(const QByteArray &aPrivateKey, const Hash &aFingerPrintOfKey)
Pure-virtual interface of datamodel for message parser to use.
Definition: mmodelprotocolinterface.h:45
Pure-virtual interface class for controller. This is spammed across parties needing access to applica...
Definition: mcontroller.h:43
Hash hashOfPublicKey(const QByteArray &aPemBytes)
ContentEncryptionModel(MController *aMController, const MModelProtocolInterface &aModel)
void error(MController::CAErrorSituation aError, const QString &aExplanation)
bool decrypt(const QByteArray &aCipherText, QByteArray &aResultingPlainText, bool aEmitErrorOnFailure=true)
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:37