I loaded the following code into an XCode 7.1.1 project added the location of crypto++ headers and libraries to their respective search paths. I then added the crypto++ libraries libcryptopp.a and libcryptopp.dyld Link Binary With Libraries list. The code compiled successfully and began running. I then receive the following error:
*dyld: Library not loaded: libcryptopp.dylib* * Referenced from: /Users/arthur/Library/Developer/Xcode/DerivedData/cryptoppAES-bbtucachjqqaeediqkjywpllseec/Build/Products/Debug/cryptoppAES* * Reason: image not found* *The following error from Thread 1* dyld`dyld_fatal_error: 0x7fff5fc01074 <+0>: int3 -> 0x7fff5fc01075 <+1>: nop dyld`_dyld_start: 0x7fff5fc01000 <+0>: popq %rdi 0x7fff5fc01001 <+1>: pushq $0x0 0x7fff5fc01003 <+3>: movq %rsp, %rbp 0x7fff5fc01006 <+6>: andq $-0x10, %rsp 0x7fff5fc0100a <+10>: subq $0x10, %rsp 0x7fff5fc0100e <+14>: movl 0x8(%rbp), %esi 0x7fff5fc01011 <+17>: leaq 0x10(%rbp), %rdx 0x7fff5fc01015 <+21>: movq 0x37abc(%rip), %r8 ; _dyld_start_static 0x7fff5fc0101c <+28>: leaq -0x23(%rip), %rcx ; <+0> 0x7fff5fc01023 <+35>: subq %r8, %rcx 0x7fff5fc01026 <+38>: leaq -0x102d(%rip), %r8 0x7fff5fc0102d <+45>: leaq -0x8(%rbp), %r9 0x7fff5fc01031 <+49>: callq 0x7fff5fc01076 ; dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*, unsigned long*) -> 0x7fff5fc01036 <+54>: movq -0x8(%rbp), %rdi 0x7fff5fc0103a <+58>: cmpq $0x0, %rdi 0x7fff5fc0103e <+62>: jne 0x7fff5fc01050 ; <+80> 0x7fff5fc01040 <+64>: movq %rbp, %rsp 0x7fff5fc01043 <+67>: addq $0x8, %rsp 0x7fff5fc01047 <+71>: movq $0x0, %rbp 0x7fff5fc0104e <+78>: jmpq *%rax 0x7fff5fc01050 <+80>: addq $0x10, %rsp 0x7fff5fc01054 <+84>: pushq %rdi 0x7fff5fc01055 <+85>: movq 0x8(%rbp), %rdi 0x7fff5fc01059 <+89>: leaq 0x10(%rbp), %rsi 0x7fff5fc0105d <+93>: leaq 0x8(%rsi,%rdi,8), %rdx 0x7fff5fc01062 <+98>: movq %rdx, %rcx 0x7fff5fc01065 <+101>: movq (%rcx), %r8 0x7fff5fc01068 <+104>: addq $0x8, %rcx 0x7fff5fc0106c <+108>: testq %r8, %r8 0x7fff5fc0106f <+111>: jne 0x7fff5fc01065 ; <+101> 0x7fff5fc01071 <+113>: jmpq *%rax 0x7fff5fc01073 <+115>: nop Here is the code: #include <iostream> #include <iomanip> #include "modes.h" #include "aes.h" #include "filters.h" int main(int argc, char* argv[]) { //Key and IV setup //AES encryption uses a secret key of a variable length (128-bit, 196-bit or 256- //bit). This key is secretly exchanged between two parties before communication //begins. DEFAULT_KEYLENGTH= 16 bytes byte key[ CryptoPP::AES::DEFAULT_KEYLENGTH ], iv[ CryptoPP::AES:: BLOCKSIZE ]; memset( key, 0x00, CryptoPP::AES::DEFAULT_KEYLENGTH ); memset( iv, 0x00, CryptoPP::AES::BLOCKSIZE ); // // String and Sink setup // std::string plaintext = "Now is the time for all good men to come to the aide..."; std::string ciphertext; std::string decryptedtext; // // Dump Plain Text // std::cout << "Plain Text (" << plaintext.size() << " bytes)" << std:: endl; std::cout << plaintext; std::cout << std::endl << std::endl; // // Create Cipher Text // CryptoPP::AES::Encryption aesEncryption(key, CryptoPP::AES:: DEFAULT_KEYLENGTH); CryptoPP::CBC_Mode_ExternalCipher::Encryption cbcEncryption( aesEncryption, iv ); CryptoPP::StreamTransformationFilter stfEncryptor(cbcEncryption, new CryptoPP::StringSink( ciphertext ) ); stfEncryptor.Put( reinterpret_cast<const unsigned char*>( plaintext. c_str() ), plaintext.length() + 1 ); stfEncryptor.MessageEnd(); // // Dump Cipher Text // std::cout << "Cipher Text (" << ciphertext.size() << " bytes)" << std:: endl; for( int i = 0; i < ciphertext.size(); i++ ) { std::cout << "0x" << std::hex << (0xFF & static_cast<byte >(ciphertext[i])) << " "; } std::cout << std::endl << std::endl; // // Decrypt // CryptoPP::AES::Decryption aesDecryption(key, CryptoPP::AES:: DEFAULT_KEYLENGTH); CryptoPP::CBC_Mode_ExternalCipher::Decryption cbcDecryption( aesDecryption, iv ); CryptoPP::StreamTransformationFilter stfDecryptor(cbcDecryption, new CryptoPP::StringSink( decryptedtext ) ); stfDecryptor.Put( reinterpret_cast<const unsigned char*>( ciphertext. c_str() ), ciphertext.size() ); stfDecryptor.MessageEnd(); // // Dump Decrypted Text // std::cout << "Decrypted Text: " << std::endl; std::cout << decryptedtext; std::cout << std::endl << std::endl; return 0; } Once again any help greatly appreciated, Arthur -- -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com. More information about Crypto++ and this group is available at http://www.cryptopp.com. --- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.