java - 我看不懂的加密代码段

标签 java encryption aes

我正在阅读有关加密的内容,并且很难理解加密程序的这 3 个 Java 语句。

    cipher = Cipher.getInstance("AES");

    cipher.init(Cipher.ENCRYPT_MODE, skeySpec);

    encrypted = cipher.doFinal(str.getBytes())

有人可以帮忙吗?

最佳答案

简单来说,

  • create a new Encrypting Device using the AES algorithm;
  • make it ready
  • get the bytes of the string str and encrypt them; return the result into the encrypted object, whatever that is.

你到底不明白什么?

关于java - 我看不懂的加密代码段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1913244/

相关文章:

java - 使用 LinkedHashSet 存储随机数但有重复

java - php 和 java 之间具有零填充加密结果的不同 AES128

java - 无法修复 "Error: Input length must be a multiple of 16 when decrypting with a pad cipher"

Java - 使用 JSch 通过 ssh 隧道连接到 mysql 数据库

java - Java 13 SE 规范不需要缓存装箱的 Byte 对象吗?

c - C 语言的简单凯撒密码程序

security - Heroku dynos 容易受到 BEAST 的攻击吗? (TLS 1.0 CBC 利用)

php - 3DES PHP 加密无法正确解密

java - 我可以在不同的 jre 实现中使用 java keytool 生成的 keystore 吗

java - 运行示例代码时找不到 URL