
public.javadoc.org.spincast.plugins.crypto.SpincastCryptoUtilsDefault.html Maven / Gradle / Ivy
Show all versions of spincast-website Show documentation
SpincastCryptoUtilsDefault (org.spincast:spincast-framework 2.1.1 API)
Package org.spincast.plugins.crypto
Class SpincastCryptoUtilsDefault
java.lang.Object
org.spincast.plugins.crypto.SpincastCryptoUtilsDefault
- All Implemented Interfaces:
SpincastCryptoUtils
-
Field Summary
Fields
-
Constructor Summary
Constructors
-
Method Summary
Modifier and Type
Method
Description
protected byte[]
Decrypts a string that was encrypted using
SpincastCryptoUtils.encrypt(String, String)
.
Encrypts a string, using the given secret key and the
AES
algorithm.
Will generate a new secure salt that can
be used with
SpincastCryptoUtils.hashSecure(String, String)
.
protected SpincastCryptoConfig
hashSecure(String toHash,
String salt)
Will hash a string using BCrypt
.
protected void
init()
boolean
Is the current Java version cryptography restricted?
void
From https://stackoverflow.com/a/22492582/843699
-
Field Details
-
logger
protected static final org.slf4j.Logger logger
-
Constructor Details
-
SpincastCryptoUtilsDefault
-
Method Details
-
getSpincastCryptoConfig
-
init
@Inject
protected void init()
-
encrypt
Description copied from interface: SpincastCryptoUtils
Encrypts a string, using the given secret key and the
AES
algorithm.
The generated encrypted payload
is a string which is also base64 encoded so it can be
used in urls, emails, etc.
You must use the associated SpincastCryptoUtils.decrypt(String, String)
method to decrypt
the resultind payload.
IMPORTANT!: For this method to work,
JCE policy files may be installed first, security must
be configured properly, or security policy must be
disabled using the SpincastCryptoConfig.removeJavaCryptoRestrictionsOnInit()
configuration.
- Specified by:
encrypt
in interface SpincastCryptoUtils
-
decrypt
Description copied from interface: SpincastCryptoUtils
Decrypts a string that was encrypted using
SpincastCryptoUtils.encrypt(String, String)
.
IMPORTANT!: For this method to work,
JCE policy files may be installed first, security must
be configured properly, or security policy must be
disabled using the SpincastCryptoConfig.removeJavaCryptoRestrictionsOnInit()
configuration.
- Specified by:
decrypt
in interface SpincastCryptoUtils
-
buildKey
-
hashSecure
Description copied from interface: SpincastCryptoUtils
Will hash a string using BCrypt
. This is currently
a good way to hash passwords so they can be stored in a database.
You can use SpincastCryptoUtils.generateNewHashSecureSalt()
to generate a
new salt.
- Specified by:
hashSecure
in interface SpincastCryptoUtils
-
generateNewHashSecureSalt
Description copied from interface: SpincastCryptoUtils
Will generate a new secure salt that can
be used with
SpincastCryptoUtils.hashSecure(String, String)
.
- Specified by:
generateNewHashSecureSalt
in interface SpincastCryptoUtils
-
removeCryptographyRestrictions
public void removeCryptographyRestrictions()
From https://stackoverflow.com/a/22492582/843699
- Specified by:
removeCryptographyRestrictions
in interface SpincastCryptoUtils
-
isRestrictedCryptographyJavaVersion
public boolean isRestrictedCryptographyJavaVersion()
Description copied from interface: SpincastCryptoUtils
Is the current Java version cryptography restricted?
- Specified by:
isRestrictedCryptographyJavaVersion
in interface SpincastCryptoUtils