shamila
shamila

Reputation: 1330

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

Upvotes: 0

Views: 515

Answers (2)

libalex
libalex

Reputation: 71

Class org.springframework.security.crypto.encrypt.CipherUtils doesn't contain inner class Cipher and package org.springframework.security.crypto.encrypt doesn't contain class Cipher too.

Class org.springframework.security.crypto.encrypt.CipherUtils use the javax.crypto.Cipher class and You must use this class too.

Upvotes: 2

Hemant
Hemant

Reputation: 1438

Error:(25,63) java: package org.springframework.security.crypto.encrypt.CipherUtils does not exist

You receive this error because CipherUtils is a class.

Use import org.springframework.security.crypto.encrypt.CipherUtils; if you want to use this class.

Error:(25,51) java: cannot find symbol

You receive this error because you Cipher doesn't exist here

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

Use import javax.crypto.Cipher;

Upvotes: 1

Related Questions