diff --git a/external-sop/src/test/java/sop/testsuite/external/ExternalTestSuite.java b/external-sop/src/test/java/sop/testsuite/external/ExternalTestSuite.java index aa0ae82..6e991cf 100644 --- a/external-sop/src/test/java/sop/testsuite/external/ExternalTestSuite.java +++ b/external-sop/src/test/java/sop/testsuite/external/ExternalTestSuite.java @@ -1,7 +1,3 @@ -// SPDX-FileCopyrightText: 2025 Paul Schaub -// -// SPDX-License-Identifier: Apache-2.0 - package sop.testsuite.external; import org.junit.platform.suite.api.IncludeClassNamePatterns; diff --git a/settings.gradle b/settings.gradle index 84dc381..1cb66be 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,6 +7,5 @@ rootProject.name = 'SOP-Java' include 'sop-java', 'sop-java-picocli', 'sop-java-testfixtures', - 'external-sop', - 'sop-java-json-gson' + 'external-sop' diff --git a/sop-java-json-gson/README.md b/sop-java-json-gson/README.md deleted file mode 100644 index 9feb8ff..0000000 --- a/sop-java-json-gson/README.md +++ /dev/null @@ -1,13 +0,0 @@ - - -# SOP-Java-JSON-GSON - -## JSON Parsing VERIFICATION extension JSON using Gson - -Since revision 11, the SOP specification defines VERIFICATIONS extension JSON. - -This module implements the `JSONParser` and `JSONSerializer` interfaces using Googles Gson library. diff --git a/sop-java-json-gson/build.gradle b/sop-java-json-gson/build.gradle deleted file mode 100644 index 4105902..0000000 --- a/sop-java-json-gson/build.gradle +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Paul Schaub -// -// SPDX-License-Identifier: Apache-2.0 - -plugins { - id 'java-library' -} - -group 'org.pgpainless' - -repositories { - mavenCentral() -} - -dependencies { - implementation "org.junit.jupiter:junit-jupiter-api:$junitVersion" - implementation "org.junit.jupiter:junit-jupiter-params:$junitVersion" - runtimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion" - - implementation project(":sop-java") - api "org.slf4j:slf4j-api:$slf4jVersion" - testImplementation "ch.qos.logback:logback-classic:$logbackVersion" - - // @Nonnull, @Nullable... - implementation "com.google.code.findbugs:jsr305:$jsrVersion" - - api "com.google.code.gson:gson:$gsonVersion" -} diff --git a/sop-java-json-gson/src/main/kotlin/sop/GsonParser.kt b/sop-java-json-gson/src/main/kotlin/sop/GsonParser.kt deleted file mode 100644 index 06adecb..0000000 --- a/sop-java-json-gson/src/main/kotlin/sop/GsonParser.kt +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Paul Schaub -// -// SPDX-License-Identifier: Apache-2.0 - -package sop - -import com.google.gson.Gson -import com.google.gson.JsonSyntaxException -import com.google.gson.reflect.TypeToken -import java.text.ParseException - -class GsonParser( - private val gson: Gson = Gson() -) : Verification.JSONParser { - - override fun parse(string: String): Verification.JSON { - try { - return gson.fromJson(string, object : TypeToken(){}.type) - } catch (e: JsonSyntaxException) { - throw ParseException(e.message, 0) - } - } -} \ No newline at end of file diff --git a/sop-java-json-gson/src/main/kotlin/sop/GsonSerializer.kt b/sop-java-json-gson/src/main/kotlin/sop/GsonSerializer.kt deleted file mode 100644 index 410fe49..0000000 --- a/sop-java-json-gson/src/main/kotlin/sop/GsonSerializer.kt +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Paul Schaub -// -// SPDX-License-Identifier: Apache-2.0 - -package sop - -import com.google.gson.Gson - -class GsonSerializer( - private val gson: Gson = Gson() -) : Verification.JSONSerializer { - - override fun serialize(json: Verification.JSON): String { - return gson.toJson(json) - } -} \ No newline at end of file diff --git a/sop-java-json-gson/src/test/kotlin/sop/GsonSerializerAndParserTest.kt b/sop-java-json-gson/src/test/kotlin/sop/GsonSerializerAndParserTest.kt deleted file mode 100644 index 9bbef14..0000000 --- a/sop-java-json-gson/src/test/kotlin/sop/GsonSerializerAndParserTest.kt +++ /dev/null @@ -1,96 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Paul Schaub -// -// SPDX-License-Identifier: Apache-2.0 - -package sop - -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.assertThrows -import java.text.ParseException - -class GsonSerializerAndParserTest { - - private val serializer: GsonSerializer = GsonSerializer() - private val parser: GsonParser = GsonParser() - - @Test - fun simpleSingleTest() { - val before = Verification.JSON("/tmp/alice.pgp") - - val json = serializer.serialize(before) - assertEquals("{\"signers\":[\"/tmp/alice.pgp\"]}", json) - - val after = parser.parse(json) - - assertEquals(before, after) - } - - @Test - fun simpleListTest() { - val before = Verification.JSON(listOf("/tmp/alice.pgp", "/tmp/bob.asc")) - - val json = serializer.serialize(before) - assertEquals("{\"signers\":[\"/tmp/alice.pgp\",\"/tmp/bob.asc\"]}", json) - - val after = parser.parse(json) - - assertEquals(before, after) - } - - @Test - fun withCommentTest() { - val before = Verification.JSON( - listOf("/tmp/alice.pgp"), - "This is a comment.", - null) - - val json = serializer.serialize(before) - assertEquals("{\"signers\":[\"/tmp/alice.pgp\"],\"comment\":\"This is a comment.\"}", json) - - val after = parser.parse(json) - - assertEquals(before, after) - } - - @Test - fun withExtStringTest() { - val before = Verification.JSON( - listOf("/tmp/alice.pgp"), - "This is a comment.", - "This is an ext object string.") - - val json = serializer.serialize(before) - assertEquals("{\"signers\":[\"/tmp/alice.pgp\"],\"comment\":\"This is a comment.\",\"ext\":\"This is an ext object string.\"}", json) - - val after = parser.parse(json) - - assertEquals(before, after) - } - - @Test - fun withExtListTest() { - val before = Verification.JSON( - listOf("/tmp/alice.pgp"), - "This is a comment.", - listOf(1.0,2.0,3.0)) - - val json = serializer.serialize(before) - assertEquals("{\"signers\":[\"/tmp/alice.pgp\"],\"comment\":\"This is a comment.\",\"ext\":[1.0,2.0,3.0]}", json) - - val after = parser.parse(json) - - assertEquals(before, after) - } - - @Test - fun parseInvalidJSON() { - assertThrows { parser.parse("Invalid") } - } - - @Test - fun parseMalformedJSON() { - // Missing '}' - assertThrows { parser.parse("{\"signers\":[\"Alice\"]") } - } -} \ No newline at end of file diff --git a/sop-java/src/main/kotlin/sop/SOPV.kt b/sop-java/src/main/kotlin/sop/SOPV.kt index d483194..27eb6e3 100644 --- a/sop-java/src/main/kotlin/sop/SOPV.kt +++ b/sop-java/src/main/kotlin/sop/SOPV.kt @@ -12,41 +12,27 @@ import sop.operation.Version /** Subset of [SOP] implementing only OpenPGP signature verification. */ interface SOPV { - /** - * Get information about the implementations name and version. - * - * @since sopv 1.0 - */ + /** Get information about the implementations name and version. */ fun version(): Version? /** * Verify detached signatures. If you need to verify an inline-signed message, use * [inlineVerify] instead. - * - * @since sopv 1.0 */ fun verify(): DetachedVerify? = detachedVerify() /** * Verify detached signatures. If you need to verify an inline-signed message, use * [inlineVerify] instead. - * - * @since sopv 1.0 */ fun detachedVerify(): DetachedVerify? /** * Verify signatures of an inline-signed message. If you need to verify detached signatures over * a message, use [detachedVerify] instead. - * - * @since sopv 1.0 */ fun inlineVerify(): InlineVerify? - /** - * Validate a UserID in an OpenPGP certificate. - * - * @since sopv 1.2 - */ + /** Validate a UserID in an OpenPGP certificate. */ fun validateUserId(): ValidateUserId? }