java - org.springframework doesn't contain CIpher
问题描述
I want to import cipher from org.springframework dependency. I have imported it like below,
import org.springframework.security.crypto.keygen.KeyGenerators;
import org.springframework.security.crypto.encrypt.CipherUtils.Cipher;
import org.springframework.security.crypto.encrypt.SecretKey;
but there's an error throwing saying that,
Error:(25,63) java: package org.springframework.security.crypto.encrypt.CipherUtils does not exist
Then I tried
import org.springframework.security.crypto.keygen.KeyGenerators;
import org.springframework.security.crypto.encrypt.Cipher;
import org.springframework.security.crypto.encrypt.SecretKey;
I still get the below error,
Error:(25,51) java: cannot find symbol
I want cipher to use encryption and decryption of my otp and expiry date. How can I import cipher from org.springframework
解决方案
类org.springframework.security.crypto.encrypt.CipherUtils
不包含内部类Cipher
,包org.springframework.security.crypto.encrypt
也不包含类Cipher
。
类org.springframework.security.crypto.encrypt.CipherUtils
使用javax.crypto.Cipher
类,你也必须使用这个类。
推荐阅读
- c++ - 我在 attiny44 (A) 上使用 LoRa-SX1278,我的 SPI 连接不稳定。有时节点发送帧,有时不发送
- python - 如何使用正则表达式和 lambda 表达式更改 DataFrame 列 dtype?
- python - 如何在 Python 中使用 pd.read_html() 从网站中提取表格数据而不会出错?
- python - Django objects.get for 循环问题
- javascript - 有没有办法同时使用内联键盘和评论按钮?
- c# - 匹配 LaTeX 命令并将它们转换为 XML 标签
- javascript - 此路由不支持 POST 方法。支持的方法:GET、HEAD。- {Ajax、jQuery、Laravel}
- azure-web-app-service - 使用补丁包模块部署 Azure 应用服务节点
- r - ggobject 不添加所有 geom_vlines
- groovy - Micronaut + GORM 没有深度保存域