[英]What algorithm can I use for encryption in Java?
What algorithm can I use for creating an encryption program in Java? 我可以使用哪种算法在Java中创建加密程序? What if I want to use the same key for encrypting and decrypting? 如果我想使用相同的密钥进行加密和解密怎么办?
Example: I type Hello world
and use the key guy
, so the words change into xgdsts@dtoll
. 例如:I型Hello world
和使用关键guy
,所以的话变成xgdsts@dtoll
。 If I want to decrypt it, I have to use the same key( guy
) so it'll become hello world
again 如果我想解密它,我必须使用相同的密钥( guy
),这样它将再次成为hello world
您可以使用AES 。
You can use any algorithm you want, if you're willing to implement it. 如果愿意实施, 可以使用任何所需的算法。 If you're asking what algorithms Java provides, the cryptography extension offers (from this list ): 如果您要询问Java提供了哪些算法,则密码扩展提供(从此列表中 ):
I believe all those are symmetric (the encryption and decryption key is the same) except for RSA 我相信所有这些都是对称的 (加密和解密密钥是相同的),除了RSA
Take a look at the Java Cryptography Extension . 看一下Java密码学扩展 。 Here's a simple example . 这是一个简单的例子 。
I would stick to the industry standards - Triple-DES (3DES) or AES, whereby 3DES is slowly being replaced by AES. 我会坚持使用行业标准-Triple-DES(3DES)或AES,由此3DES逐渐被AES取代。 Libraries and source code for various languages are available, tested and validated. 提供,测试和验证了各种语言的库和源代码。
I would use random generated keys for data encryption, and distribute these keys using asymetric methods (RSA) based on public/private key pairs. 我将使用随机生成的密钥进行数据加密,并使用基于公钥/私钥对的非对称方法(RSA)分发这些密钥。
您可以使用任何对称密钥算法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.