mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-19 02:42:05 +01:00
Kotlin conversion: OpenPgpFingerprints
This commit is contained in:
parent
344421a0f4
commit
d36e878bf9
4 changed files with 50 additions and 116 deletions
|
@ -1,58 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
package org.pgpainless.key;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
import org.bouncycastle.openpgp.PGPKeyRing;
|
|
||||||
import org.bouncycastle.openpgp.PGPPublicKey;
|
|
||||||
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
|
||||||
import org.bouncycastle.openpgp.PGPSecretKey;
|
|
||||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class represents a hex encoded, upper case OpenPGP v5 fingerprint.
|
|
||||||
*/
|
|
||||||
public class OpenPgpV5Fingerprint extends _64DigitFingerprint {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an {@link OpenPgpV5Fingerprint}.
|
|
||||||
*
|
|
||||||
* @param fingerprint uppercase hexadecimal fingerprint of length 64
|
|
||||||
*/
|
|
||||||
public OpenPgpV5Fingerprint(@Nonnull String fingerprint) {
|
|
||||||
super(fingerprint);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OpenPgpV5Fingerprint(@Nonnull byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OpenPgpV5Fingerprint(@Nonnull PGPPublicKey key) {
|
|
||||||
super(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OpenPgpV5Fingerprint(@Nonnull PGPSecretKey key) {
|
|
||||||
this(key.getPublicKey());
|
|
||||||
}
|
|
||||||
|
|
||||||
public OpenPgpV5Fingerprint(@Nonnull PGPPublicKeyRing ring) {
|
|
||||||
super(ring);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OpenPgpV5Fingerprint(@Nonnull PGPSecretKeyRing ring) {
|
|
||||||
super(ring);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OpenPgpV5Fingerprint(@Nonnull PGPKeyRing ring) {
|
|
||||||
super(ring);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getVersion() {
|
|
||||||
return 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
package org.pgpainless.key
|
||||||
|
|
||||||
|
import org.bouncycastle.openpgp.PGPKeyRing
|
||||||
|
import org.bouncycastle.openpgp.PGPPublicKey
|
||||||
|
import org.bouncycastle.openpgp.PGPSecretKey
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents a hex encoded uppercase OpenPGP v5 fingerprint.
|
||||||
|
*/
|
||||||
|
class OpenPgpV5Fingerprint: _64DigitFingerprint {
|
||||||
|
|
||||||
|
constructor(fingerprint: String): super(fingerprint)
|
||||||
|
constructor(key: PGPPublicKey): super(key)
|
||||||
|
constructor(key: PGPSecretKey): super(key)
|
||||||
|
constructor(keys: PGPKeyRing): super(keys)
|
||||||
|
constructor(bytes: ByteArray): super(bytes)
|
||||||
|
|
||||||
|
override fun getVersion(): Int {
|
||||||
|
return 5
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,58 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
package org.pgpainless.key;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
import org.bouncycastle.openpgp.PGPKeyRing;
|
|
||||||
import org.bouncycastle.openpgp.PGPPublicKey;
|
|
||||||
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
|
||||||
import org.bouncycastle.openpgp.PGPSecretKey;
|
|
||||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class represents a hex encoded, upper case OpenPGP v6 fingerprint.
|
|
||||||
*/
|
|
||||||
public class OpenPgpV6Fingerprint extends _64DigitFingerprint {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an {@link OpenPgpV6Fingerprint}.
|
|
||||||
*
|
|
||||||
* @param fingerprint uppercase hexadecimal fingerprint of length 64
|
|
||||||
*/
|
|
||||||
public OpenPgpV6Fingerprint(@Nonnull String fingerprint) {
|
|
||||||
super(fingerprint);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OpenPgpV6Fingerprint(@Nonnull byte[] bytes) {
|
|
||||||
super(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OpenPgpV6Fingerprint(@Nonnull PGPPublicKey key) {
|
|
||||||
super(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OpenPgpV6Fingerprint(@Nonnull PGPSecretKey key) {
|
|
||||||
this(key.getPublicKey());
|
|
||||||
}
|
|
||||||
|
|
||||||
public OpenPgpV6Fingerprint(@Nonnull PGPPublicKeyRing ring) {
|
|
||||||
super(ring);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OpenPgpV6Fingerprint(@Nonnull PGPSecretKeyRing ring) {
|
|
||||||
super(ring);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OpenPgpV6Fingerprint(@Nonnull PGPKeyRing ring) {
|
|
||||||
super(ring);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getVersion() {
|
|
||||||
return 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
package org.pgpainless.key
|
||||||
|
|
||||||
|
import org.bouncycastle.openpgp.PGPKeyRing
|
||||||
|
import org.bouncycastle.openpgp.PGPPublicKey
|
||||||
|
import org.bouncycastle.openpgp.PGPSecretKey
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents a hex encoded, uppercase OpenPGP v6 fingerprint.
|
||||||
|
*/
|
||||||
|
class OpenPgpV6Fingerprint: _64DigitFingerprint {
|
||||||
|
|
||||||
|
constructor(fingerprint: String): super(fingerprint)
|
||||||
|
constructor(key: PGPPublicKey): super(key)
|
||||||
|
constructor(key: PGPSecretKey): super(key)
|
||||||
|
constructor(keys: PGPKeyRing): super(keys)
|
||||||
|
constructor(bytes: ByteArray): super(bytes)
|
||||||
|
|
||||||
|
override fun getVersion(): Int {
|
||||||
|
return 6
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue