mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-25 04:17:59 +01:00
Please checkstyle
This commit is contained in:
parent
65356ae3ae
commit
8afad6cea8
31 changed files with 172 additions and 20 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot;
|
package org.pgpainless.wot;
|
||||||
|
|
||||||
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot;
|
package org.pgpainless.wot;
|
||||||
|
|
||||||
import pgp.cert_d.PGPCertificateDirectory;
|
import pgp.cert_d.PGPCertificateDirectory;
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PGPainless API for Web of Trust.
|
||||||
|
*/
|
||||||
|
package org.pgpainless.wot;
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra;
|
package org.pgpainless.wot.dijkstra;
|
||||||
|
|
||||||
public class Cost {
|
public class Cost {
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra;
|
package org.pgpainless.wot.dijkstra;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra;
|
package org.pgpainless.wot.dijkstra;
|
||||||
|
|
||||||
public abstract class Edge<T, C extends Cost> implements Comparable<C> {
|
public abstract class Edge<T, C extends Cost> implements Comparable<C> {
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra;
|
package org.pgpainless.wot.dijkstra;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
package org.pgpainless.wot.dijkstra;
|
||||||
|
|
||||||
|
public final class IntegerUtils {
|
||||||
|
|
||||||
|
private IntegerUtils() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Backported method from Java 8.
|
||||||
|
*
|
||||||
|
* @param x x
|
||||||
|
* @param y y
|
||||||
|
* @return result of comparison
|
||||||
|
*/
|
||||||
|
public static int compare(int x, int y) {
|
||||||
|
// noinspection UseCompareMethod
|
||||||
|
return x < y ? -1 : (x == y ? 0 : 1);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra;
|
package org.pgpainless.wot.dijkstra;
|
||||||
|
|
||||||
public class Node<T> {
|
public class Node<T> {
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra;
|
package org.pgpainless.wot.dijkstra;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra;
|
package org.pgpainless.wot.dijkstra;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra;
|
package org.pgpainless.wot.dijkstra;
|
||||||
|
|
||||||
public class SimpleEdge<T> extends Edge<T, Cost.SimpleCost> {
|
public class SimpleEdge<T> extends Edge<T, Cost.SimpleCost> {
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra;
|
package org.pgpainless.wot.dijkstra;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra;
|
package org.pgpainless.wot.dijkstra;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dijkstra-based WoT implementation using a flow network.
|
||||||
|
*/
|
||||||
|
package org.pgpainless.wot.dijkstra;
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra.sq;
|
package org.pgpainless.wot.dijkstra.sq;
|
||||||
|
|
||||||
import org.pgpainless.algorithm.RevocationState;
|
import org.pgpainless.algorithm.RevocationState;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra.sq;
|
package org.pgpainless.wot.dijkstra.sq;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -110,7 +114,7 @@ public class Certification {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the creation time of the certification,
|
* Get the creation time of the certification.
|
||||||
*
|
*
|
||||||
* @return creation time
|
* @return creation time
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra.sq;
|
package org.pgpainless.wot.dijkstra.sq;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -9,7 +13,7 @@ import org.bouncycastle.openpgp.PGPSignature;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class CertificationSet {
|
public final class CertificationSet {
|
||||||
|
|
||||||
private final CertSynopsis issuer;
|
private final CertSynopsis issuer;
|
||||||
private final CertSynopsis target;
|
private final CertSynopsis target;
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra.sq;
|
package org.pgpainless.wot.dijkstra.sq;
|
||||||
|
|
||||||
|
import org.pgpainless.wot.dijkstra.IntegerUtils;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class Depth implements Comparable<Depth> {
|
public final class Depth implements Comparable<Depth> {
|
||||||
|
|
||||||
private final Optional<Integer> depth;
|
private final Optional<Integer> depth;
|
||||||
|
|
||||||
|
@ -55,7 +61,7 @@ public class Depth implements Comparable<Depth> {
|
||||||
if (o.isUnconstrained()) {
|
if (o.isUnconstrained()) {
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
return Integer.compare(getLimit().get(), o.getLimit().get());
|
return IntegerUtils.compare(getLimit().get(), o.getLimit().get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra.sq;
|
package org.pgpainless.wot.dijkstra.sq;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -12,7 +16,6 @@ import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
||||||
import org.bouncycastle.openpgp.PGPSignature;
|
import org.bouncycastle.openpgp.PGPSignature;
|
||||||
import org.pgpainless.algorithm.KeyFlag;
|
import org.pgpainless.algorithm.KeyFlag;
|
||||||
import org.pgpainless.algorithm.RevocationState;
|
import org.pgpainless.algorithm.RevocationState;
|
||||||
import org.pgpainless.algorithm.RevocationStateType;
|
|
||||||
import org.pgpainless.key.OpenPgpFingerprint;
|
import org.pgpainless.key.OpenPgpFingerprint;
|
||||||
import org.pgpainless.key.info.KeyRingInfo;
|
import org.pgpainless.key.info.KeyRingInfo;
|
||||||
import org.pgpainless.key.util.RevocationAttributes;
|
import org.pgpainless.key.util.RevocationAttributes;
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra.sq;
|
package org.pgpainless.wot.dijkstra.sq;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class Optional<T> {
|
public final class Optional<T> {
|
||||||
|
|
||||||
private final T item;
|
private final T item;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra.sq;
|
package org.pgpainless.wot.dijkstra.sq;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra.sq;
|
package org.pgpainless.wot.dijkstra.sq;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra.sq;
|
package org.pgpainless.wot.dijkstra.sq;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra.sq;
|
package org.pgpainless.wot.dijkstra.sq;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -10,7 +14,7 @@ import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import org.bouncycastle.bcpg.sig.RegularExpression;
|
import org.bouncycastle.bcpg.sig.RegularExpression;
|
||||||
|
|
||||||
public class RegexSet {
|
public final class RegexSet {
|
||||||
|
|
||||||
private final Set<String> regexStrings;
|
private final Set<String> regexStrings;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Web of Trust implementation.
|
||||||
|
*/
|
||||||
|
package org.pgpainless.wot.dijkstra.sq;
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra;
|
package org.pgpainless.wot.dijkstra;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra;
|
package org.pgpainless.wot.dijkstra;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra.sq;
|
package org.pgpainless.wot.dijkstra.sq;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
|
@ -1,17 +1,13 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra.sq;
|
package org.pgpainless.wot.dijkstra.sq;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import org.bouncycastle.openpgp.PGPException;
|
|
||||||
import org.bouncycastle.openpgp.PGPPublicKey;
|
|
||||||
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
|
||||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.pgpainless.PGPainless;
|
|
||||||
|
|
||||||
import java.security.InvalidAlgorithmParameterException;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
|
|
||||||
public class NetworkTest {
|
public class NetworkTest {
|
||||||
|
|
||||||
|
@ -29,6 +25,7 @@ public class NetworkTest {
|
||||||
@Test
|
@Test
|
||||||
public void testNetworkFromCertificates() {
|
public void testNetworkFromCertificates() {
|
||||||
ReferenceTime referenceTime = ReferenceTime.now();
|
ReferenceTime referenceTime = ReferenceTime.now();
|
||||||
|
// TODO: Implement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.wot.dijkstra.sq;
|
package org.pgpainless.wot.dijkstra.sq;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -249,6 +253,7 @@ public class WotTestVectors {
|
||||||
})
|
})
|
||||||
.getCertifiedCertificate();
|
.getCertifiedCertificate();
|
||||||
|
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
System.out.println("Foo Employee");
|
System.out.println("Foo Employee");
|
||||||
System.out.println(PGPainless.asciiArmor(caCertifiedFooBankEmployeeCert));
|
System.out.println(PGPainless.asciiArmor(caCertifiedFooBankEmployeeCert));
|
||||||
|
|
||||||
|
@ -263,6 +268,7 @@ public class WotTestVectors {
|
||||||
|
|
||||||
System.out.println("Bar Employee");
|
System.out.println("Bar Employee");
|
||||||
System.out.println(PGPainless.asciiArmor(barCaCertifiedEmployeeCert));
|
System.out.println(PGPainless.asciiArmor(barCaCertifiedEmployeeCert));
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
private static InputStream getTestResourceInputStream(String resource) {
|
private static InputStream getTestResourceInputStream(String resource) {
|
||||||
|
|
Loading…
Reference in a new issue