aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-10-01 15:00:22 +0300
committerGravatar Vitaly Takmazov2018-10-01 15:13:04 +0300
commit6ae7c42af78568dba6678ac01301e8a782da8967 (patch)
tree50acf915d7cacbf9684669f9334d71fa739ba6d0 /juick-server/src/main/java/com
parent2d6476aa2526116d246b2f83fc9ceb830e5db975 (diff)
ActivityPub: fix public key serialization
Diffstat (limited to 'juick-server/src/main/java/com')
-rw-r--r--juick-server/src/main/java/com/juick/server/KeystoreManager.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/juick-server/src/main/java/com/juick/server/KeystoreManager.java b/juick-server/src/main/java/com/juick/server/KeystoreManager.java
index 8bf93a7b..75d72e72 100644
--- a/juick-server/src/main/java/com/juick/server/KeystoreManager.java
+++ b/juick-server/src/main/java/com/juick/server/KeystoreManager.java
@@ -14,6 +14,8 @@ import java.io.InputStream;
import java.security.*;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
+import java.util.Arrays;
+import java.util.stream.Collectors;
@Component
public class KeystoreManager {
@@ -60,7 +62,8 @@ public class KeystoreManager {
return null;
}
public String getPublicKey() {
- return String.format("-----BEGIN RSA PUBLIC KEY-----\n%s\n-----END RSA PUBLIC KEY-----\n",
- new String(Base64Utils.encode(getKeyPair().getPublic().getEncoded())));
+ String[] key = Base64Utils.encodeToString(getKeyPair().getPublic().getEncoded()).split("(?<=\\G.{64})");
+ return String.format("-----BEGIN PUBLIC KEY-----\n%s\n-----END PUBLIC KEY-----\n",
+ Arrays.asList(key).stream().collect(Collectors.joining("\n")));
}
}