请问如何解决这个opensssl加密问题? [英] Please how does one resolve this opensssl encryption issues?

查看:118
本文介绍了请问如何解决这个opensssl加密问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用sqlite作为我选择的嵌入式数据库,但因为它没有加密,我使用openssl编写了自己的加密代码。



所以我在登录数据库之前加密字符串,在从数据库读取后解密。



我必须解密并将一个c风格的字符串数组保存到数据库中,但当我试图读取它时,我发现一个特定的字符串没有没有解密。



由于通过循环解密并保存到鸽子数据库,因为从数据库读取和解密也是通过循环完成的我无法想象任何原因为什么一个特定的字符串不应该被解密。



我想知道这些我的经验(使用openssl)是不是不常见,也知道是否有可能出路?



另一个想到我的想法:

数据库是否有干扰?

I am using sqlite as my embedded database of choice, but because it is doesn't come encrypted, I wrote my own encryption code using openssl.

So I encrypt strings before logging to database and decrypt after reading from database.

I had to decrypt and save an array of c-style string into the data base, but when I attempted to read it, I found out that a particular string doesn't get decrypted.

Since decryption and saving to database in dove via a loop and since reading from database and decryption is also done via a loop I cannot imagine any reason why a particular string should not be decrypted.

I wish to know if these my experience ( with openssl) is not uncommon and also know if there is a possible way out?

The other thought on my mind this:
was there an interference in the database?

推荐答案

问题的原因可能是加密的字符串中有一个零终止符或其他无效字符。您应该将加密数据存储为二进制文件。



确保为数据结构中保存的数据留出足够的空间。对于调试是一个未加密的阴影db fine。
a reason for problems can be, that the encrypted "string" has a zero-terminator or other invalid char in it. You should store enrypted data as binary.

Be sure that is enough space for the saved data in your data structures. For debugging is an unecrypted shadow db fine.


这篇关于请问如何解决这个opensssl加密问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