You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/manual/src/docs/asciidoc/index.adoc
+11-3Lines changed: 11 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -6671,14 +6671,17 @@ The Encryptors class provides factory methods for constructing symmetric encrypt
6671
6671
6672
6672
[[spring-security-crypto-encryption-bytes]]
6673
6673
==== BytesEncryptor
6674
-
Use the Encryptors.standard factory method to construct a "standard" BytesEncryptor:
6674
+
Use the `Encryptors.stronger` factory method to construct a BytesEncryptor:
6675
6675
6676
6676
[source,java]
6677
6677
----
6678
-
Encryptors.standard("password", "salt");
6678
+
Encryptors.stronger("password", "salt");
6679
6679
----
6680
6680
6681
-
The "standard" encryption method is 256-bit AES using PKCS #5's PBKDF2 (Password-Based Key Derivation Function #2). This method requires Java 6. The password used to generate the SecretKey should be kept in a secure place and not be shared. The salt is used to prevent dictionary attacks against the key in the event your encrypted data is compromised. A 16-byte random initialization vector is also applied so each encrypted message is unique.
6681
+
The "stronger" encryption method creates an encryptor using 256 bit AES encryption with
6682
+
Galois Counter Mode (GCM).
6683
+
It derives the secret key using PKCS #5's PBKDF2 (Password-Based Key Derivation Function #2).
6684
+
This method requires Java 6. The password used to generate the SecretKey should be kept in a secure place and not be shared. The salt is used to prevent dictionary attacks against the key in the event your encrypted data is compromised. A 16-byte random initialization vector is also applied so each encrypted message is unique.
6682
6685
6683
6686
The provided salt should be in hex-encoded String form, be random, and be at least 8 bytes in length. Such a salt may be generated using a KeyGenerator:
6684
6687
@@ -6687,6 +6690,11 @@ The provided salt should be in hex-encoded String form, be random, and be at lea
6687
6690
String salt = KeyGenerators.string().generateKey(); // generates a random 8-byte salt that is then hex-encoded
6688
6691
----
6689
6692
6693
+
Users may also use the `standard` encryption method, which is 256-bit AES in Cipher Block Chaining (CBC) Mode.
6694
+
This mode is not https://en.wikipedia.org/wiki/Authenticated_encryption[authenticated] and does not provide any
6695
+
guarantees about the authenticity of the data.
6696
+
For a more secure alternative, users should prefer `Encryptors.stronger`.
6697
+
6690
6698
[[spring-security-crypto-encryption-text]]
6691
6699
==== TextEncryptor
6692
6700
Use the Encryptors.text factory method to construct a standard TextEncryptor:
0 commit comments