我使用的是boost 1.54和Qt 5.2.1版。
我尝试构建软件包时出现以下错误
/usr/include/boost/multi_index/sequenced_index.hpp:927:10: error: 'boost::Q_FOREACH’ has not been declared
boost::foreach::tag
^
/usr/include/boost/multi_index/ordered_index.hpp:1399:10: error: ‘boost::Q_FOREACH’ has not been declared
boost::foreach::tag)
^
检查sequenced_index.hpp
,ordered_index.hpp
中的标题,其中包含foreach_fwd.hpp
和foreach.hpp
。
我尝试在项目文件CONFIG += no_keywords
中加入(.pro)
。但我仍然得到这个错误。我不确定原因是什么。
答案 0 :(得分:0)
为了记录,对于即将发布的Boost 1.60版本,此问题已为circumvented,以便您可以让Qt定义宏 KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); //generate key using RSA
KeyPair keypair=keyPairGenerator.generateKeyPair(); //get generated key
Cipher cipher =Cipher.getInstance("RSA/ECB/PKCS1Padding");
SharedPreferences sharedPreferences=context.getSharedPreferences("rsakey", MODE_PRIVATE);//Initializing SharedPerference
SharedPreferences.Editor editor=sharedPreferences.edit();
editor.putString("public",keypair.getPublic().toString());
editor.putString("private",keypair.getPrivate().toString());
editor.commit();//store key in sharedpreference
final String sampletext="abcde";
//getting stored key
String publicKey = sharedPreferences.getString("public", null);
String privateKey = sharedPreferences.getString("private", null);
//publicKey must of type "KEY", so i need to convert publicKey to KEY, But its not happening
cipher.init(Cipher.ENCRYPT_MODE,publicKey);
byte[] encryptedtext=cipher.doFinal(sampletext.getBytes());
String encrypted_text=new String(Base64.encode(encryptedtext,Base64.NO_WRAP));
//privateKey is string, it supposed to be of type KEY
cipher.init(Cipher.DECRYPT_MODE,privateKey);
encryptedtext=Base64.decode(encrypted_text.getBytes(), Base64.NO_WRAP);
encryptedtext=cipher.doFinal(encryptedtext);
String decrypted_text=new String(encryptedtext);
。