1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-26 06:12:06 +01:00

Merge pull request #7 from Flowdalic/tune-down-logging

Tune down the INFO logging, use debug log level where sensible
This commit is contained in:
Paul Schaub 2019-04-18 14:22:49 +02:00 committed by GitHub
commit 308aa18b7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 19 deletions

View file

@ -216,16 +216,16 @@ public final class DecryptionStreamFactory {
} }
if (verificationKey == null) { if (verificationKey == null) {
LOGGER.log(Level.INFO, "No public key for signature of " + Long.toHexString(keyId) + " found."); LOGGER.log(Level.FINER, "No public key for signature of " + Long.toHexString(keyId) + " found.");
if (missingPublicKeyCallback == null) { if (missingPublicKeyCallback == null) {
LOGGER.log(Level.INFO, "Skip signature of " + Long.toHexString(keyId)); LOGGER.log(Level.FINER, "Skip signature of " + Long.toHexString(keyId));
continue; continue;
} }
PGPPublicKey missingPublicKey = missingPublicKeyCallback.onMissingPublicKeyEncountered(keyId); PGPPublicKey missingPublicKey = missingPublicKeyCallback.onMissingPublicKeyEncountered(keyId);
if (missingPublicKey == null) { if (missingPublicKey == null) {
LOGGER.log(Level.INFO, "Skip signature of " + Long.toHexString(keyId)); LOGGER.log(Level.FINER, "Skip signature of " + Long.toHexString(keyId));
continue; continue;
} }

View file

@ -73,7 +73,7 @@ public class KeyRingSubKeyFix {
PGPSecretKey secSubKey = secretKeyIterator.next(); PGPSecretKey secSubKey = secretKeyIterator.next();
if (secSubKey.isMasterKey()) { if (secSubKey.isMasterKey()) {
LOGGER.log(Level.INFO, Long.toHexString(secSubKey.getKeyID()) + " is master key. Skip."); LOGGER.log(Level.FINER, Long.toHexString(secSubKey.getKeyID()) + " is master key. Skip.");
_secretKeys.add(secSubKey); _secretKeys.add(secSubKey);
continue; continue;
} }
@ -93,7 +93,7 @@ public class KeyRingSubKeyFix {
} }
// Sub key is normal key -> fix // Sub key is normal key -> fix
LOGGER.log(Level.INFO, "Subkey " + Long.toHexString(secSubKey.getKeyID()) + " does not have a subkey key packet. Convert it..."); LOGGER.log(Level.FINER, "Subkey " + Long.toHexString(secSubKey.getKeyID()) + " does not have a subkey key packet. Convert it...");
keyPacket = new PublicSubkeyPacket(pubSubKey.getAlgorithm(), pubSubKey.getCreationTime(), keyPacket.getKey()); keyPacket = new PublicSubkeyPacket(pubSubKey.getAlgorithm(), pubSubKey.getCreationTime(), keyPacket.getKey());
publicPk.set(pubSubKey, keyPacket); publicPk.set(pubSubKey, keyPacket);

View file

@ -57,22 +57,22 @@ public class BCUtilTest extends AbstractPGPainlessTest {
PGPSecretKeyRing sec = ring.getSecretKeys(); PGPSecretKeyRing sec = ring.getSecretKeys();
PGPPublicKeyRing pub = ring.getPublicKeys(); PGPPublicKeyRing pub = ring.getPublicKeys();
LOGGER.log(Level.INFO, "Main ID: " + sec.getPublicKey().getKeyID() + " " + pub.getPublicKey().getKeyID()); LOGGER.log(Level.FINER, "Main ID: " + sec.getPublicKey().getKeyID() + " " + pub.getPublicKey().getKeyID());
int secSize = 1; int secSize = 1;
Iterator<PGPPublicKey> secPubIt = sec.getPublicKeys(); Iterator<PGPPublicKey> secPubIt = sec.getPublicKeys();
while (secPubIt.hasNext()) { while (secPubIt.hasNext()) {
PGPPublicKey k = secPubIt.next(); PGPPublicKey k = secPubIt.next();
LOGGER.log(Level.INFO, secSize + " " + k.getKeyID() + " " + k.isEncryptionKey() + " " + k.isMasterKey()); LOGGER.log(Level.FINER, secSize + " " + k.getKeyID() + " " + k.isEncryptionKey() + " " + k.isMasterKey());
secSize++; secSize++;
} }
LOGGER.log(Level.INFO, "After BCUtil.publicKeyRingFromSecretKeyRing()"); LOGGER.log(Level.FINER, "After BCUtil.publicKeyRingFromSecretKeyRing()");
int pubSize = 1; int pubSize = 1;
Iterator<PGPPublicKey> pubPubIt = pub.getPublicKeys(); Iterator<PGPPublicKey> pubPubIt = pub.getPublicKeys();
while (pubPubIt.hasNext()) { while (pubPubIt.hasNext()) {
PGPPublicKey k = pubPubIt.next(); PGPPublicKey k = pubPubIt.next();
LOGGER.log(Level.INFO, pubSize + " " + k.getKeyID() + " " + k.isEncryptionKey() + " " + k.isMasterKey()); LOGGER.log(Level.FINER, pubSize + " " + k.getKeyID() + " " + k.isEncryptionKey() + " " + k.isMasterKey());
pubSize++; pubSize++;
} }
@ -84,11 +84,11 @@ public class BCUtilTest extends AbstractPGPainlessTest {
Iterator<PGPSecretKeyRing> secColIt = secCol.getKeyRings(); Iterator<PGPSecretKeyRing> secColIt = secCol.getKeyRings();
while (secColIt.hasNext()) { while (secColIt.hasNext()) {
PGPSecretKeyRing r = secColIt.next(); PGPSecretKeyRing r = secColIt.next();
LOGGER.log(Level.INFO, "" + r.getPublicKey().getKeyID()); LOGGER.log(Level.FINER, "" + r.getPublicKey().getKeyID());
secColSize++; secColSize++;
} }
LOGGER.log(Level.INFO, "SecCol: " + secColSize); LOGGER.log(Level.FINER, "SecCol: " + secColSize);
PGPPublicKeyRingCollection pubCol = BCUtil.keyRingsToKeyRingCollection(pub); PGPPublicKeyRingCollection pubCol = BCUtil.keyRingsToKeyRingCollection(pub);
@ -96,11 +96,11 @@ public class BCUtilTest extends AbstractPGPainlessTest {
Iterator<PGPPublicKeyRing> pubColIt = pubCol.getKeyRings(); Iterator<PGPPublicKeyRing> pubColIt = pubCol.getKeyRings();
while (pubColIt.hasNext()) { while (pubColIt.hasNext()) {
PGPPublicKeyRing r = pubColIt.next(); PGPPublicKeyRing r = pubColIt.next();
LOGGER.log(Level.INFO, "" + r.getPublicKey().getKeyID()); LOGGER.log(Level.FINER, "" + r.getPublicKey().getKeyID());
pubColSize++; pubColSize++;
} }
LOGGER.log(Level.INFO, "PubCol: " + pubColSize); LOGGER.log(Level.FINER, "PubCol: " + pubColSize);
} }
@Test @Test

View file

@ -47,7 +47,7 @@ public class LengthTest extends AbstractPGPainlessTest {
public void ecEc() public void ecEc()
throws PGPException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, throws PGPException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException,
IOException { IOException {
LOGGER.log(Level.INFO, "\nEC -> EC"); LOGGER.log(Level.FINER, "\nEC -> EC");
PGPKeyRing sender = PGPainless.generateKeyRing().simpleEcKeyRing("simplejid@server.tld"); PGPKeyRing sender = PGPainless.generateKeyRing().simpleEcKeyRing("simplejid@server.tld");
PGPKeyRing recipient = PGPainless.generateKeyRing().simpleEcKeyRing("otherjid@other.srv"); PGPKeyRing recipient = PGPainless.generateKeyRing().simpleEcKeyRing("otherjid@other.srv");
encryptDecryptForSecretKeyRings(sender, recipient); encryptDecryptForSecretKeyRings(sender, recipient);
@ -58,7 +58,7 @@ public class LengthTest extends AbstractPGPainlessTest {
public void RsaRsa() public void RsaRsa()
throws PGPException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, throws PGPException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException,
IOException { IOException {
LOGGER.log(Level.INFO, "\nRSA-2048 -> RSA-2048"); LOGGER.log(Level.FINER, "\nRSA-2048 -> RSA-2048");
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
PGPKeyRing sender = PGPainless.generateKeyRing().simpleRsaKeyRing("simplejid@server.tld", RsaLength._2048); PGPKeyRing sender = PGPainless.generateKeyRing().simpleRsaKeyRing("simplejid@server.tld", RsaLength._2048);
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -70,7 +70,7 @@ public class LengthTest extends AbstractPGPainlessTest {
public void RsaRsa4096() public void RsaRsa4096()
throws PGPException, throws PGPException,
IOException { IOException {
LOGGER.log(Level.INFO, "\nRSA-4096 -> RSA-4096"); LOGGER.log(Level.FINER, "\nRSA-4096 -> RSA-4096");
PGPKeyRing sender = PGPainless.readKeyRing().keyRing(TestKeys.JULIET_PUB, TestKeys.JULIET_SEC); PGPKeyRing sender = PGPainless.readKeyRing().keyRing(TestKeys.JULIET_PUB, TestKeys.JULIET_SEC);
PGPKeyRing recipient = PGPainless.readKeyRing().keyRing(TestKeys.ROMEO_PUB, TestKeys.ROMEO_SEC); PGPKeyRing recipient = PGPainless.readKeyRing().keyRing(TestKeys.ROMEO_PUB, TestKeys.ROMEO_SEC);
encryptDecryptForSecretKeyRings(sender, recipient); encryptDecryptForSecretKeyRings(sender, recipient);
@ -79,7 +79,7 @@ public class LengthTest extends AbstractPGPainlessTest {
// @Test // @Test
public void rsaEc() throws PGPException, IOException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, public void rsaEc() throws PGPException, IOException, InvalidAlgorithmParameterException, NoSuchAlgorithmException,
NoSuchProviderException { NoSuchProviderException {
LOGGER.log(Level.INFO, "\nRSA-2048 -> EC"); LOGGER.log(Level.FINER, "\nRSA-2048 -> EC");
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
PGPKeyRing sender = PGPainless.generateKeyRing().simpleRsaKeyRing("simplejid@server.tld", RsaLength._2048); PGPKeyRing sender = PGPainless.generateKeyRing().simpleRsaKeyRing("simplejid@server.tld", RsaLength._2048);
PGPKeyRing recipient = PGPainless.generateKeyRing().simpleEcKeyRing("otherjid@other.srv"); PGPKeyRing recipient = PGPainless.generateKeyRing().simpleEcKeyRing("otherjid@other.srv");
@ -90,7 +90,7 @@ public class LengthTest extends AbstractPGPainlessTest {
public void ecRsa() public void ecRsa()
throws PGPException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, throws PGPException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException,
IOException { IOException {
LOGGER.log(Level.INFO, "\nEC -> RSA-2048"); LOGGER.log(Level.FINER, "\nEC -> RSA-2048");
PGPKeyRing sender = PGPainless.generateKeyRing().simpleEcKeyRing("simplejid@server.tld"); PGPKeyRing sender = PGPainless.generateKeyRing().simpleEcKeyRing("simplejid@server.tld");
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
PGPKeyRing recipient = PGPainless.generateKeyRing().simpleRsaKeyRing("otherjid@other.srv", RsaLength._2048); PGPKeyRing recipient = PGPainless.generateKeyRing().simpleRsaKeyRing("otherjid@other.srv", RsaLength._2048);
@ -126,7 +126,7 @@ public class LengthTest extends AbstractPGPainlessTest {
encryptor.close(); encryptor.close();
byte[] encryptedSecretMessage = envelope.toByteArray(); byte[] encryptedSecretMessage = envelope.toByteArray();
LOGGER.log(Level.INFO,"\n" + encryptedSecretMessage.length); LOGGER.log(Level.FINER,"\n" + encryptedSecretMessage.length);
} }
} }
} }