Rewrtiting from Blowfish to AES

Hey everyone, I'm trying to recreate an older juce blowfish encryption to AES using the crypto++ library, I'm struggling (as always) with definging the variables inside classes and constructors, somehow i don't understand it and it's getting really frustrating, I manage to write complex code but this is really a blocking factor to me, if someone posts an answer could you also write some comment on how it works in human language? :) (I've left how the old blowfish code was defined in comments)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class StringEncryptor: public Encryptingisfun // this used to say :public Blowfish
{
public:

    
    
    StringEncryptor(const juce::String& strKey)
    //: BlowFish ((std::uint8_t *)(strKey.toWideCharPointer()), strKey.length())
    :
    Encryptingisfun(SecByteBlock key(AES::MAX_KEYLENGTH+AES::BLOCKSIZE), juce::String password("dfc4894de3b6451cef988124b4327e58"), juce::String iv("27c9f38a05e5e422b99e630609e636ac"),  HKDF<SHA256> hkdf, hkdf.DeriveKey(key, key.size(), (const byte*)password.data(), password.size(), (const byte*)iv.data(), iv.size(), NULL, 0))

               {
    }
    
	~StringEncryptor()
    {
        
    };
That's kinda vague, and the code you've posted doesn't really help.

Are you able to be more specific?
Yes Excuse me, so I'm doing encryption like this:
1
2
StringEncryptor se = StringEncryptor(retrieveEncryptionKey());
    std::string encryptedLicense = se.encryptString (kApplicationSecret);


then the functions are in here but I don't know how to declare everything:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using namespace CryptoPP;

class StringEncryptor//: public Encryptingisfun // this used to say :public Blowfish
{
public:

    
    StringEncryptor(const std::string& strKey)
    //: BlowFish ((std::uint8_t *)(strKey.toWideCharPointer()), strKey.length())
    //:
    //:Encryptingisfun()

               {
//                   CryptoPP::SecByteBlock key(AES::MAX_KEYLENGTH+AES::BLOCKSIZE);
//                   std::string password("dfc4894de3b6451cef988124b4327e58");
//                   std::string iv("27c9f38a05e5e422b99e630609e636ac");
    }
    
	~StringEncryptor()
    {
        
    };
            

    const std::string encryptString (const std::string& str)
    {
        CryptoPP::SecByteBlock key(AES::MAX_KEYLENGTH+AES::BLOCKSIZE);
        std::string password("dfc4894de3b6451cef988124b4327e58");


* I get this error also:

1
2
#if defined(CRYPTOPP_CXX17_UNCAUGHT_EXCEPTIONS)
		if (std::uncaught_exceptions() == 0)


'uncaught_exceptions' is unavailable: introduced in macOS 10.12
Last edited on
Topic archived. No new replies allowed.