Compare commits

..

29 commits

Author SHA1 Message Date
2d9a5646bb
Add test for certifying without ASCII armor 2025-05-06 12:18:05 +02:00
f2d40bba17
Fix formatting issues 2025-04-14 11:02:23 +02:00
9a23ec6bb0
Add test for certifying with revoked key 2025-04-14 11:02:22 +02:00
cc250efc56
Document update key 2025-04-14 11:02:22 +02:00
3f1c0fa54f
SOP update-key: Rename --no-new-mechanisms option to --no-added-capabilities 2025-04-14 11:02:22 +02:00
ebf5866dbd
Improve test 2025-04-14 11:02:22 +02:00
dd8526a0bc
Add basic test for certify-userid and validate-userid subcommands 2025-04-14 11:02:22 +02:00
6a1df7a192
reuse: convert dep5 file to toml file 2025-04-14 11:02:22 +02:00
86ff389388
Add new Exception types 2025-04-14 11:02:21 +02:00
9583c03cd1
Fix formatting 2025-04-14 11:02:21 +02:00
7a04783f12
MergeCertsCmd: Fix default value of armor 2025-04-14 11:02:21 +02:00
dd377619a1
validate-userid: Add --validate-at option 2025-04-14 11:02:21 +02:00
227081f1eb
Remove call to explicitly set bundle to fix native image 2025-04-14 11:02:21 +02:00
6eb8883563
Fix documentation of merge-certs command 2025-04-14 11:02:20 +02:00
68265671a5
Bump version 2025-04-14 11:02:20 +02:00
c311d4106f
Document endOfOptionsDelimiter 2025-04-14 11:02:20 +02:00
bfe2e5f707
Fix nullability of sop commands 2025-04-14 11:02:20 +02:00
d95e28af00
Add first test for new commands 2025-04-14 11:02:20 +02:00
dec1908d59
Show endOfOptions delimiter in help 2025-04-14 11:02:20 +02:00
a8b51d44b9
Implement external variants of new subcommands 2025-04-14 11:02:19 +02:00
e9c2bc8a3b
Checkstyle 2025-04-14 11:02:19 +02:00
e7f04584c8
Implement validate-userid command 2025-04-14 11:02:19 +02:00
d9afc3f2a0
Update msg files with input/output information 2025-04-14 11:02:19 +02:00
8f7a085911
Checkstyle and exception handling improvements 2025-04-14 11:02:19 +02:00
c48a17422f
Implement certify-userid command 2025-04-14 11:02:19 +02:00
7e9a8f61cb
Add support for rendering help info for input and output 2025-04-14 11:02:18 +02:00
03cb8d70f9
Add implementation of merge-certs command 2025-04-14 11:02:18 +02:00
b9964339d1
Add implementation of update-key command 2025-04-14 11:02:18 +02:00
dc92f0b623
Add new exceptions 2025-04-14 11:02:18 +02:00
7 changed files with 35 additions and 150 deletions

View file

@ -6,12 +6,9 @@ SPDX-License-Identifier: Apache-2.0
# Changelog # Changelog
## 10.1.1 ## 10.1.1-SNAPSHOT
- Prepare jar files for use in native images, e.g. using GraalVM by generating and including - Prepare jar files for use in native images, e.g. using GraalVM by generating and including
configuration files for reflection, resources and dynamic proxies. 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 ## 10.1.0
- `sop-java`: - `sop-java`:

View file

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

View file

@ -1,18 +0,0 @@
// 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

@ -1,26 +0,0 @@
// 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

@ -1,101 +0,0 @@
// 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

@ -0,0 +1,12 @@
// 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

@ -0,0 +1,21 @@
// 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
}
}