Virgil Security Crypto library  1.8.2
VirgilTinyCipher.h
1 
37 #ifndef VIRGIL_CRYPTO_TINY_CIPHER_H
38 #define VIRGIL_CRYPTO_TINY_CIPHER_H
39 
40 #include <string>
41 
42 #include <virgil/crypto/VirgilByteArray.h>
43 
44 namespace virgil { namespace crypto {
45 
49 class VirgilTinyCipherImpl;
50 
119 public:
124  enum PackageSize {
128  };
129 public:
133 
143  explicit VirgilTinyCipher(size_t packageSize = PackageSize_Short_SMS);
144 
150  void reset();
151 
155  virtual ~VirgilTinyCipher() throw();
157 
160 
171  void encrypt(const VirgilByteArray& data, const VirgilByteArray& recipientPublicKey);
172 
187  void encryptAndSign(
188  const VirgilByteArray& data, const VirgilByteArray& recipientPublicKey,
189  const VirgilByteArray& senderPrivateKey,
190  const VirgilByteArray& senderPrivateKeyPassword = VirgilByteArray());
191 
199  size_t getPackageCount() const;
200 
212  VirgilByteArray getPackage(size_t index) const;
214 
217 
229  void addPackage(const VirgilByteArray& package);
230 
238  bool isPackagesAccumulated() const;
239 
251  VirgilByteArray decrypt(
252  const VirgilByteArray& recipientPrivateKey,
253  const VirgilByteArray& recipientPrivateKeyPassword = VirgilByteArray());
254 
265  VirgilByteArray verifyAndDecrypt(
266  const VirgilByteArray& senderPublicKey,
267  const VirgilByteArray& recipientPrivateKey,
268  const VirgilByteArray& recipientPrivateKeyPassword = VirgilByteArray());
270 private:
271  VirgilTinyCipher(const VirgilTinyCipher& other);
272 
273  VirgilTinyCipher& operator=(const VirgilTinyCipher& rhs);
274 
275 private:
276  VirgilTinyCipherImpl* impl_;
277 };
278 
279 }}
280 
281 #endif // VIRGIL_CRYPTO_TINY_CIPHER_H
Min.
Definition: VirgilTinyCipher.h:125
PackageSize
Constants that represents maximum number of bytes in one package.
Definition: VirgilTinyCipher.h:124
virtual ~VirgilTinyCipher()
Destroy pimpl class object.
VirgilByteArray getPackage(size_t index) const
Return specific package.
void encrypt(const VirgilByteArray &data, const VirgilByteArray &recipientPublicKey)
Encrypt data with given public key.
VirgilByteArray verifyAndDecrypt(const VirgilByteArray &senderPublicKey, const VirgilByteArray &recipientPrivateKey, const VirgilByteArray &recipientPrivateKeyPassword=VirgilByteArray())
Verify accumulated packages and then decrypt it.
VirgilTinyCipher(size_t packageSize=PackageSize_Short_SMS)
Init cipher with given maximum package size.
void addPackage(const VirgilByteArray &package)
Add package.
VirgilByteArray decrypt(const VirgilByteArray &recipientPrivateKey, const VirgilByteArray &recipientPrivateKeyPassword=VirgilByteArray())
Decrypt accumulated packages.
Definition: VirgilAsn1Compatible.h:46
Long SMS.
Definition: VirgilTinyCipher.h:127
Short SMS.
Definition: VirgilTinyCipher.h:126
void reset()
Prepare cipher for the next encryption.
This class aim is to minimize encryption output.
Definition: VirgilTinyCipher.h:118
bool isPackagesAccumulated() const
Define whether all packages was accumulated or not.
void encryptAndSign(const VirgilByteArray &data, const VirgilByteArray &recipientPublicKey, const VirgilByteArray &senderPrivateKey, const VirgilByteArray &senderPrivateKeyPassword=VirgilByteArray())
Encrypt data with given public key and sign package.
size_t getPackageCount() const
Return total package count.