0

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

4

2 回答 2

2

org.springframework.security.crypto.encrypt.CipherUtils不包含内部类Cipher,包org.springframework.security.crypto.encrypt也不包含类Cipher

org.springframework.security.crypto.encrypt.CipherUtils 使用javax.crypto.Cipher类,你也必须使用这个类。

于 2020-05-26T08:18:45.277 回答
1

错误:(25,63)java:包 org.springframework.security.crypto.encrypt.CipherUtils 不存在

您收到此错误是因为 CipherUtils 是一个类。

如果您想使用import org.springframework.security.crypto.encrypt.CipherUtils;此类,请使用。

错误:(25,51)java:找不到符号

您收到此错误是因为您的密码在此处不存在

import org.springframework.security.crypto.encrypt.Cipher;.

利用import javax.crypto.Cipher;

于 2020-05-26T08:26:49.717 回答