Compare commits

..

39 commits

Author SHA1 Message Date
7c4b4a4ddb
Remove unused import 2025-05-13 15:37:48 +02:00
fd789c8652
Remove println statements 2025-05-13 15:36:36 +02:00
a71f4162a2
Add MergeCertsTest 2025-05-13 15:16:30 +02:00
563542b88a
Add test for certifying without ASCII armor 2025-05-13 14:23:49 +02:00
9a20b48f02
Fix formatting issues 2025-05-13 14:23:49 +02:00
c17a922594
Add test for certifying with revoked key 2025-05-13 14:23:49 +02:00
560da4fb8d
Document update key 2025-05-13 14:23:48 +02:00
655f9ac134
SOP update-key: Rename --no-new-mechanisms option to --no-added-capabilities 2025-05-13 14:23:48 +02:00
4b00369194
Improve test 2025-05-13 14:23:48 +02:00
3ccd83f795
Add basic test for certify-userid and validate-userid subcommands 2025-05-13 14:23:48 +02:00
61f2b93a5b
reuse: convert dep5 file to toml file 2025-05-13 14:23:47 +02:00
9fe49319f8
Add new Exception types 2025-05-13 14:23:26 +02:00
cedded2e79
Fix formatting 2025-05-13 14:23:25 +02:00
c09d548bea
MergeCertsCmd: Fix default value of armor 2025-05-13 14:23:25 +02:00
e306cf7345
validate-userid: Add --validate-at option 2025-05-13 14:23:25 +02:00
96593354e0
Remove call to explicitly set bundle to fix native image 2025-05-13 14:23:25 +02:00
b0ff1856a7
Fix documentation of merge-certs command 2025-05-13 14:23:25 +02:00
c8626e77ed
Bump version 2025-05-13 14:23:24 +02:00
91131f114d
Document endOfOptionsDelimiter 2025-05-13 14:23:01 +02:00
0d8f6d7f10
Fix nullability of sop commands 2025-05-13 14:23:01 +02:00
d490ada270
Add first test for new commands 2025-05-13 14:23:01 +02:00
1254a867a7
Show endOfOptions delimiter in help 2025-05-13 14:23:01 +02:00
3d2adab35d
Implement external variants of new subcommands 2025-05-13 14:23:01 +02:00
8e3f7ecd4d
Checkstyle 2025-05-13 14:23:00 +02:00
f4fe1cdac9
Implement validate-userid command 2025-05-13 14:23:00 +02:00
fe431070a4
Update msg files with input/output information 2025-05-13 14:23:00 +02:00
48689ca406
Checkstyle and exception handling improvements 2025-05-13 14:23:00 +02:00
158cf28412
Implement certify-userid command 2025-05-13 14:23:00 +02:00
62d9cd1991
Add support for rendering help info for input and output 2025-05-13 14:22:59 +02:00
a98afb1755
Add implementation of merge-certs command 2025-05-13 14:22:59 +02:00
bd692c7309
Add implementation of update-key command 2025-05-13 14:22:59 +02:00
aa8c2be25a
Add new exceptions 2025-05-13 14:22:58 +02:00
cbeec9c90d
SOP-Java 10.1.2-SNAPSHOT 2025-04-14 11:44:22 +02:00
701f9453ca
SOP-Java 10.1.1 2025-04-14 11:41:50 +02:00
2d99aea4ab
Bump animalsniffer to 2.0.0 2025-04-14 11:29:04 +02:00
4d2876a296
Fix formatting issue 2025-04-14 11:28:14 +02:00
e3fe9410d7
reuse: Migrate to toml format 2025-04-14 11:27:54 +02:00
a2a3bda2b3
Migrate AbortOnUnsupportedOption annotation back to java 2025-04-14 11:26:09 +02:00
cddc92bd92
Update changelog 2025-04-14 11:13:40 +02:00
7 changed files with 150 additions and 35 deletions

View file

@ -6,9 +6,12 @@ SPDX-License-Identifier: Apache-2.0
# Changelog
## 10.1.1-SNAPSHOT
## 10.1.1
- Prepare jar files for use in native images, e.g. using GraalVM by generating and including
configuration files for reflection, resources and dynamic proxies.
- gradle: Make use of jvmToolchain functionality
- gradle: Improve reproducibility
- gradle: Bump animalsniffer to `2.0.0`
## 10.1.0
- `sop-java`:

View file

