{"record":{"id":"5e2ec8b18091f375","repo":"signalapp/Signal-Server","slug":"could-not-parse-identity-key-as-a-base64-encoded-v","errorCode":null,"errorMessage":"Could not parse identity key as a base64-encoded value","messagePattern":"Could not parse identity key as a base64-encoded value","errorType":"validation","errorClass":"JsonParseException","httpStatus":400,"severity":"error","filePath":"service/src/main/java/org/whispersystems/textsecuregcm/util/IdentityKeyAdapter.java","lineNumber":42,"sourceCode":"    @Override\n    public void serialize(final IdentityKey identityKey,\n        final JsonGenerator jsonGenerator,\n        final SerializerProvider serializers) throws IOException {\n\n      jsonGenerator.writeString(Base64.getEncoder().encodeToString(identityKey.serialize()));\n    }\n  }\n\n  public static class Deserializer extends JsonDeserializer<IdentityKey> {\n\n    @Override\n    public IdentityKey deserialize(final JsonParser parser, final DeserializationContext context) throws IOException {\n      final byte[] identityKeyBytes;\n\n      try {\n        identityKeyBytes = Base64.getDecoder().decode(parser.getValueAsString());\n      } catch (final IllegalArgumentException e) {\n        throw new JsonParseException(parser, \"Could not parse identity key as a base64-encoded value\", e);\n      }\n\n      if (identityKeyBytes.length == 0) {\n        return null;\n      }\n\n      try {\n        return new IdentityKey(identityKeyBytes);\n      } catch (final InvalidKeyException e) {\n        throw new JsonParseException(parser, \"Could not interpret identity key bytes as an EC public key\", e);\n      }\n    }\n  }\n}\n","sourceCodeStart":24,"sourceCodeEnd":57,"githubUrl":"https://github.com/signalapp/Signal-Server/blob/100ab61c82627582c867d19e1c0561ba2781e927/service/src/main/java/org/whispersystems/textsecuregcm/util/IdentityKeyAdapter.java#L24-L57","documentation":"Thrown by IdentityKeyAdapter.Deserializer when the JSON string value of an identity-key field fails Base64 decoding: Base64.getDecoder().decode throws IllegalArgumentException, which is caught and rethrown as a JsonParseException. The faulting input is the identity key JSON property, which must be standard Base64 of the serialized IdentityKey bytes.","triggerScenarios":"Thrown at service/src/main/java/org/whispersystems/textsecuregcm/util/IdentityKeyAdapter.java:42 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the identity key JSON value is a valid standard-Base64 string","Verify the client encodes the IdentityKey with Base64.getEncoder().encodeToString(identityKey.serialize())","Check the payload is not empty, hex-encoded, or URL-safe Base64"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"100ab61c82627582c867d19e1c0561ba2781e927","analyzedAt":"2026-09-09T13:29:47.883Z","contentChangedAt":"2026-09-09T13:29:47.883Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}