You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2021/11/04 14:20:33 UTC

[james-project] branch master updated: JAMES-3539 Push crypto keys should be base64 URL encoded (#737)

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git


The following commit(s) were added to refs/heads/master by this push:
     new 2513e8b  JAMES-3539 Push crypto keys should be base64 URL encoded (#737)
2513e8b is described below

commit 2513e8b9c183d2c713d73a896e2fed4697b509af
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Thu Nov 4 21:20:27 2021 +0700

    JAMES-3539 Push crypto keys should be base64 URL encoded (#737)
---
 .../PushSubscriptionSetCreateProcessorTest.scala         | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/pushsubscription/PushSubscriptionSetCreateProcessorTest.scala b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/pushsubscription/PushSubscriptionSetCreateProcessorTest.scala
index ad649b1..b2e5b56 100644
--- a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/pushsubscription/PushSubscriptionSetCreateProcessorTest.scala
+++ b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/pushsubscription/PushSubscriptionSetCreateProcessorTest.scala
@@ -19,10 +19,14 @@
 
 package org.apache.james.jmap.pushsubscription
 
+import java.net.URL
+import java.security.KeyPair
+import java.security.interfaces.ECPublicKey
+import java.util.{Base64, UUID}
+
 import com.google.crypto.tink.subtle.EllipticCurves
 import com.google.crypto.tink.subtle.EllipticCurves.CurveType
 import org.apache.james.jmap.api.model.{PushSubscriptionId, PushSubscriptionKeys, PushSubscriptionServerURL, VerificationCode}
-import org.apache.james.jmap.json.PushSerializer
 import org.apache.james.jmap.method.{PushSubscriptionSetCreateProcessor, PushVerification}
 import org.apache.james.jmap.pushsubscription.PushSubscriptionSetCreateProcessorTest.PUSH_VERIFICATION_SAMPLE
 import org.junit.jupiter.api.extension.ExtendWith
@@ -34,12 +38,6 @@ import org.mockserver.model.JsonBody.json
 import org.mockserver.model.Not.not
 import org.mockserver.model.NottableString.string
 import org.mockserver.verify.VerificationTimes
-import play.api.libs.json.Json
-
-import java.net.URL
-import java.security.KeyPair
-import java.security.interfaces.ECPublicKey
-import java.util.{Base64, UUID}
 
 object PushSubscriptionSetCreateProcessorTest {
   val PUSH_VERIFICATION_SAMPLE: PushVerification = PushVerification(
@@ -87,8 +85,8 @@ class PushSubscriptionSetCreateProcessorTest {
     val uaPublicKey: ECPublicKey = uaKeyPair.getPublic.asInstanceOf[ECPublicKey]
     val authSecret: Array[Byte] = "secret123secret1".getBytes
 
-    val p256dh: String = Base64.getEncoder.encodeToString(uaPublicKey.getEncoded)
-    val auth: String = Base64.getEncoder.encodeToString(authSecret)
+    val p256dh: String = Base64.getUrlEncoder.encodeToString(uaPublicKey.getEncoded)
+    val auth: String = Base64.getUrlEncoder.encodeToString(authSecret)
 
     testee.pushVerificationToPushServer(pushServerUrl, PUSH_VERIFICATION_SAMPLE, Some(PushSubscriptionKeys(p256dh, auth))).block()
     pushServer.verify(request()

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org