private static com.google.crypto.tink.proto.JwtEcdsaPrivateKey serializePrivateKeyToProto(
      JwtEcdsaPrivateKey key, SecretKeyAccess access) throws GeneralSecurityException {
    int encLength = getEncodingLength(key.getParameters().getAlgorithm());
    return com.google.crypto.tink.proto.JwtEcdsaPrivateKey.newBuilder()
        .setPublicKey(serializePublicKey(key.getPublicKey()))
        .setKeyValue(
            ByteString.copyFrom(
                BigIntegerEncoding.toBigEndianBytesOfFixedLength(
                    key.getPrivateValue().getBigInteger(access), encLength)))
        .build();
  }
Methods to serialize and parse {@link JwtEcdsaPrivateKey}, {@link JwtEcdsaPublicKey}, and {@link
JwtEcdsaParameters} objects.
java_src/src/main/java/com/google/crypto/tink/jwt/JwtEcdsaProtoSerialization.java