mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-29 07:42:06 +01:00
Rename XDH to XDH_LEGACY
This commit is contained in:
parent
a898323209
commit
b756de3082
20 changed files with 48 additions and 48 deletions
|
@ -25,7 +25,7 @@ import org.pgpainless.algorithm.KeyFlag;
|
||||||
import org.pgpainless.key.generation.KeySpec;
|
import org.pgpainless.key.generation.KeySpec;
|
||||||
import org.pgpainless.key.generation.type.KeyType;
|
import org.pgpainless.key.generation.type.KeyType;
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec;
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import sop.exception.SOPGPException;
|
import sop.exception.SOPGPException;
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ public class RoundTripEncryptDecryptCmdTest extends CLITest {
|
||||||
.addUserId("Cannot Sign <cannot@sign.key>")
|
.addUserId("Cannot Sign <cannot@sign.key>")
|
||||||
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER))
|
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER))
|
||||||
.addSubkey(KeySpec.getBuilder(
|
.addSubkey(KeySpec.getBuilder(
|
||||||
KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE))
|
KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE))
|
||||||
.build();
|
.build();
|
||||||
File keyFile = writeFile("key.pgp", secretKeys.getEncoded());
|
File keyFile = writeFile("key.pgp", secretKeys.getEncoded());
|
||||||
File certFile = writeFile("cert.pgp", PGPainless.extractCertificate(secretKeys).getEncoded());
|
File certFile = writeFile("cert.pgp", PGPainless.extractCertificate(secretKeys).getEncoded());
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.pgpainless.key.OpenPgpV4Fingerprint;
|
||||||
import org.pgpainless.key.generation.KeySpec;
|
import org.pgpainless.key.generation.KeySpec;
|
||||||
import org.pgpainless.key.generation.type.KeyType;
|
import org.pgpainless.key.generation.type.KeyType;
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec;
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec;
|
||||||
import org.pgpainless.key.info.KeyRingInfo;
|
import org.pgpainless.key.info.KeyRingInfo;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import sop.exception.SOPGPException;
|
import sop.exception.SOPGPException;
|
||||||
|
@ -203,7 +203,7 @@ public class RoundTripSignVerifyCmdTest extends CLITest {
|
||||||
PGPSecretKeyRing secretKeys = PGPainless.buildKeyRing()
|
PGPSecretKeyRing secretKeys = PGPainless.buildKeyRing()
|
||||||
.addUserId("Cannot Sign <cannot@sign.key>")
|
.addUserId("Cannot Sign <cannot@sign.key>")
|
||||||
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER))
|
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE))
|
.addSubkey(KeySpec.getBuilder(KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE))
|
||||||
.build();
|
.build();
|
||||||
File keyFile = writeFile("key.pgp", secretKeys.getEncoded());
|
File keyFile = writeFile("key.pgp", secretKeys.getEncoded());
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.pgpainless.key.generation.KeySpec.Companion.getBuilder
|
||||||
import org.pgpainless.key.generation.type.KeyType
|
import org.pgpainless.key.generation.type.KeyType
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve
|
||||||
import org.pgpainless.key.generation.type.rsa.RsaLength
|
import org.pgpainless.key.generation.type.rsa.RsaLength
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec
|
||||||
import org.pgpainless.util.Passphrase
|
import org.pgpainless.util.Passphrase
|
||||||
|
|
||||||
class KeyRingTemplates {
|
class KeyRingTemplates {
|
||||||
|
@ -136,7 +136,7 @@ class KeyRingTemplates {
|
||||||
KeyFlag.SIGN_DATA))
|
KeyFlag.SIGN_DATA))
|
||||||
addSubkey(
|
addSubkey(
|
||||||
getBuilder(
|
getBuilder(
|
||||||
KeyType.XDH(XDHSpec._X25519),
|
KeyType.XDH_LEGACY(XDHLegacySpec._X25519),
|
||||||
KeyFlag.ENCRYPT_STORAGE,
|
KeyFlag.ENCRYPT_STORAGE,
|
||||||
KeyFlag.ENCRYPT_COMMS))
|
KeyFlag.ENCRYPT_COMMS))
|
||||||
setPassphrase(passphrase)
|
setPassphrase(passphrase)
|
||||||
|
@ -184,7 +184,7 @@ class KeyRingTemplates {
|
||||||
KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER))
|
KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER))
|
||||||
addSubkey(
|
addSubkey(
|
||||||
getBuilder(
|
getBuilder(
|
||||||
KeyType.XDH(XDHSpec._X25519),
|
KeyType.XDH_LEGACY(XDHLegacySpec._X25519),
|
||||||
KeyFlag.ENCRYPT_COMMS,
|
KeyFlag.ENCRYPT_COMMS,
|
||||||
KeyFlag.ENCRYPT_STORAGE))
|
KeyFlag.ENCRYPT_STORAGE))
|
||||||
addSubkey(
|
addSubkey(
|
||||||
|
|
|
@ -13,8 +13,8 @@ import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacy
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve
|
||||||
import org.pgpainless.key.generation.type.rsa.RSA
|
import org.pgpainless.key.generation.type.rsa.RSA
|
||||||
import org.pgpainless.key.generation.type.rsa.RsaLength
|
import org.pgpainless.key.generation.type.rsa.RsaLength
|
||||||
import org.pgpainless.key.generation.type.xdh.XDH
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacy
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec
|
||||||
|
|
||||||
@Suppress("INAPPLICABLE_JVM_NAME") // https://youtrack.jetbrains.com/issue/KT-31420
|
@Suppress("INAPPLICABLE_JVM_NAME") // https://youtrack.jetbrains.com/issue/KT-31420
|
||||||
interface KeyType {
|
interface KeyType {
|
||||||
|
@ -103,6 +103,6 @@ interface KeyType {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun EDDSA_LEGACY(curve: EdDSALegacyCurve): EdDSALegacy = EdDSALegacy.fromCurve(curve)
|
fun EDDSA_LEGACY(curve: EdDSALegacyCurve): EdDSALegacy = EdDSALegacy.fromCurve(curve)
|
||||||
|
|
||||||
@JvmStatic fun XDH(curve: XDHSpec): XDH = XDH.fromSpec(curve)
|
@JvmStatic fun XDH_LEGACY(curve: XDHLegacySpec): XDHLegacy = XDHLegacy.fromSpec(curve)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,19 +2,19 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.key.generation.type.xdh
|
package org.pgpainless.key.generation.type.xdh_legacy
|
||||||
|
|
||||||
import org.bouncycastle.jce.spec.ECNamedCurveGenParameterSpec
|
import org.bouncycastle.jce.spec.ECNamedCurveGenParameterSpec
|
||||||
import org.pgpainless.algorithm.PublicKeyAlgorithm
|
import org.pgpainless.algorithm.PublicKeyAlgorithm
|
||||||
import org.pgpainless.key.generation.type.KeyType
|
import org.pgpainless.key.generation.type.KeyType
|
||||||
|
|
||||||
class XDH private constructor(spec: XDHSpec) : KeyType {
|
class XDHLegacy private constructor(spec: XDHLegacySpec) : KeyType {
|
||||||
override val name = "XDH"
|
override val name = "XDH"
|
||||||
override val algorithm = PublicKeyAlgorithm.ECDH
|
override val algorithm = PublicKeyAlgorithm.ECDH
|
||||||
override val bitStrength = spec.bitStrength
|
override val bitStrength = spec.bitStrength
|
||||||
override val algorithmSpec = ECNamedCurveGenParameterSpec(spec.algorithmName)
|
override val algorithmSpec = ECNamedCurveGenParameterSpec(spec.algorithmName)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic fun fromSpec(spec: XDHSpec) = XDH(spec)
|
@JvmStatic fun fromSpec(spec: XDHLegacySpec) = XDHLegacy(spec)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,9 +2,9 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package org.pgpainless.key.generation.type.xdh
|
package org.pgpainless.key.generation.type.xdh_legacy
|
||||||
|
|
||||||
enum class XDHSpec(val algorithmName: String, val curveName: String, val bitStrength: Int) {
|
enum class XDHLegacySpec(val algorithmName: String, val curveName: String, val bitStrength: Int) {
|
||||||
_X25519("X25519", "curve25519", 256),
|
_X25519("X25519", "curve25519", 256),
|
||||||
;
|
;
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.pgpainless.key.SubkeyIdentifier;
|
||||||
import org.pgpainless.key.generation.KeySpec;
|
import org.pgpainless.key.generation.KeySpec;
|
||||||
import org.pgpainless.key.generation.type.KeyType;
|
import org.pgpainless.key.generation.type.KeyType;
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec;
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec;
|
||||||
import org.pgpainless.key.util.KeyRingUtils;
|
import org.pgpainless.key.util.KeyRingUtils;
|
||||||
import org.pgpainless.util.Passphrase;
|
import org.pgpainless.util.Passphrase;
|
||||||
|
|
||||||
|
@ -53,9 +53,9 @@ public class EncryptionOptionsTest {
|
||||||
secretKeys = PGPainless.buildKeyRing()
|
secretKeys = PGPainless.buildKeyRing()
|
||||||
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER)
|
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER)
|
||||||
.build())
|
.build())
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_COMMS)
|
.addSubkey(KeySpec.getBuilder(KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.ENCRYPT_COMMS)
|
||||||
.build())
|
.build())
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_STORAGE)
|
.addSubkey(KeySpec.getBuilder(KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.ENCRYPT_STORAGE)
|
||||||
.build())
|
.build())
|
||||||
.addUserId("test@pgpainless.org")
|
.addUserId("test@pgpainless.org")
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.pgpainless.key.generation.KeySpec;
|
||||||
import org.pgpainless.key.generation.type.KeyType;
|
import org.pgpainless.key.generation.type.KeyType;
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
||||||
import org.pgpainless.key.generation.type.rsa.RsaLength;
|
import org.pgpainless.key.generation.type.rsa.RsaLength;
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec;
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec;
|
||||||
import org.pgpainless.key.protection.SecretKeyRingProtector;
|
import org.pgpainless.key.protection.SecretKeyRingProtector;
|
||||||
import org.pgpainless.util.MultiMap;
|
import org.pgpainless.util.MultiMap;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class MultiSigningSubkeyTest {
|
||||||
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER, KeyFlag.SIGN_DATA))
|
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER, KeyFlag.SIGN_DATA))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.SIGN_DATA))
|
.addSubkey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.SIGN_DATA))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.RSA(RsaLength._3072), KeyFlag.SIGN_DATA))
|
.addSubkey(KeySpec.getBuilder(KeyType.RSA(RsaLength._3072), KeyFlag.SIGN_DATA))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE))
|
.addSubkey(KeySpec.getBuilder(KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE))
|
||||||
.addUserId("Alice <alice@pgpainless.org>")
|
.addUserId("Alice <alice@pgpainless.org>")
|
||||||
.build();
|
.build();
|
||||||
signingCert = PGPainless.extractCertificate(signingKey);
|
signingCert = PGPainless.extractCertificate(signingKey);
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.pgpainless.key.generation.type.KeyType;
|
||||||
import org.pgpainless.key.generation.type.ecc.EllipticCurve;
|
import org.pgpainless.key.generation.type.ecc.EllipticCurve;
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
||||||
import org.pgpainless.key.generation.type.rsa.RsaLength;
|
import org.pgpainless.key.generation.type.rsa.RsaLength;
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec;
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec;
|
||||||
import org.pgpainless.key.info.KeyInfo;
|
import org.pgpainless.key.info.KeyInfo;
|
||||||
import org.pgpainless.key.util.UserId;
|
import org.pgpainless.key.util.UserId;
|
||||||
import org.pgpainless.util.Passphrase;
|
import org.pgpainless.util.Passphrase;
|
||||||
|
@ -73,7 +73,7 @@ public class BrainpoolKeyGenerationTest {
|
||||||
KeyType.ECDSA(EllipticCurve._BRAINPOOLP384R1), KeyFlag.CERTIFY_OTHER))
|
KeyType.ECDSA(EllipticCurve._BRAINPOOLP384R1), KeyFlag.CERTIFY_OTHER))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.SIGN_DATA))
|
.addSubkey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.SIGN_DATA))
|
||||||
.addSubkey(KeySpec.getBuilder(
|
.addSubkey(KeySpec.getBuilder(
|
||||||
KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE))
|
KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE))
|
||||||
.addSubkey(KeySpec.getBuilder(
|
.addSubkey(KeySpec.getBuilder(
|
||||||
KeyType.RSA(RsaLength._3072), KeyFlag.SIGN_DATA))
|
KeyType.RSA(RsaLength._3072), KeyFlag.SIGN_DATA))
|
||||||
.addUserId(UserId.nameAndEmail("Alice", "alice@pgpainless.org"))
|
.addUserId(UserId.nameAndEmail("Alice", "alice@pgpainless.org"))
|
||||||
|
@ -104,7 +104,7 @@ public class BrainpoolKeyGenerationTest {
|
||||||
|
|
||||||
PGPSecretKey xdhSub = iterator.next();
|
PGPSecretKey xdhSub = iterator.next();
|
||||||
KeyInfo xdhInfo = new KeyInfo(xdhSub);
|
KeyInfo xdhInfo = new KeyInfo(xdhSub);
|
||||||
assertEquals(XDHSpec._X25519.getCurveName(), xdhInfo.getCurveName());
|
assertEquals(XDHLegacySpec._X25519.getCurveName(), xdhInfo.getCurveName());
|
||||||
assertEquals(256, xdhSub.getPublicKey().getBitStrength());
|
assertEquals(256, xdhSub.getPublicKey().getBitStrength());
|
||||||
|
|
||||||
PGPSecretKey rsaSub = iterator.next();
|
PGPSecretKey rsaSub = iterator.next();
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.pgpainless.PGPainless;
|
||||||
import org.pgpainless.algorithm.KeyFlag;
|
import org.pgpainless.algorithm.KeyFlag;
|
||||||
import org.pgpainless.key.generation.type.KeyType;
|
import org.pgpainless.key.generation.type.KeyType;
|
||||||
import org.pgpainless.key.generation.type.ecc.EllipticCurve;
|
import org.pgpainless.key.generation.type.ecc.EllipticCurve;
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec;
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec;
|
||||||
import org.pgpainless.util.TestAllImplementations;
|
import org.pgpainless.util.TestAllImplementations;
|
||||||
|
|
||||||
public class CertificationKeyMustBeAbleToCertifyTest {
|
public class CertificationKeyMustBeAbleToCertifyTest {
|
||||||
|
@ -29,7 +29,7 @@ public class CertificationKeyMustBeAbleToCertifyTest {
|
||||||
KeyType.ECDH(EllipticCurve._P256),
|
KeyType.ECDH(EllipticCurve._P256),
|
||||||
KeyType.ECDH(EllipticCurve._P384),
|
KeyType.ECDH(EllipticCurve._P384),
|
||||||
KeyType.ECDH(EllipticCurve._P521),
|
KeyType.ECDH(EllipticCurve._P521),
|
||||||
KeyType.XDH(XDHSpec._X25519)
|
KeyType.XDH_LEGACY(XDHLegacySpec._X25519)
|
||||||
};
|
};
|
||||||
for (KeyType type : typesIncapableOfCreatingVerifications) {
|
for (KeyType type : typesIncapableOfCreatingVerifications) {
|
||||||
assertThrows(IllegalArgumentException.class, () -> PGPainless
|
assertThrows(IllegalArgumentException.class, () -> PGPainless
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.pgpainless.algorithm.KeyFlag;
|
||||||
import org.pgpainless.algorithm.PublicKeyAlgorithm;
|
import org.pgpainless.algorithm.PublicKeyAlgorithm;
|
||||||
import org.pgpainless.key.generation.type.KeyType;
|
import org.pgpainless.key.generation.type.KeyType;
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec;
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec;
|
||||||
import org.pgpainless.key.protection.SecretKeyRingProtector;
|
import org.pgpainless.key.protection.SecretKeyRingProtector;
|
||||||
import org.pgpainless.key.protection.UnlockSecretKey;
|
import org.pgpainless.key.protection.UnlockSecretKey;
|
||||||
import org.pgpainless.key.util.UserId;
|
import org.pgpainless.key.util.UserId;
|
||||||
|
@ -34,7 +34,7 @@ public class GenerateEllipticCurveKeyTest {
|
||||||
.setPrimaryKey(KeySpec.getBuilder(
|
.setPrimaryKey(KeySpec.getBuilder(
|
||||||
KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519),
|
KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519),
|
||||||
KeyFlag.CERTIFY_OTHER, KeyFlag.SIGN_DATA))
|
KeyFlag.CERTIFY_OTHER, KeyFlag.SIGN_DATA))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_COMMS))
|
.addSubkey(KeySpec.getBuilder(KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.ENCRYPT_COMMS))
|
||||||
.addUserId(UserId.onlyEmail("alice@wonderland.lit").toString())
|
.addUserId(UserId.onlyEmail("alice@wonderland.lit").toString())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.pgpainless.algorithm.KeyFlag;
|
||||||
import org.pgpainless.key.generation.type.KeyType;
|
import org.pgpainless.key.generation.type.KeyType;
|
||||||
import org.pgpainless.key.generation.type.ecc.EllipticCurve;
|
import org.pgpainless.key.generation.type.ecc.EllipticCurve;
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec;
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec;
|
||||||
import org.pgpainless.util.DateUtil;
|
import org.pgpainless.util.DateUtil;
|
||||||
|
|
||||||
public class GenerateKeyWithCustomCreationDateTest {
|
public class GenerateKeyWithCustomCreationDateTest {
|
||||||
|
@ -33,7 +33,7 @@ public class GenerateKeyWithCustomCreationDateTest {
|
||||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||||
Date creationDate = DateUtil.parseUTCDate("2018-06-11 14:12:09 UTC");
|
Date creationDate = DateUtil.parseUTCDate("2018-06-11 14:12:09 UTC");
|
||||||
PGPSecretKeyRing secretKeys = PGPainless.buildKeyRing()
|
PGPSecretKeyRing secretKeys = PGPainless.buildKeyRing()
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE))
|
.addSubkey(KeySpec.getBuilder(KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE))
|
||||||
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER, KeyFlag.SIGN_DATA)
|
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER, KeyFlag.SIGN_DATA)
|
||||||
.setKeyCreationDate(creationDate)) // primary key with custom creation time
|
.setKeyCreationDate(creationDate)) // primary key with custom creation time
|
||||||
.addUserId("Alice")
|
.addUserId("Alice")
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.pgpainless.exception.KeyException;
|
||||||
import org.pgpainless.key.TestKeys;
|
import org.pgpainless.key.TestKeys;
|
||||||
import org.pgpainless.key.generation.type.KeyType;
|
import org.pgpainless.key.generation.type.KeyType;
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec;
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec;
|
||||||
import org.pgpainless.key.info.KeyRingInfo;
|
import org.pgpainless.key.info.KeyRingInfo;
|
||||||
import org.pgpainless.key.protection.SecretKeyRingProtector;
|
import org.pgpainless.key.protection.SecretKeyRingProtector;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class GenerateKeyWithoutPrimaryKeyFlagsTest {
|
||||||
public void generateKeyWithoutCertifyKeyFlag_cannotCertifyThirdParties() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
public void generateKeyWithoutCertifyKeyFlag_cannotCertifyThirdParties() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||||
PGPSecretKeyRing secretKeys = PGPainless.buildKeyRing().setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519)))
|
PGPSecretKeyRing secretKeys = PGPainless.buildKeyRing().setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519)))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.SIGN_DATA))
|
.addSubkey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.SIGN_DATA))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_STORAGE, KeyFlag.ENCRYPT_COMMS))
|
.addSubkey(KeySpec.getBuilder(KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.ENCRYPT_STORAGE, KeyFlag.ENCRYPT_COMMS))
|
||||||
.addUserId("Alice")
|
.addUserId("Alice")
|
||||||
.build();
|
.build();
|
||||||
PGPPublicKeyRing cert = PGPainless.extractCertificate(secretKeys);
|
PGPPublicKeyRing cert = PGPainless.extractCertificate(secretKeys);
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.pgpainless.encryption_signing.ProducerOptions;
|
||||||
import org.pgpainless.encryption_signing.SigningOptions;
|
import org.pgpainless.encryption_signing.SigningOptions;
|
||||||
import org.pgpainless.key.generation.type.KeyType;
|
import org.pgpainless.key.generation.type.KeyType;
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec;
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec;
|
||||||
import org.pgpainless.key.info.KeyRingInfo;
|
import org.pgpainless.key.info.KeyRingInfo;
|
||||||
import org.pgpainless.key.protection.SecretKeyRingProtector;
|
import org.pgpainless.key.protection.SecretKeyRingProtector;
|
||||||
import org.pgpainless.timeframe.TestTimeFrameProvider;
|
import org.pgpainless.timeframe.TestTimeFrameProvider;
|
||||||
|
@ -49,7 +49,7 @@ public class GenerateKeyWithoutUserIdTest {
|
||||||
PGPSecretKeyRing secretKey = PGPainless.buildKeyRing()
|
PGPSecretKeyRing secretKey = PGPainless.buildKeyRing()
|
||||||
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER).setKeyCreationDate(now))
|
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER).setKeyCreationDate(now))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.SIGN_DATA).setKeyCreationDate(now))
|
.addSubkey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.SIGN_DATA).setKeyCreationDate(now))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE).setKeyCreationDate(now))
|
.addSubkey(KeySpec.getBuilder(KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE).setKeyCreationDate(now))
|
||||||
.setExpirationDate(expirationDate)
|
.setExpirationDate(expirationDate)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.pgpainless.algorithm.KeyFlag;
|
import org.pgpainless.algorithm.KeyFlag;
|
||||||
import org.pgpainless.key.generation.type.KeyType;
|
import org.pgpainless.key.generation.type.KeyType;
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec;
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec;
|
||||||
import org.pgpainless.util.TestAllImplementations;
|
import org.pgpainless.util.TestAllImplementations;
|
||||||
|
|
||||||
public class IllegalKeyFlagsTest {
|
public class IllegalKeyFlagsTest {
|
||||||
|
@ -20,13 +20,13 @@ public class IllegalKeyFlagsTest {
|
||||||
@ExtendWith(TestAllImplementations.class)
|
@ExtendWith(TestAllImplementations.class)
|
||||||
public void testKeyCannotCarryFlagsTest() {
|
public void testKeyCannotCarryFlagsTest() {
|
||||||
assertThrows(IllegalArgumentException.class, () -> KeySpec.getBuilder(
|
assertThrows(IllegalArgumentException.class, () -> KeySpec.getBuilder(
|
||||||
KeyType.XDH(XDHSpec._X25519), KeyFlag.SIGN_DATA));
|
KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.SIGN_DATA));
|
||||||
|
|
||||||
assertThrows(IllegalArgumentException.class, () -> KeySpec.getBuilder(
|
assertThrows(IllegalArgumentException.class, () -> KeySpec.getBuilder(
|
||||||
KeyType.XDH(XDHSpec._X25519), KeyFlag.CERTIFY_OTHER));
|
KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.CERTIFY_OTHER));
|
||||||
|
|
||||||
assertThrows(IllegalArgumentException.class, () -> KeySpec.getBuilder(
|
assertThrows(IllegalArgumentException.class, () -> KeySpec.getBuilder(
|
||||||
KeyType.XDH(XDHSpec._X25519), KeyFlag.AUTHENTICATION));
|
KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.AUTHENTICATION));
|
||||||
|
|
||||||
assertThrows(IllegalArgumentException.class, () -> KeySpec.getBuilder(
|
assertThrows(IllegalArgumentException.class, () -> KeySpec.getBuilder(
|
||||||
KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.ENCRYPT_COMMS));
|
KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.ENCRYPT_COMMS));
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.pgpainless.algorithm.HashAlgorithm;
|
||||||
import org.pgpainless.algorithm.KeyFlag;
|
import org.pgpainless.algorithm.KeyFlag;
|
||||||
import org.pgpainless.key.generation.type.KeyType;
|
import org.pgpainless.key.generation.type.KeyType;
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec;
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec;
|
||||||
import org.pgpainless.key.info.KeyRingInfo;
|
import org.pgpainless.key.info.KeyRingInfo;
|
||||||
import org.pgpainless.key.protection.SecretKeyRingProtector;
|
import org.pgpainless.key.protection.SecretKeyRingProtector;
|
||||||
import org.pgpainless.signature.subpackets.SelfSignatureSubpackets;
|
import org.pgpainless.signature.subpackets.SelfSignatureSubpackets;
|
||||||
|
@ -130,7 +130,7 @@ public class KeyGenerationSubpacketsTest {
|
||||||
assertNotNull(bindingSig.getHashedSubPackets().getEmbeddedSignatures().get(0));
|
assertNotNull(bindingSig.getHashedSubPackets().getEmbeddedSignatures().get(0));
|
||||||
|
|
||||||
secretKeys = PGPainless.modifyKeyRing(secretKeys)
|
secretKeys = PGPainless.modifyKeyRing(secretKeys)
|
||||||
.addSubKey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_COMMS).build(),
|
.addSubKey(KeySpec.getBuilder(KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.ENCRYPT_COMMS).build(),
|
||||||
Passphrase.emptyPassphrase(),
|
Passphrase.emptyPassphrase(),
|
||||||
new SelfSignatureSubpackets.Callback() {
|
new SelfSignatureSubpackets.Callback() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.pgpainless.key.TestKeys;
|
||||||
import org.pgpainless.key.generation.KeySpec;
|
import org.pgpainless.key.generation.KeySpec;
|
||||||
import org.pgpainless.key.generation.type.KeyType;
|
import org.pgpainless.key.generation.type.KeyType;
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec;
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec;
|
||||||
import org.pgpainless.key.protection.PasswordBasedSecretKeyRingProtector;
|
import org.pgpainless.key.protection.PasswordBasedSecretKeyRingProtector;
|
||||||
import org.pgpainless.key.protection.SecretKeyRingProtector;
|
import org.pgpainless.key.protection.SecretKeyRingProtector;
|
||||||
import org.pgpainless.key.protection.UnprotectedKeysProtector;
|
import org.pgpainless.key.protection.UnprotectedKeysProtector;
|
||||||
|
@ -44,7 +44,7 @@ public class UserIdRevocationTest {
|
||||||
KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519),
|
KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519),
|
||||||
KeyFlag.SIGN_DATA, KeyFlag.CERTIFY_OTHER))
|
KeyFlag.SIGN_DATA, KeyFlag.CERTIFY_OTHER))
|
||||||
.addSubkey(KeySpec.getBuilder(
|
.addSubkey(KeySpec.getBuilder(
|
||||||
KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_COMMS))
|
KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.ENCRYPT_COMMS))
|
||||||
.addUserId("primary@key.id")
|
.addUserId("primary@key.id")
|
||||||
.addUserId("secondary@key.id")
|
.addUserId("secondary@key.id")
|
||||||
.build();
|
.build();
|
||||||
|
@ -81,7 +81,7 @@ public class UserIdRevocationTest {
|
||||||
.setPrimaryKey(KeySpec.getBuilder(
|
.setPrimaryKey(KeySpec.getBuilder(
|
||||||
KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519),
|
KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519),
|
||||||
KeyFlag.SIGN_DATA, KeyFlag.CERTIFY_OTHER))
|
KeyFlag.SIGN_DATA, KeyFlag.CERTIFY_OTHER))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_COMMS))
|
.addSubkey(KeySpec.getBuilder(KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.ENCRYPT_COMMS))
|
||||||
.addUserId("primary@key.id")
|
.addUserId("primary@key.id")
|
||||||
.addUserId("secondary@key.id")
|
.addUserId("secondary@key.id")
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -19,7 +19,7 @@ import org.pgpainless.encryption_signing.SigningOptions
|
||||||
import org.pgpainless.key.generation.KeySpec
|
import org.pgpainless.key.generation.KeySpec
|
||||||
import org.pgpainless.key.generation.type.KeyType
|
import org.pgpainless.key.generation.type.KeyType
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec
|
||||||
import org.pgpainless.key.protection.SecretKeyRingProtector
|
import org.pgpainless.key.protection.SecretKeyRingProtector
|
||||||
|
|
||||||
class KeyWithoutSelfSigsTest {
|
class KeyWithoutSelfSigsTest {
|
||||||
|
@ -62,7 +62,7 @@ class KeyWithoutSelfSigsTest {
|
||||||
KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.SIGN_DATA))
|
KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.SIGN_DATA))
|
||||||
.addSubkey(
|
.addSubkey(
|
||||||
KeySpec.getBuilder(
|
KeySpec.getBuilder(
|
||||||
KeyType.XDH(XDHSpec._X25519),
|
KeyType.XDH_LEGACY(XDHLegacySpec._X25519),
|
||||||
KeyFlag.ENCRYPT_STORAGE,
|
KeyFlag.ENCRYPT_STORAGE,
|
||||||
KeyFlag.ENCRYPT_COMMS))
|
KeyFlag.ENCRYPT_COMMS))
|
||||||
.build()
|
.build()
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.pgpainless.key.generation.KeySpec;
|
||||||
import org.pgpainless.key.generation.type.KeyType;
|
import org.pgpainless.key.generation.type.KeyType;
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
||||||
import org.pgpainless.key.generation.type.rsa.RsaLength;
|
import org.pgpainless.key.generation.type.rsa.RsaLength;
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec;
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec;
|
||||||
import org.pgpainless.util.ArmorUtils;
|
import org.pgpainless.util.ArmorUtils;
|
||||||
import org.pgpainless.util.Passphrase;
|
import org.pgpainless.util.Passphrase;
|
||||||
import sop.Profile;
|
import sop.Profile;
|
||||||
|
@ -126,7 +126,7 @@ public class GenerateKeyImpl implements GenerateKey {
|
||||||
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER))
|
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.SIGN_DATA));
|
.addSubkey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.SIGN_DATA));
|
||||||
if (!signingOnly) {
|
if (!signingOnly) {
|
||||||
keyBuilder.addSubkey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE));
|
keyBuilder.addSubkey(KeySpec.getBuilder(KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// RSA 4096
|
// RSA 4096
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.pgpainless.algorithm.KeyFlag;
|
||||||
import org.pgpainless.key.generation.KeySpec;
|
import org.pgpainless.key.generation.KeySpec;
|
||||||
import org.pgpainless.key.generation.type.KeyType;
|
import org.pgpainless.key.generation.type.KeyType;
|
||||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
||||||
import org.pgpainless.key.generation.type.xdh.XDHSpec;
|
import org.pgpainless.key.generation.type.xdh_legacy.XDHLegacySpec;
|
||||||
import org.pgpainless.util.Passphrase;
|
import org.pgpainless.util.Passphrase;
|
||||||
import sop.SOP;
|
import sop.SOP;
|
||||||
import sop.testsuite.TestData;
|
import sop.testsuite.TestData;
|
||||||
|
@ -36,7 +36,7 @@ public class PGPainlessChangeKeyPasswordTest extends ChangeKeyPasswordTest {
|
||||||
PGPSecretKeyRing secretKeys = PGPainless.buildKeyRing()
|
PGPSecretKeyRing secretKeys = PGPainless.buildKeyRing()
|
||||||
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER))
|
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.SIGN_DATA))
|
.addSubkey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.SIGN_DATA))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE))
|
.addSubkey(KeySpec.getBuilder(KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE))
|
||||||
.build();
|
.build();
|
||||||
Iterator<PGPPublicKey> keys = secretKeys.getPublicKeys();
|
Iterator<PGPPublicKey> keys = secretKeys.getPublicKeys();
|
||||||
long primaryKeyId = keys.next().getKeyID();
|
long primaryKeyId = keys.next().getKeyID();
|
||||||
|
|
Loading…
Reference in a new issue