@ -18,7 +18,7 @@ buildscript {
}
plugins {
id 'ru.vyarus.animalsniffer' version '1.5.3'
id 'ru.vyarus.animalsniffer' version '2.0.0'
id 'org.jetbrains.kotlin.jvm' version "1.9.21"
id 'com.diffplug.spotless' version '6.22.0' apply false
}

View file

@ -0,0 +1,18 @@
// SPDX-FileCopyrightText: 2025 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package sop.testsuite;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface AbortOnUnsupportedOption {
}

View file

@ -0,0 +1,26 @@
// SPDX-FileCopyrightText: 2025 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package sop.testsuite;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.TestExecutionExceptionHandler;
import sop.exception.SOPGPException;
import java.lang.annotation.Annotation;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
public class AbortOnUnsupportedOptionExtension implements TestExecutionExceptionHandler {
@Override
public void handleTestExecutionException(ExtensionContext extensionContext, Throwable throwable) throws Throwable {
Class<?> testClass = extensionContext.getRequiredTestClass();
Annotation annotation = testClass.getAnnotation(AbortOnUnsupportedOption.class);
if (annotation != null && throwable instanceof SOPGPException.UnsupportedOption) {
assumeTrue(false, "Test aborted due to: " + throwable.getMessage());
}
throw throwable;
}
}

View file

@ -0,0 +1,101 @@
// SPDX-FileCopyrightText: 2025 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package sop.testsuite.operation;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import sop.SOP;
import java.io.IOException;
import java.util.stream.Stream;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
public class MergeCertsTest extends AbstractSOPTest {
static Stream<Arguments> provideInstances() {
return provideBackends();
}
@ParameterizedTest
@MethodSource("provideInstances")
public void testMergeWithItself(SOP sop) throws IOException {
byte[] key = sop.generateKey()
.noArmor()
.userId("Alice <alice@pgpainless.org>")
.generate()
.getBytes();
byte[] cert = sop.extractCert()
.noArmor()
.key(key)
.getBytes();
byte[] merged = sop.mergeCerts()
.noArmor()
.updates(cert)
.baseCertificates(cert)
.getBytes();
assertArrayEquals(cert, merged);
}
@ParameterizedTest
@MethodSource("provideInstances")
public void testApplyBaseToUpdate(SOP sop) throws IOException {
byte[] key = sop.generateKey()
.noArmor()
.userId("Alice <alice@pgpainless.org>")
.generate()
.getBytes();
byte[] cert = sop.extractCert()
.noArmor()
.key(key)
.getBytes();
byte[] update = sop.revokeKey()
.noArmor()
.keys(key)
.getBytes();
byte[] merged = sop.mergeCerts()
.noArmor()
.updates(cert)
.baseCertificates(update)
.getBytes();
assertArrayEquals(update, merged);
}
@ParameterizedTest
@MethodSource("provideInstances")
public void testApplyUpdateToBase(SOP sop) throws IOException {
byte[] key = sop.generateKey()
.noArmor()
.userId("Alice <alice@pgpainless.org>")
.generate()
.getBytes();
byte[] cert = sop.extractCert()
.noArmor()
.key(key)
.getBytes();
byte[] update = sop.revokeKey()
.noArmor()
.keys(key)
.getBytes();
byte[] merged = sop.mergeCerts()
.noArmor()
.updates(update)
.baseCertificates(cert)
.getBytes();
assertArrayEquals(update, merged);
}
}

View file

@ -1,12 +0,0 @@
// SPDX-FileCopyrightText: 2024 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package sop.testsuite
import java.lang.annotation.Inherited
@Target(AnnotationTarget.TYPE)
@Retention(AnnotationRetention.RUNTIME)
@Inherited
annotation class AbortOnUnsupportedOption

View file

@ -1,21 +0,0 @@
// SPDX-FileCopyrightText: 2024 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package sop.testsuite
import org.junit.jupiter.api.Assumptions
import org.junit.jupiter.api.extension.ExtensionContext
import org.junit.jupiter.api.extension.TestExecutionExceptionHandler
import sop.exception.SOPGPException
class AbortOnUnsupportedOptionExtension : TestExecutionExceptionHandler {
override fun handleTestExecutionException(context: ExtensionContext, throwable: Throwable) {
val testClass = context.requiredTestClass
val annotation = testClass.getAnnotation(AbortOnUnsupportedOption::class.java)
if (annotation != null && SOPGPException.UnsupportedOption::class.isInstance(throwable)) {
Assumptions.assumeTrue(false, "Test aborted due to: " + throwable.message)
}
throw throwable
}
}