1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-22 19:08:00 +01:00

Remove empty newlines

This commit is contained in:
Paul Schaub 2022-11-22 15:51:31 +01:00
parent 6926cedf61
commit c031ea9285
4 changed files with 0 additions and 18 deletions

View file

@ -88,7 +88,6 @@ public class ManagePolicy {
// Per default, non-revocation signatures using SHA-1 are rejected
assertFalse(sigHashAlgoPolicy.isAcceptable(HashAlgorithm.SHA1));
// Create a new custom policy which contains SHA-1
Policy.HashAlgorithmPolicy customPolicy = new Policy.HashAlgorithmPolicy(
// The default hash algorithm will be used when hash algorithm negotiation fails when creating a sig
@ -98,7 +97,6 @@ public class ManagePolicy {
// Set the hash algo policy as policy for non-revocation signatures
policy.setSignatureHashAlgorithmPolicy(customPolicy);
sigHashAlgoPolicy = policy.getSignatureHashAlgorithmPolicy();
assertTrue(sigHashAlgoPolicy.isAcceptable(HashAlgorithm.SHA512));
// SHA-1 is now acceptable as well
@ -122,7 +120,6 @@ public class ManagePolicy {
assertFalse(pkAlgorithmPolicy.isAcceptable(PublicKeyAlgorithm.RSA_GENERAL, 1024));
assertTrue(pkAlgorithmPolicy.isAcceptable(PublicKeyAlgorithm.ECDSA, 256));
Policy.PublicKeyAlgorithmPolicy customPolicy = new Policy.PublicKeyAlgorithmPolicy(
new HashMap<PublicKeyAlgorithm, Integer>(){{
// Put minimum bit strengths for acceptable algorithms.
@ -133,7 +130,6 @@ public class ManagePolicy {
);
policy.setPublicKeyAlgorithmPolicy(customPolicy);
pkAlgorithmPolicy = policy.getPublicKeyAlgorithmPolicy();
assertTrue(pkAlgorithmPolicy.isAcceptable(PublicKeyAlgorithm.RSA_GENERAL, 4096));
// RSA 2048 is no longer acceptable
@ -156,10 +152,8 @@ public class ManagePolicy {
NotationRegistry notationRegistry = policy.getNotationRegistry();
assertFalse(notationRegistry.isKnownNotation("unknown@pgpainless.org"));
notationRegistry.addKnownNotation("unknown@pgpainless.org");
assertTrue(notationRegistry.isKnownNotation("unknown@pgpainless.org"));
}
}

View file

@ -67,7 +67,6 @@ public class ModifyKeys {
// the certificate consists of only the public keys
PGPPublicKeyRing certificate = PGPainless.extractCertificate(secretKey);
KeyRingInfo info = PGPainless.inspectKeyRing(certificate);
assertFalse(info.isSecretKey());
}
@ -79,11 +78,9 @@ public class ModifyKeys {
public void toAsciiArmoredString() throws IOException {
PGPPublicKeyRing certificate = PGPainless.extractCertificate(secretKey);
String asciiArmoredSecretKey = PGPainless.asciiArmor(secretKey);
String asciiArmoredCertificate = PGPainless.asciiArmor(certificate);
assertTrue(asciiArmoredSecretKey.startsWith("-----BEGIN PGP PRIVATE KEY BLOCK-----"));
assertTrue(asciiArmoredCertificate.startsWith("-----BEGIN PGP PUBLIC KEY BLOCK-----"));
}
@ -99,7 +96,6 @@ public class ModifyKeys {
.toNewPassphrase(Passphrase.fromPassword("n3wP4ssW0rD"))
.done();
// Old passphrase no longer works
assertThrows(WrongPassphraseException.class, () ->
UnlockSecretKey.unlockSecretKey(secretKey.getSecretKey(), Passphrase.fromPassword(originalPassphrase)));
@ -120,7 +116,6 @@ public class ModifyKeys {
.toNewPassphrase(Passphrase.fromPassword("cryptP4ssphr4s3"))
.done();
// encryption key can now only be unlocked using the new passphrase
assertThrows(WrongPassphraseException.class, () ->
UnlockSecretKey.unlockSecretKey(
@ -143,7 +138,6 @@ public class ModifyKeys {
.addUserId("additional@user.id", protector)
.done();
KeyRingInfo info = PGPainless.inspectKeyRing(secretKey);
assertTrue(info.isUserIdValid("additional@user.id"));
assertFalse(info.isUserIdValid("another@user.id"));
@ -176,7 +170,6 @@ public class ModifyKeys {
protector)
.done();
KeyRingInfo info = PGPainless.inspectKeyRing(secretKey);
assertEquals(4, info.getSecretKeys().size());
assertEquals(4, info.getPublicKeys().size());
@ -199,7 +192,6 @@ public class ModifyKeys {
.setExpirationDate(expirationDate, protector)
.done();
KeyRingInfo info = PGPainless.inspectKeyRing(secretKey);
assertEquals(DateUtil.formatUTCDate(expirationDate),
DateUtil.formatUTCDate(info.getPrimaryKeyExpirationDate()));

View file

@ -44,7 +44,6 @@ public class ReadKeys {
PGPPublicKeyRing publicKey = PGPainless.readKeyRing()
.publicKeyRing(certificate);
KeyRingInfo keyInfo = new KeyRingInfo(publicKey);
OpenPgpFingerprint fingerprint = new OpenPgpV4Fingerprint("EB85 BB5F A33A 75E1 5E94 4E63 F231 550C 4F47 E38E");
assertEquals(fingerprint, keyInfo.getFingerprint());
@ -77,7 +76,6 @@ public class ReadKeys {
PGPSecretKeyRing secretKey = PGPainless.readKeyRing()
.secretKeyRing(key);
KeyRingInfo keyInfo = new KeyRingInfo(secretKey);
OpenPgpFingerprint fingerprint = new OpenPgpV4Fingerprint("EB85 BB5F A33A 75E1 5E94 4E63 F231 550C 4F47 E38E");
assertEquals(fingerprint, keyInfo.getFingerprint());

View file

@ -40,7 +40,6 @@ public class UnlockSecretKeys {
// This protector will only unlock unprotected keys
SecretKeyRingProtector protector = SecretKeyRingProtector.unprotectedKeys();
assertProtectorUnlocksAllSecretKeys(unprotectedKey, protector);
}
@ -105,7 +104,6 @@ public class UnlockSecretKeys {
protector.addPassphrase(new OpenPgpV4Fingerprint("DD8E1195E4B1720E7FB10EF7F60402708E75D941"),
Passphrase.fromPassword("s3c0ndsubk3y"));
assertProtectorUnlocksAllSecretKeys(secretKey, protector);
}