mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-26 06:12:06 +01:00
Use newly introduced modernKeyRing(userId) method
This commit is contained in:
parent
9a545a2936
commit
dd26b5230d
24 changed files with 44 additions and 44 deletions
|
@ -79,7 +79,7 @@ public class CertificateWithMissingSecretKeyTest {
|
|||
|
||||
// missing encryption sec key we generate on the fly
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("Missing Decryption Key <missing@decryption.key>", null);
|
||||
.modernKeyRing("Missing Decryption Key <missing@decryption.key>");
|
||||
encryptionSubkeyId = PGPainless.inspectKeyRing(secretKeys)
|
||||
.getEncryptionSubkeys(EncryptionPurpose.ANY).get(0).getKeyID();
|
||||
// remove the encryption/decryption secret key
|
||||
|
|
|
@ -214,7 +214,7 @@ public class CleartextSignatureVerificationTest {
|
|||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||
String message = randomString(28, 4000);
|
||||
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("Alice", null);
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("Alice");
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
EncryptionStream encryptionStream = PGPainless.encryptAndOrSign()
|
||||
.onOutputStream(out)
|
||||
|
|
|
@ -740,7 +740,7 @@ public class OpenPgpInputStreamTest {
|
|||
public void testSignedMessageConsumption() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||
ByteArrayInputStream plaintext = new ByteArrayInputStream("Hello, World!\n".getBytes(StandardCharsets.UTF_8));
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("Sigmund <sigmund@exmplample.com>", null);
|
||||
.modernKeyRing("Sigmund <sigmund@exmplample.com>");
|
||||
|
||||
ByteArrayOutputStream signedOut = new ByteArrayOutputStream();
|
||||
EncryptionStream signer = PGPainless.encryptAndOrSign()
|
||||
|
|
|
@ -42,7 +42,7 @@ public class VerifyWithMissingPublicKeyCallback {
|
|||
|
||||
@Test
|
||||
public void testMissingPublicKeyCallback() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||
PGPSecretKeyRing signingSecKeys = PGPainless.generateKeyRing().modernKeyRing("alice", null);
|
||||
PGPSecretKeyRing signingSecKeys = PGPainless.generateKeyRing().modernKeyRing("alice");
|
||||
PGPPublicKey signingKey = new KeyRingInfo(signingSecKeys).getSigningSubkeys().get(0);
|
||||
PGPPublicKeyRing signingPubKeys = KeyRingUtils.publicKeyRingFrom(signingSecKeys);
|
||||
PGPPublicKeyRing unrelatedKeys = TestKeys.getJulietPublicKeyRing();
|
||||
|
|
|
@ -167,7 +167,7 @@ public class EncryptionOptionsTest {
|
|||
@Test
|
||||
public void testAddRecipients_PGPPublicKeyRingCollection() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||
PGPPublicKeyRing secondKeyRing = KeyRingUtils.publicKeyRingFrom(
|
||||
PGPainless.generateKeyRing().modernKeyRing("other@pgpainless.org", null));
|
||||
PGPainless.generateKeyRing().modernKeyRing("other@pgpainless.org"));
|
||||
|
||||
PGPPublicKeyRingCollection collection = new PGPPublicKeyRingCollection(
|
||||
Arrays.asList(publicKeys, secondKeyRing));
|
||||
|
|
|
@ -38,7 +38,7 @@ public class FileInformationTest {
|
|||
|
||||
@BeforeAll
|
||||
public static void generateKey() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
secretKey = PGPainless.generateKeyRing().modernKeyRing("alice@wonderland.lit", null);
|
||||
secretKey = PGPainless.generateKeyRing().modernKeyRing("alice@wonderland.lit");
|
||||
certificate = PGPainless.extractCertificate(secretKey);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public class ConvertKeys {
|
|||
public void secretKeyToCertificate() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
String userId = "alice@wonderland.lit";
|
||||
PGPSecretKeyRing secretKey = PGPainless.generateKeyRing()
|
||||
.modernKeyRing(userId, null);
|
||||
.modernKeyRing(userId);
|
||||
// Extract certificate (public key) from secret key
|
||||
PGPPublicKeyRing certificate = PGPainless.extractCertificate(secretKey);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class Sign {
|
|||
|
||||
@BeforeAll
|
||||
public static void prepare() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
secretKey = PGPainless.generateKeyRing().modernKeyRing("Emilia Example <emilia@example.org>", null);
|
||||
secretKey = PGPainless.generateKeyRing().modernKeyRing("Emilia Example <emilia@example.org>");
|
||||
protector = SecretKeyRingProtector.unprotectedKeys(); // no password
|
||||
}
|
||||
|
||||
|
|
|
@ -296,7 +296,7 @@ public class KeyRingValidatorTest {
|
|||
@Test
|
||||
public void testKeyWithUserAttributes() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("Alice <alice@pgpainless.org>", null);
|
||||
.modernKeyRing("Alice <alice@pgpainless.org>");
|
||||
PGPPublicKeyRing publicKeys = PGPainless.extractCertificate(secretKeys);
|
||||
PGPPublicKey publicKey = secretKeys.getPublicKey();
|
||||
PGPSecretKey secretKey = secretKeys.getSecretKey();
|
||||
|
|
|
@ -41,7 +41,7 @@ public class KeyGenerationSubpacketsTest {
|
|||
@Test
|
||||
public void verifyDefaultSubpacketsForUserIdSignatures()
|
||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, InterruptedException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("Alice", null);
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("Alice");
|
||||
|
||||
KeyRingInfo info = PGPainless.inspectKeyRing(secretKeys);
|
||||
PGPSignature userIdSig = info.getLatestUserIdCertification("Alice");
|
||||
|
@ -108,7 +108,7 @@ public class KeyGenerationSubpacketsTest {
|
|||
@Test
|
||||
public void verifyDefaultSubpacketsForSubkeyBindingSignatures()
|
||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("Alice", null);
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("Alice");
|
||||
KeyRingInfo info = PGPainless.inspectKeyRing(secretKeys);
|
||||
List<PGPPublicKey> keysBefore = info.getPublicKeys();
|
||||
|
||||
|
|
|
@ -515,7 +515,7 @@ public class KeyRingInfoTest {
|
|||
|
||||
@Test
|
||||
public void getSecretKeyTest() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("Alice", null);
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("Alice");
|
||||
KeyRingInfo info = PGPainless.inspectKeyRing(secretKeys);
|
||||
|
||||
OpenPgpV4Fingerprint primaryKeyFingerprint = new OpenPgpV4Fingerprint(secretKeys);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class AddSubkeyWithModifiedBindingSignatureSubpackets {
|
|||
public void bindEncryptionSubkeyAndModifyBindingSignatureHashedSubpackets() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||
SecretKeyRingProtector protector = SecretKeyRingProtector.unprotectedKeys();
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("Alice <alice@pgpainless.org>", null);
|
||||
.modernKeyRing("Alice <alice@pgpainless.org>");
|
||||
KeyRingInfo before = PGPainless.inspectKeyRing(secretKeys);
|
||||
|
||||
PGPKeyPair secretSubkey = KeyRingBuilder.generateKeyPair(
|
||||
|
|
|
@ -114,7 +114,7 @@ public class AddUserIdTest {
|
|||
@Test
|
||||
public void addNewPrimaryUserIdTest() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("Alice", null);
|
||||
.modernKeyRing("Alice");
|
||||
UserId bob = UserId.newBuilder().withName("Bob").noEmail().noComment().build();
|
||||
|
||||
assertNotEquals("Bob", PGPainless.inspectKeyRing(secretKeys).getPrimaryUserId());
|
||||
|
|
|
@ -27,7 +27,7 @@ public class ChangePrimaryUserIdAndExpirationDatesTest {
|
|||
public void generateA_primaryB_revokeA_cantSecondaryA()
|
||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, InterruptedException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("A", null);
|
||||
.modernKeyRing("A");
|
||||
SecretKeyRingProtector protector = SecretKeyRingProtector.unprotectedKeys();
|
||||
|
||||
KeyRingInfo info = PGPainless.inspectKeyRing(secretKeys);
|
||||
|
@ -70,7 +70,7 @@ public class ChangePrimaryUserIdAndExpirationDatesTest {
|
|||
public void generateA_primaryExpire_isExpired()
|
||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, InterruptedException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("A", null);
|
||||
.modernKeyRing("A");
|
||||
SecretKeyRingProtector protector = SecretKeyRingProtector.unprotectedKeys();
|
||||
|
||||
KeyRingInfo info = PGPainless.inspectKeyRing(secretKeys);
|
||||
|
@ -92,7 +92,7 @@ public class ChangePrimaryUserIdAndExpirationDatesTest {
|
|||
public void generateA_primaryB_primaryExpire_bIsStillPrimary()
|
||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, InterruptedException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("A", null);
|
||||
.modernKeyRing("A");
|
||||
SecretKeyRingProtector protector = SecretKeyRingProtector.unprotectedKeys();
|
||||
|
||||
KeyRingInfo info = PGPainless.inspectKeyRing(secretKeys);
|
||||
|
@ -130,7 +130,7 @@ public class ChangePrimaryUserIdAndExpirationDatesTest {
|
|||
|
||||
@Test
|
||||
public void generateA_expire_certify() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, InterruptedException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("A", null);
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("A");
|
||||
SecretKeyRingProtector protector = SecretKeyRingProtector.unprotectedKeys();
|
||||
|
||||
secretKeys = PGPainless.modifyKeyRing(secretKeys)
|
||||
|
@ -151,7 +151,7 @@ public class ChangePrimaryUserIdAndExpirationDatesTest {
|
|||
@Test
|
||||
public void generateA_expire_primaryB_expire_isPrimaryB()
|
||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, InterruptedException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("A", null);
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("A");
|
||||
SecretKeyRingProtector protector = SecretKeyRingProtector.unprotectedKeys();
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
|
|
@ -37,7 +37,7 @@ public class RefuseToAddWeakSubkeyTest {
|
|||
PGPainless.getPolicy().setPublicKeyAlgorithmPolicy(Policy.PublicKeyAlgorithmPolicy.defaultPublicKeyAlgorithmPolicy());
|
||||
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("Alice", null);
|
||||
.modernKeyRing("Alice");
|
||||
SecretKeyRingEditorInterface editor = PGPainless.modifyKeyRing(secretKeys);
|
||||
KeySpec spec = KeySpec.getBuilder(KeyType.RSA(RsaLength._1024), KeyFlag.ENCRYPT_COMMS).build();
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class RefuseToAddWeakSubkeyTest {
|
|||
public void testEditorAllowsToAddWeakSubkeyIfCompliesToPublicKeyAlgorithmPolicy()
|
||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("Alice", null);
|
||||
.modernKeyRing("Alice");
|
||||
|
||||
// set weak policy
|
||||
Map<PublicKeyAlgorithm, Integer> minimalBitStrengths = new EnumMap<>(PublicKeyAlgorithm.class);
|
||||
|
|
|
@ -128,7 +128,7 @@ public class RevokeSubKeyTest {
|
|||
@Test
|
||||
public void inspectSubpacketsOnDefaultRevocationSignature()
|
||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("Alice", null);
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("Alice");
|
||||
SecretKeyRingProtector protector = SecretKeyRingProtector.unprotectedKeys();
|
||||
PGPPublicKey encryptionSubkey = PGPainless.inspectKeyRing(secretKeys)
|
||||
.getEncryptionSubkeys(EncryptionPurpose.ANY).get(0);
|
||||
|
@ -153,7 +153,7 @@ public class RevokeSubKeyTest {
|
|||
@Test
|
||||
public void inspectSubpacketsOnModifiedRevocationSignature()
|
||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("Alice", null);
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("Alice");
|
||||
SecretKeyRingProtector protector = SecretKeyRingProtector.unprotectedKeys();
|
||||
PGPPublicKey encryptionSubkey = PGPainless.inspectKeyRing(secretKeys)
|
||||
.getEncryptionSubkeys(EncryptionPurpose.ANY).get(0);
|
||||
|
|
|
@ -27,7 +27,7 @@ public class RevokeUserIdsTest {
|
|||
@Test
|
||||
public void revokeWithSelectUserId() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("Alice <alice@pgpainless.org>", null);
|
||||
.modernKeyRing("Alice <alice@pgpainless.org>");
|
||||
SecretKeyRingProtector protector = SecretKeyRingProtector.unprotectedKeys();
|
||||
|
||||
secretKeys = PGPainless.modifyKeyRing(secretKeys)
|
||||
|
@ -58,7 +58,7 @@ public class RevokeUserIdsTest {
|
|||
@Test
|
||||
public void removeUserId() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("Alice <alice@pgpainless.org>", null);
|
||||
.modernKeyRing("Alice <alice@pgpainless.org>");
|
||||
SecretKeyRingProtector protector = SecretKeyRingProtector.unprotectedKeys();
|
||||
|
||||
secretKeys = PGPainless.modifyKeyRing(secretKeys)
|
||||
|
@ -89,7 +89,7 @@ public class RevokeUserIdsTest {
|
|||
@Test
|
||||
public void emptySelectionYieldsNoSuchElementException() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("Alice <alice@pgpainless.org>", null);
|
||||
.modernKeyRing("Alice <alice@pgpainless.org>");
|
||||
|
||||
assertThrows(NoSuchElementException.class, () ->
|
||||
PGPainless.modifyKeyRing(secretKeys).revokeUserIds(
|
||||
|
|
|
@ -27,8 +27,8 @@ public class KeyRingCollectionReaderTest {
|
|||
@Test
|
||||
public void writeAndParseKeyRingCollections() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||
// secret keys
|
||||
PGPSecretKeyRing alice = PGPainless.generateKeyRing().modernKeyRing("Alice <alice@pgpainless.org>", null);
|
||||
PGPSecretKeyRing bob = PGPainless.generateKeyRing().modernKeyRing("Bob <bob@pgpainless.org>", null);
|
||||
PGPSecretKeyRing alice = PGPainless.generateKeyRing().modernKeyRing("Alice <alice@pgpainless.org>");
|
||||
PGPSecretKeyRing bob = PGPainless.generateKeyRing().modernKeyRing("Bob <bob@pgpainless.org>");
|
||||
|
||||
PGPSecretKeyRingCollection collection = KeyRingUtils.keyRingsToKeyRingCollection(alice, bob);
|
||||
String ascii = ArmorUtils.toAsciiArmoredString(collection);
|
||||
|
|
|
@ -455,8 +455,8 @@ class KeyRingReaderTest {
|
|||
|
||||
@Test
|
||||
public void testReadSecretKeysIgnoresMultipleMarkers() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||
PGPSecretKeyRing alice = PGPainless.generateKeyRing().modernKeyRing("alice@pgpainless.org", null);
|
||||
PGPSecretKeyRing bob = PGPainless.generateKeyRing().modernKeyRing("bob@pgpainless.org", null);
|
||||
PGPSecretKeyRing alice = PGPainless.generateKeyRing().modernKeyRing("alice@pgpainless.org");
|
||||
PGPSecretKeyRing bob = PGPainless.generateKeyRing().modernKeyRing("bob@pgpainless.org");
|
||||
MarkerPacket marker = TestUtils.getMarkerPacket();
|
||||
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
|
@ -489,7 +489,7 @@ class KeyRingReaderTest {
|
|||
@Test
|
||||
public void testReadingSecretKeysExceedsIterationLimit()
|
||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||
PGPSecretKeyRing alice = PGPainless.generateKeyRing().modernKeyRing("alice@pgpainless.org", null);
|
||||
PGPSecretKeyRing alice = PGPainless.generateKeyRing().modernKeyRing("alice@pgpainless.org");
|
||||
MarkerPacket marker = TestUtils.getMarkerPacket();
|
||||
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
|
@ -508,8 +508,8 @@ class KeyRingReaderTest {
|
|||
@Test
|
||||
public void testReadingSecretKeyCollectionExceedsIterationLimit()
|
||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||
PGPSecretKeyRing alice = PGPainless.generateKeyRing().modernKeyRing("alice@pgpainless.org", null);
|
||||
PGPSecretKeyRing bob = PGPainless.generateKeyRing().modernKeyRing("bob@pgpainless.org", null);
|
||||
PGPSecretKeyRing alice = PGPainless.generateKeyRing().modernKeyRing("alice@pgpainless.org");
|
||||
PGPSecretKeyRing bob = PGPainless.generateKeyRing().modernKeyRing("bob@pgpainless.org");
|
||||
MarkerPacket marker = TestUtils.getMarkerPacket();
|
||||
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
|
@ -530,7 +530,7 @@ class KeyRingReaderTest {
|
|||
@Test
|
||||
public void testReadingPublicKeysExceedsIterationLimit()
|
||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("alice@pgpainless.org", null);
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().modernKeyRing("alice@pgpainless.org");
|
||||
PGPPublicKeyRing alice = PGPainless.extractCertificate(secretKeys);
|
||||
MarkerPacket marker = TestUtils.getMarkerPacket();
|
||||
|
||||
|
@ -550,8 +550,8 @@ class KeyRingReaderTest {
|
|||
@Test
|
||||
public void testReadingPublicKeyCollectionExceedsIterationLimit()
|
||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||
PGPSecretKeyRing sec1 = PGPainless.generateKeyRing().modernKeyRing("alice@pgpainless.org", null);
|
||||
PGPSecretKeyRing sec2 = PGPainless.generateKeyRing().modernKeyRing("bob@pgpainless.org", null);
|
||||
PGPSecretKeyRing sec1 = PGPainless.generateKeyRing().modernKeyRing("alice@pgpainless.org");
|
||||
PGPSecretKeyRing sec2 = PGPainless.generateKeyRing().modernKeyRing("bob@pgpainless.org");
|
||||
PGPPublicKeyRing alice = PGPainless.extractCertificate(sec1);
|
||||
PGPPublicKeyRing bob = PGPainless.extractCertificate(sec2);
|
||||
MarkerPacket marker = TestUtils.getMarkerPacket();
|
||||
|
|
|
@ -33,7 +33,7 @@ public class KeyRingUtilTest {
|
|||
@Test
|
||||
public void testInjectCertification() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("Alice", null);
|
||||
.modernKeyRing("Alice");
|
||||
|
||||
// test preconditions
|
||||
assertFalse(secretKeys.getPublicKey().getUserAttributes().hasNext());
|
||||
|
|
|
@ -56,8 +56,8 @@ public class OnePassSignatureBracketingTest {
|
|||
public void onePassSignaturePacketsAndSignaturesAreBracketedTest()
|
||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||
|
||||
PGPSecretKeyRing key1 = PGPainless.generateKeyRing().modernKeyRing("Alice", null);
|
||||
PGPSecretKeyRing key2 = PGPainless.generateKeyRing().modernKeyRing("Bob", null);
|
||||
PGPSecretKeyRing key1 = PGPainless.generateKeyRing().modernKeyRing("Alice");
|
||||
PGPSecretKeyRing key2 = PGPainless.generateKeyRing().modernKeyRing("Bob");
|
||||
PGPPublicKeyRing cert1 = PGPainless.extractCertificate(key1);
|
||||
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
|
|
|
@ -54,7 +54,7 @@ public class SignatureSubpacketsUtilTest {
|
|||
@Test
|
||||
public void testGetKeyExpirationTimeAsDate() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("Expire", null);
|
||||
.modernKeyRing("Expire");
|
||||
Date expiration = Date.from(new Date().toInstant().plus(365, ChronoUnit.DAYS));
|
||||
secretKeys = PGPainless.modifyKeyRing(secretKeys)
|
||||
.setExpirationDate(expiration, SecretKeyRingProtector.unprotectedKeys())
|
||||
|
|
|
@ -34,7 +34,7 @@ public class DirectKeySignatureBuilderTest {
|
|||
@Test
|
||||
public void testDirectKeySignatureBuilding() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, InterruptedException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("Alice", null);
|
||||
.modernKeyRing("Alice");
|
||||
|
||||
DirectKeySignatureBuilder dsb = new DirectKeySignatureBuilder(
|
||||
secretKeys.getSecretKey(),
|
||||
|
|
|
@ -30,7 +30,7 @@ public class ThirdPartyCertificationSignatureBuilderTest {
|
|||
@Test
|
||||
public void testInvalidSignatureTypeThrows() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("Alice", null);
|
||||
.modernKeyRing("Alice");
|
||||
assertThrows(IllegalArgumentException.class, () ->
|
||||
new ThirdPartyCertificationSignatureBuilder(
|
||||
SignatureType.BINARY_DOCUMENT, // invalid type
|
||||
|
@ -41,10 +41,10 @@ public class ThirdPartyCertificationSignatureBuilderTest {
|
|||
@Test
|
||||
public void testUserIdCertification() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.modernKeyRing("Alice", null);
|
||||
.modernKeyRing("Alice");
|
||||
|
||||
PGPPublicKeyRing bobsPublicKeys = PGPainless.extractCertificate(
|
||||
PGPainless.generateKeyRing().modernKeyRing("Bob", null));
|
||||
PGPainless.generateKeyRing().modernKeyRing("Bob"));
|
||||
|
||||
ThirdPartyCertificationSignatureBuilder signatureBuilder = new ThirdPartyCertificationSignatureBuilder(
|
||||
secretKeys.getSecretKey(),
|
||||
|
|
Loading…
Reference in a new issue