We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0c923ba commit 898095fCopy full SHA for 898095f
sdk/src/main/java/com/uid2/utils/KeyUtils.kt
@@ -56,6 +56,13 @@ internal interface KeyUtils {
56
}
57
58
override fun generateServerPublicKey(publicKey: String): PublicKey? {
59
+ // Check to make sure the given public key is longer than the expected prefix.
60
+ if (publicKey.length <= SERVER_PUBLIC_KEY_PREFIX_LENGTH) {
61
+ return null
62
+ }
63
+
64
+ // Attempt to decode the given public key. If the key is malformed, or not in the expected Base64 format,
65
+ // null we be returned.
66
val serverPublicKeyBytes =
67
publicKey.substring(SERVER_PUBLIC_KEY_PREFIX_LENGTH).decodeBase64() ?: return null
68
0 commit comments