summaryrefslogtreecommitdiffstats
path: root/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/Base64Utils.java
diff options
context:
space:
mode:
Diffstat (limited to 'mobile/android/geckoview/src/main/java/org/mozilla/geckoview/Base64Utils.java')
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/geckoview/Base64Utils.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/Base64Utils.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/Base64Utils.java
new file mode 100644
index 0000000000..d135194afa
--- /dev/null
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/Base64Utils.java
@@ -0,0 +1,20 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.geckoview;
+
+import org.mozilla.gecko.annotation.WrapForJNI;
+
+/**
+ * This class exposes the Base64 URL encode/decode functions from Gecko. They are different from
+ * android.util.Base64 in that they always use URL encoding, no padding, and are constant time. The
+ * last bit is important when dealing with values that might be secret as we do with Web Push.
+ */
+/* package */ class Base64Utils {
+ @WrapForJNI
+ public static native byte[] decode(final String data);
+
+ @WrapForJNI
+ public static native String encode(final byte[] data);
+}