diff --git a/pom.xml b/pom.xml
index a2e5ac9..f193862 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,32 +27,32 @@
UTF-8
- 8
+ 17
org.springframework.security
spring-security-crypto
- 5.8.4
+ 6.2.2
org.springframework
spring-core
- 5.3.28
+ 6.1.5
org.bouncycastle
bcprov-jdk18on
- 1.74
+ 1.77
junit
junit
- 4.13.1
+ 4.13.2
test
@@ -71,7 +71,7 @@
org.apache.maven.plugins
maven-surefire-plugin
- 2.22.2
+ 3.2.5
${skipTests}
@@ -86,7 +86,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.10.1
+ 3.12.1
${java.version}
${java.version}
@@ -95,7 +95,7 @@
org.apache.maven.plugins
maven-source-plugin
- 3.2.1
+ 3.3.0
attach-sources
@@ -109,7 +109,7 @@
org.apache.maven.plugins
maven-javadoc-plugin
- 3.4.0
+ 3.6.3
javadoc
diff --git a/src/main/java/org/springframework/security/rsa/crypto/RsaRawEncryptor.java b/src/main/java/org/springframework/security/rsa/crypto/RsaRawEncryptor.java
index f2d9428..64ba95e 100644
--- a/src/main/java/org/springframework/security/rsa/crypto/RsaRawEncryptor.java
+++ b/src/main/java/org/springframework/security/rsa/crypto/RsaRawEncryptor.java
@@ -24,7 +24,6 @@
import java.security.interfaces.RSAPublicKey;
import javax.crypto.Cipher;
-import sun.security.rsa.RSACore;
import org.springframework.security.crypto.encrypt.BytesEncryptor;
import org.springframework.security.crypto.encrypt.TextEncryptor;
@@ -143,7 +142,9 @@ private static byte[] decrypt(byte[] text, RSAPrivateKey key, RsaAlgorithm alg)
ByteArrayOutputStream output = new ByteArrayOutputStream(text.length);
try {
final Cipher cipher = Cipher.getInstance(alg.getJceName());
- int maxLength = RSACore.getByteLength(key);
+ // Calculation from RSACore.getByteLength(RSAKey key)
+ int n = key.getModulus().bitLength();
+ int maxLength = (n + 7) >> 3;
int pos = 0;
while (pos < text.length) {
int limit = Math.min(text.length - pos, maxLength);