diff --git a/build.gradle b/build.gradle index e082c632..5802b4b9 100644 --- a/build.gradle +++ b/build.gradle @@ -16,6 +16,13 @@ animalsniffer { sourceSets = [sourceSets.main] } +apply plugin: 'checkstyle' + +checkstyle { + configFile = 'config/checkstyle.xml' as File + toolVersion = '8.10' +} + group 'org.pgpainless' version '0.1-SNAPSHOT' diff --git a/config/checkstyle.xml b/config/checkstyle.xml new file mode 100644 index 00000000..cdf0c1ce --- /dev/null +++ b/config/checkstyle.xml @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/checkstyleLicenseHeader.txt b/config/checkstyleLicenseHeader.txt new file mode 100644 index 00000000..fb341cd2 --- /dev/null +++ b/config/checkstyleLicenseHeader.txt @@ -0,0 +1,15 @@ +/* + * Copyright 2018 Author Authorsson. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ \ No newline at end of file diff --git a/config/suppressions.xml b/config/suppressions.xml new file mode 100644 index 00000000..f2aba18d --- /dev/null +++ b/config/suppressions.xml @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/src/main/java/org/pgpainless/pgpainless/algorithm/CompressionAlgorithm.java b/src/main/java/org/pgpainless/pgpainless/algorithm/CompressionAlgorithm.java index 1cf00ba5..16b465e2 100644 --- a/src/main/java/org/pgpainless/pgpainless/algorithm/CompressionAlgorithm.java +++ b/src/main/java/org/pgpainless/pgpainless/algorithm/CompressionAlgorithm.java @@ -22,10 +22,10 @@ import org.bouncycastle.bcpg.CompressionAlgorithmTags; public enum CompressionAlgorithm { - UNCOMPRESSED( CompressionAlgorithmTags.UNCOMPRESSED), - ZIP( CompressionAlgorithmTags.ZIP), - ZLIB( CompressionAlgorithmTags.ZLIB), - BZIP2( CompressionAlgorithmTags.BZIP2), + UNCOMPRESSED (CompressionAlgorithmTags.UNCOMPRESSED), + ZIP (CompressionAlgorithmTags.ZIP), + ZLIB (CompressionAlgorithmTags.ZLIB), + BZIP2 (CompressionAlgorithmTags.BZIP2), ; private static final Map MAP = new HashMap<>(); diff --git a/src/main/java/org/pgpainless/pgpainless/algorithm/HashAlgorithm.java b/src/main/java/org/pgpainless/pgpainless/algorithm/HashAlgorithm.java index 132a4177..56877bb6 100644 --- a/src/main/java/org/pgpainless/pgpainless/algorithm/HashAlgorithm.java +++ b/src/main/java/org/pgpainless/pgpainless/algorithm/HashAlgorithm.java @@ -22,17 +22,17 @@ import org.bouncycastle.bcpg.HashAlgorithmTags; public enum HashAlgorithm { - MD5( HashAlgorithmTags.MD5), - SHA1( HashAlgorithmTags.SHA1), - RIPEMD160( HashAlgorithmTags.RIPEMD160), - DOUBLE_SHA( HashAlgorithmTags.DOUBLE_SHA), - MD2( HashAlgorithmTags.MD2), - TIGER_192( HashAlgorithmTags.TIGER_192), + MD5 (HashAlgorithmTags.MD5), + SHA1 (HashAlgorithmTags.SHA1), + RIPEMD160 (HashAlgorithmTags.RIPEMD160), + DOUBLE_SHA (HashAlgorithmTags.DOUBLE_SHA), + MD2 (HashAlgorithmTags.MD2), + TIGER_192 (HashAlgorithmTags.TIGER_192), HAVAL_5_160(HashAlgorithmTags.HAVAL_5_160), - SHA256( HashAlgorithmTags.SHA256), - SHA384( HashAlgorithmTags.SHA384), - SHA512( HashAlgorithmTags.SHA512), - SHA224( HashAlgorithmTags.SHA224), + SHA256 (HashAlgorithmTags.SHA256), + SHA384 (HashAlgorithmTags.SHA384), + SHA512 (HashAlgorithmTags.SHA512), + SHA224 (HashAlgorithmTags.SHA224), ; // Coincidence? I don't this so... private static final Map MAP = new HashMap<>(); diff --git a/src/main/java/org/pgpainless/pgpainless/algorithm/KeyFlag.java b/src/main/java/org/pgpainless/pgpainless/algorithm/KeyFlag.java index dc0a3f9a..ad8b0f8b 100644 --- a/src/main/java/org/pgpainless/pgpainless/algorithm/KeyFlag.java +++ b/src/main/java/org/pgpainless/pgpainless/algorithm/KeyFlag.java @@ -22,13 +22,13 @@ import org.bouncycastle.bcpg.sig.KeyFlags; public enum KeyFlag { - CERTIFY_OTHER( KeyFlags.CERTIFY_OTHER), - SIGN_DATA( KeyFlags.SIGN_DATA), - ENCRYPT_COMMS( KeyFlags.ENCRYPT_COMMS), + CERTIFY_OTHER (KeyFlags.CERTIFY_OTHER), + SIGN_DATA (KeyFlags.SIGN_DATA), + ENCRYPT_COMMS (KeyFlags.ENCRYPT_COMMS), ENCRYPT_STORAGE(KeyFlags.ENCRYPT_STORAGE), - SPLIT( KeyFlags.SPLIT), - AUTHENTICATION( KeyFlags.AUTHENTICATION), - SHARED( KeyFlags.SHARED), + SPLIT (KeyFlags.SPLIT), + AUTHENTICATION (KeyFlags.AUTHENTICATION), + SHARED (KeyFlags.SHARED), ; private final int flag; diff --git a/src/main/java/org/pgpainless/pgpainless/algorithm/PublicKeyAlgorithm.java b/src/main/java/org/pgpainless/pgpainless/algorithm/PublicKeyAlgorithm.java index 9e0f4825..9b027eba 100644 --- a/src/main/java/org/pgpainless/pgpainless/algorithm/PublicKeyAlgorithm.java +++ b/src/main/java/org/pgpainless/pgpainless/algorithm/PublicKeyAlgorithm.java @@ -22,19 +22,20 @@ import org.bouncycastle.bcpg.PublicKeyAlgorithmTags; public enum PublicKeyAlgorithm { - RSA_GENERAL( PublicKeyAlgorithmTags.RSA_GENERAL), - RSA_ENCRYPT( PublicKeyAlgorithmTags.RSA_ENCRYPT), - RSA_SIGN( PublicKeyAlgorithmTags.RSA_SIGN), - ELGAMAL_ENCRYPT(PublicKeyAlgorithmTags.ELGAMAL_ENCRYPT), - DSA(PublicKeyAlgorithmTags.DSA), + RSA_GENERAL (PublicKeyAlgorithmTags.RSA_GENERAL), + RSA_ENCRYPT (PublicKeyAlgorithmTags.RSA_ENCRYPT), + RSA_SIGN (PublicKeyAlgorithmTags.RSA_SIGN), + ELGAMAL_ENCRYPT (PublicKeyAlgorithmTags.ELGAMAL_ENCRYPT), + DSA (PublicKeyAlgorithmTags.DSA), /** + * EC is deprecated. * @deprecated use {@link #ECDH} instead. */ - EC( PublicKeyAlgorithmTags.EC), - ECDH( PublicKeyAlgorithmTags.ECDH), - ECDSA( PublicKeyAlgorithmTags.ECDSA), - ELGAMAL_GENERAL(PublicKeyAlgorithmTags.ELGAMAL_GENERAL), - DIFFIE_HELLMAN( PublicKeyAlgorithmTags.DIFFIE_HELLMAN), + EC (PublicKeyAlgorithmTags.EC), + ECDH (PublicKeyAlgorithmTags.ECDH), + ECDSA (PublicKeyAlgorithmTags.ECDSA), + ELGAMAL_GENERAL (PublicKeyAlgorithmTags.ELGAMAL_GENERAL), + DIFFIE_HELLMAN (PublicKeyAlgorithmTags.DIFFIE_HELLMAN), ; private static final Map MAP = new HashMap<>(); diff --git a/src/main/java/org/pgpainless/pgpainless/algorithm/SymmetricKeyAlgorithm.java b/src/main/java/org/pgpainless/pgpainless/algorithm/SymmetricKeyAlgorithm.java index 219578e1..1ffd8b69 100644 --- a/src/main/java/org/pgpainless/pgpainless/algorithm/SymmetricKeyAlgorithm.java +++ b/src/main/java/org/pgpainless/pgpainless/algorithm/SymmetricKeyAlgorithm.java @@ -22,20 +22,24 @@ import org.bouncycastle.bcpg.SymmetricKeyAlgorithmTags; public enum SymmetricKeyAlgorithm { - NULL( SymmetricKeyAlgorithmTags.NULL), - IDEA( SymmetricKeyAlgorithmTags.IDEA), - TRIPLE_DES( SymmetricKeyAlgorithmTags.TRIPLE_DES), - CAST5( SymmetricKeyAlgorithmTags.CAST5), - BLOWFISH( SymmetricKeyAlgorithmTags.BLOWFISH), - SAFER( SymmetricKeyAlgorithmTags.SAFER), - DES( SymmetricKeyAlgorithmTags.DES), - AES_128( SymmetricKeyAlgorithmTags.AES_128), - AES_192( SymmetricKeyAlgorithmTags.AES_192), - AES_256( SymmetricKeyAlgorithmTags.AES_256), - TWOFISH( SymmetricKeyAlgorithmTags.TWOFISH), - CAMELLIA_128( SymmetricKeyAlgorithmTags.CAMELLIA_128), - CAMELLIA_192( SymmetricKeyAlgorithmTags.CAMELLIA_192), - CAMELLIA_256( SymmetricKeyAlgorithmTags.CAMELLIA_256), + NULL (SymmetricKeyAlgorithmTags.NULL), + /** + * IDEA is deprecated. + * @deprecated use a different algorithm. + */ + IDEA (SymmetricKeyAlgorithmTags.IDEA), + TRIPLE_DES (SymmetricKeyAlgorithmTags.TRIPLE_DES), + CAST5 (SymmetricKeyAlgorithmTags.CAST5), + BLOWFISH (SymmetricKeyAlgorithmTags.BLOWFISH), + SAFER (SymmetricKeyAlgorithmTags.SAFER), + DES (SymmetricKeyAlgorithmTags.DES), + AES_128 (SymmetricKeyAlgorithmTags.AES_128), + AES_192 (SymmetricKeyAlgorithmTags.AES_192), + AES_256 (SymmetricKeyAlgorithmTags.AES_256), + TWOFISH (SymmetricKeyAlgorithmTags.TWOFISH), + CAMELLIA_128 (SymmetricKeyAlgorithmTags.CAMELLIA_128), + CAMELLIA_192 (SymmetricKeyAlgorithmTags.CAMELLIA_192), + CAMELLIA_256 (SymmetricKeyAlgorithmTags.CAMELLIA_256), ; private static final Map MAP = new HashMap<>(); diff --git a/src/main/java/org/pgpainless/pgpainless/algorithm/package-info.java b/src/main/java/org/pgpainless/pgpainless/algorithm/package-info.java new file mode 100644 index 00000000..27b18dbc --- /dev/null +++ b/src/main/java/org/pgpainless/pgpainless/algorithm/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Enums which map to OpenPGP's algorithm IDs. + */ +package org.pgpainless.pgpainless.algorithm; diff --git a/src/main/java/org/pgpainless/pgpainless/decryption_verification/DecryptionStreamFactory.java b/src/main/java/org/pgpainless/pgpainless/decryption_verification/DecryptionStreamFactory.java index f9d07d2b..bd9c44b9 100644 --- a/src/main/java/org/pgpainless/pgpainless/decryption_verification/DecryptionStreamFactory.java +++ b/src/main/java/org/pgpainless/pgpainless/decryption_verification/DecryptionStreamFactory.java @@ -50,7 +50,7 @@ import org.pgpainless.pgpainless.algorithm.CompressionAlgorithm; import org.pgpainless.pgpainless.algorithm.SymmetricKeyAlgorithm; import org.pgpainless.pgpainless.key.SecretKeyRingProtector; -public class DecryptionStreamFactory { +public final class DecryptionStreamFactory { private static final Logger LOGGER = Logger.getLogger(DecryptionStreamFactory.class.getName()); private static final Level LEVEL = Level.FINE; diff --git a/src/main/java/org/pgpainless/pgpainless/decryption_verification/package-info.java b/src/main/java/org/pgpainless/pgpainless/decryption_verification/package-info.java new file mode 100644 index 00000000..8db36bb0 --- /dev/null +++ b/src/main/java/org/pgpainless/pgpainless/decryption_verification/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Classes used to decryption and verification of OpenPGP encrypted / signed data. + */ +package org.pgpainless.pgpainless.decryption_verification; diff --git a/src/main/java/org/pgpainless/pgpainless/encryption_signing/EncryptionBuilder.java b/src/main/java/org/pgpainless/pgpainless/encryption_signing/EncryptionBuilder.java index b995a7d7..8cc0b801 100644 --- a/src/main/java/org/pgpainless/pgpainless/encryption_signing/EncryptionBuilder.java +++ b/src/main/java/org/pgpainless/pgpainless/encryption_signing/EncryptionBuilder.java @@ -93,7 +93,7 @@ public class EncryptionBuilder implements EncryptionBuilderInterface { } @Override - public WithAlgorithms toRecipients(PublicKeyRingSelectionStrategy ringSelectionStrategy, + public WithAlgorithms toRecipients(PublicKeyRingSelectionStrategy ringSelectionStrategy, MultiMap keys) { if (keys.isEmpty()) { throw new IllegalArgumentException("Recipient map MUST NOT be empty."); @@ -151,7 +151,7 @@ public class EncryptionBuilder implements EncryptionBuilderInterface { return this; } - public WithAlgorithms andToSelf(PublicKeyRingSelectionStrategy ringSelectionStrategy, + public WithAlgorithms andToSelf(PublicKeyRingSelectionStrategy ringSelectionStrategy, MultiMap keys) { if (keys.isEmpty()) { throw new IllegalArgumentException("Recipient list MUST NOT be empty."); @@ -230,7 +230,7 @@ public class EncryptionBuilder implements EncryptionBuilderInterface { } @Override - public Armor signWith(SecretKeyRingSelectionStrategy ringSelectionStrategy, + public Armor signWith(SecretKeyRingSelectionStrategy ringSelectionStrategy, SecretKeyRingProtector decryptor, MultiMap keys) { if (keys.isEmpty()) { diff --git a/src/main/java/org/pgpainless/pgpainless/encryption_signing/EncryptionStream.java b/src/main/java/org/pgpainless/pgpainless/encryption_signing/EncryptionStream.java index 10099f8c..5ab0a08a 100644 --- a/src/main/java/org/pgpainless/pgpainless/encryption_signing/EncryptionStream.java +++ b/src/main/java/org/pgpainless/pgpainless/encryption_signing/EncryptionStream.java @@ -49,7 +49,7 @@ import org.pgpainless.pgpainless.decryption_verification.PainlessResult; * This class is based upon Jens Neuhalfen's Bouncy-GPG PGPEncryptingStream. * @see Source */ -public class EncryptionStream extends OutputStream { +public final class EncryptionStream extends OutputStream { private static final Logger LOGGER = Logger.getLogger(EncryptionStream.class.getName()); private static final Level LEVEL = Level.FINE; diff --git a/src/main/java/org/pgpainless/pgpainless/encryption_signing/package-info.java b/src/main/java/org/pgpainless/pgpainless/encryption_signing/package-info.java new file mode 100644 index 00000000..22bfa79e --- /dev/null +++ b/src/main/java/org/pgpainless/pgpainless/encryption_signing/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Classes used to encrypt or sign data using OpenPGP. + */ +package org.pgpainless.pgpainless.encryption_signing; diff --git a/src/main/java/org/pgpainless/pgpainless/key/generation/KeyRingBuilder.java b/src/main/java/org/pgpainless/pgpainless/key/generation/KeyRingBuilder.java index ea026bdd..fe84b5d1 100644 --- a/src/main/java/org/pgpainless/pgpainless/key/generation/KeyRingBuilder.java +++ b/src/main/java/org/pgpainless/pgpainless/key/generation/KeyRingBuilder.java @@ -228,4 +228,4 @@ public class KeyRingBuilder implements KeyRingBuilderInterface { } } } -} \ No newline at end of file +} diff --git a/src/main/java/org/pgpainless/pgpainless/key/generation/package-info.java b/src/main/java/org/pgpainless/pgpainless/key/generation/package-info.java new file mode 100644 index 00000000..c85ab077 --- /dev/null +++ b/src/main/java/org/pgpainless/pgpainless/key/generation/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Classes related to OpenPGP key generation. + */ +package org.pgpainless.pgpainless.key.generation; diff --git a/src/main/java/org/pgpainless/pgpainless/key/generation/type/curve/package-info.java b/src/main/java/org/pgpainless/pgpainless/key/generation/type/curve/package-info.java new file mode 100644 index 00000000..89c6eb3d --- /dev/null +++ b/src/main/java/org/pgpainless/pgpainless/key/generation/type/curve/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Classes related to elliptic curve cryptography. + */ +package org.pgpainless.pgpainless.key.generation.type.curve; diff --git a/src/main/java/org/pgpainless/pgpainless/key/generation/type/length/ElGamalLength.java b/src/main/java/org/pgpainless/pgpainless/key/generation/type/length/ElGamalLength.java index 5071eb78..31a617ea 100644 --- a/src/main/java/org/pgpainless/pgpainless/key/generation/type/length/ElGamalLength.java +++ b/src/main/java/org/pgpainless/pgpainless/key/generation/type/length/ElGamalLength.java @@ -26,37 +26,37 @@ import java.math.BigInteger; public enum ElGamalLength implements KeyLength { /** - * prime: 2^1536 - 2^1472 - 1 + 2^64 * { [2^1406 pi] + 741804 } + * prime: 2^1536 - 2^1472 - 1 + 2^64 * { [2^1406 pi] + 741804 }. * generator: 2 */ _1536(1536, "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF", "2"), /** - * prime: 2^2048 - 2^1984 - 1 + 2^64 * { [2^1918 pi] + 124476 } + * prime: 2^2048 - 2^1984 - 1 + 2^64 * { [2^1918 pi] + 124476 }. * generator: 2 */ _2048(2048, "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF", "2"), /** - * prime: 2^3072 - 2^3008 - 1 + 2^64 * { [2^2942 pi] + 1690314 } + * prime: 2^3072 - 2^3008 - 1 + 2^64 * { [2^2942 pi] + 1690314 }. * generator: 2 */ _3072(3072, "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF", "2"), /** - * prime: 2^4096 - 2^4032 - 1 + 2^64 * { [2^3966 pi] + 240904 } + * prime: 2^4096 - 2^4032 - 1 + 2^64 * { [2^3966 pi] + 240904 }. * generator: 2 */ _4096(4096, "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA993B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199FFFFFFFFFFFFFFFF", "2"), /** - * prime: 2^6144 - 2^6080 - 1 + 2^64 * { [2^6014 pi] + 929484 } + * prime: 2^6144 - 2^6080 - 1 + 2^64 * { [2^6014 pi] + 929484 }. * generator: 2 */ _6144(6144, "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA993B4EA988D8FDDC186FFB7DC90A6C08F4DF435C93402849236C3FAB4D27C7026C1D4DCB2602646DEC9751E763DBA37BDF8FF9406AD9E530EE5DB382F413001AEB06A53ED9027D831179727B0865A8918DA3EDBEBCF9B14ED44CE6CBACED4BB1BDB7F1447E6CC254B332051512BD7AF426FB8F401378CD2BF5983CA01C64B92ECF032EA15D1721D03F482D7CE6E74FEF6D55E702F46980C82B5A84031900B1C9E59E7C97FBEC7E8F323A97A7E36CC88BE0F1D45B7FF585AC54BD407B22B4154AACC8F6D7EBF48E1D814CC5ED20F8037E0A79715EEF29BE32806A1D58BB7C5DA76F550AA3D8A1FBFF0EB19CCB1A313D55CDA56C9EC2EF29632387FE8D76E3C0468043E8F663F4860EE12BF2D5B0B7474D6E694F91E6DCC4024FFFFFFFFFFFFFFFF", "2"), /** - * prime: 2^8192 - 2^8128 - 1 + 2^64 * { [2^8062 pi] + 4743158 } + * prime: 2^8192 - 2^8128 - 1 + 2^64 * { [2^8062 pi] + 4743158 }. * generator: 2 */ _8192(8192, "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA993B4EA988D8FDDC186FFB7DC90A6C08F4DF435C93402849236C3FAB4D27C7026C1D4DCB2602646DEC9751E763DBA37BDF8FF9406AD9E530EE5DB382F413001AEB06A53ED9027D831179727B0865A8918DA3EDBEBCF9B14ED44CE6CBACED4BB1BDB7F1447E6CC254B332051512BD7AF426FB8F401378CD2BF5983CA01C64B92ECF032EA15D1721D03F482D7CE6E74FEF6D55E702F46980C82B5A84031900B1C9E59E7C97FBEC7E8F323A97A7E36CC88BE0F1D45B7FF585AC54BD407B22B4154AACC8F6D7EBF48E1D814CC5ED20F8037E0A79715EEF29BE32806A1D58BB7C5DA76F550AA3D8A1FBFF0EB19CCB1A313D55CDA56C9EC2EF29632387FE8D76E3C0468043E8F663F4860EE12BF2D5B0B7474D6E694F91E6DBE115974A3926F12FEE5E438777CB6A932DF8CD8BEC4D073B931BA3BC832B68D9DD300741FA7BF8AFC47ED2576F6936BA424663AAB639C5AE4F5683423B4742BF1C978238F16CBE39D652DE3FDB8BEFC848AD922222E04A4037C0713EB57A81A23F0C73473FC646CEA306B4BCBC8862F8385DDFA9D4B7FA2C087E879683303ED5BDD3A062B3CF5B3A278A66D2A13F83F44F82DDF310EE074AB6A364597E899A0255DC164F31CC50846851DF9AB48195DED7EA1B1D510BD7EE74D73FAF36BC31ECFA268359046F4EB879F924009438B481C6CD7889A002ED5EE382BC9190DA6FC026E479558E4475677E9AA9E3050E2765694DFC81F56E880B96E7160C980DD98EDD3DFFFFFFFFFFFFFFFFF", "2") diff --git a/src/main/java/org/pgpainless/pgpainless/key/generation/type/length/package-info.java b/src/main/java/org/pgpainless/pgpainless/key/generation/type/length/package-info.java new file mode 100644 index 00000000..bc5f712e --- /dev/null +++ b/src/main/java/org/pgpainless/pgpainless/key/generation/type/length/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Classes describing the lengths of different public key crypto systems. + */ +package org.pgpainless.pgpainless.key.generation.type.length; diff --git a/src/main/java/org/pgpainless/pgpainless/key/generation/type/package-info.java b/src/main/java/org/pgpainless/pgpainless/key/generation/type/package-info.java new file mode 100644 index 00000000..0b525a60 --- /dev/null +++ b/src/main/java/org/pgpainless/pgpainless/key/generation/type/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Classes describing different OpenPGP key types. + */ +package org.pgpainless.pgpainless.key.generation.type; diff --git a/src/main/java/org/pgpainless/pgpainless/key/package-info.java b/src/main/java/org/pgpainless/pgpainless/key/package-info.java new file mode 100644 index 00000000..6e18c27a --- /dev/null +++ b/src/main/java/org/pgpainless/pgpainless/key/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Classes related to OpenPGP keys. + */ +package org.pgpainless.pgpainless.key; diff --git a/src/main/java/org/pgpainless/pgpainless/key/selection/key/impl/SignedByMasterKey.java b/src/main/java/org/pgpainless/pgpainless/key/selection/key/impl/SignedByMasterKey.java index 81585013..73a6bd37 100644 --- a/src/main/java/org/pgpainless/pgpainless/key/selection/key/impl/SignedByMasterKey.java +++ b/src/main/java/org/pgpainless/pgpainless/key/selection/key/impl/SignedByMasterKey.java @@ -1,3 +1,18 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.pgpainless.pgpainless.key.selection.key.impl; import java.util.Iterator; diff --git a/src/main/java/org/pgpainless/pgpainless/key/selection/key/impl/package-info.java b/src/main/java/org/pgpainless/pgpainless/key/selection/key/impl/package-info.java new file mode 100644 index 00000000..c43ce212 --- /dev/null +++ b/src/main/java/org/pgpainless/pgpainless/key/selection/key/impl/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Implementations of Key Selection Strategies. + */ +package org.pgpainless.pgpainless.key.selection.key.impl; diff --git a/src/main/java/org/pgpainless/pgpainless/key/selection/key/package-info.java b/src/main/java/org/pgpainless/pgpainless/key/selection/key/package-info.java new file mode 100644 index 00000000..ba523866 --- /dev/null +++ b/src/main/java/org/pgpainless/pgpainless/key/selection/key/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Different Key Selection Strategies. + */ +package org.pgpainless.pgpainless.key.selection.key; diff --git a/src/main/java/org/pgpainless/pgpainless/key/selection/keyring/impl/Whitelist.java b/src/main/java/org/pgpainless/pgpainless/key/selection/keyring/impl/Whitelist.java index 26b09196..2c994dd5 100644 --- a/src/main/java/org/pgpainless/pgpainless/key/selection/keyring/impl/Whitelist.java +++ b/src/main/java/org/pgpainless/pgpainless/key/selection/keyring/impl/Whitelist.java @@ -74,4 +74,4 @@ public class Whitelist { } } -} \ No newline at end of file +} diff --git a/src/main/java/org/pgpainless/pgpainless/key/selection/keyring/impl/package-info.java b/src/main/java/org/pgpainless/pgpainless/key/selection/keyring/impl/package-info.java new file mode 100644 index 00000000..8e4ce3f0 --- /dev/null +++ b/src/main/java/org/pgpainless/pgpainless/key/selection/keyring/impl/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Implementations of Key Ring Selection Strategies. + */ +package org.pgpainless.pgpainless.key.selection.keyring.impl; diff --git a/src/main/java/org/pgpainless/pgpainless/key/selection/keyring/package-info.java b/src/main/java/org/pgpainless/pgpainless/key/selection/keyring/package-info.java new file mode 100644 index 00000000..756d0037 --- /dev/null +++ b/src/main/java/org/pgpainless/pgpainless/key/selection/keyring/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Different Key Ring Selection Strategies. + */ +package org.pgpainless.pgpainless.key.selection.keyring; diff --git a/src/main/java/org/pgpainless/pgpainless/package-info.java b/src/main/java/org/pgpainless/pgpainless/package-info.java new file mode 100644 index 00000000..562f50f8 --- /dev/null +++ b/src/main/java/org/pgpainless/pgpainless/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * PGPainless - Use OpenPGP Painlessly! + * + * @see pgpainless.org + */ +package org.pgpainless.pgpainless; diff --git a/src/main/java/org/pgpainless/pgpainless/symmetric_encryption/SymmetricEncryptorDecryptor.java b/src/main/java/org/pgpainless/pgpainless/symmetric_encryption/SymmetricEncryptorDecryptor.java index ce34ac5d..5d6d03ff 100644 --- a/src/main/java/org/pgpainless/pgpainless/symmetric_encryption/SymmetricEncryptorDecryptor.java +++ b/src/main/java/org/pgpainless/pgpainless/symmetric_encryption/SymmetricEncryptorDecryptor.java @@ -155,8 +155,7 @@ public class SymmetricEncryptorDecryptor { * @return compressed data * @throws IOException IO is dangerous */ - private static byte[] compress(byte[] clearData, int algorithm) throws IOException - { + private static byte[] compress(byte[] clearData, int algorithm) throws IOException { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); PGPCompressedDataGenerator comData = new PGPCompressedDataGenerator(algorithm); OutputStream cos = comData.open(bOut); diff --git a/src/main/java/org/pgpainless/pgpainless/symmetric_encryption/package-info.java b/src/main/java/org/pgpainless/pgpainless/symmetric_encryption/package-info.java new file mode 100644 index 00000000..7992d53c --- /dev/null +++ b/src/main/java/org/pgpainless/pgpainless/symmetric_encryption/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Classes related to OpenPGP symmetric encryption. + */ +package org.pgpainless.pgpainless.symmetric_encryption; diff --git a/src/main/java/org/pgpainless/pgpainless/util/BCUtil.java b/src/main/java/org/pgpainless/pgpainless/util/BCUtil.java index f396e5c7..9ac6fd6b 100644 --- a/src/main/java/org/pgpainless/pgpainless/util/BCUtil.java +++ b/src/main/java/org/pgpainless/pgpainless/util/BCUtil.java @@ -262,4 +262,4 @@ public class BCUtil { public static boolean keyRingContainsKeyWithId(PGPSecretKeyRing ring, long keyId) { return ring.getSecretKey(keyId) != null; } -} \ No newline at end of file +} diff --git a/src/main/java/org/pgpainless/pgpainless/util/MultiMap.java b/src/main/java/org/pgpainless/pgpainless/util/MultiMap.java index e6134f4a..83df5803 100644 --- a/src/main/java/org/pgpainless/pgpainless/util/MultiMap.java +++ b/src/main/java/org/pgpainless/pgpainless/util/MultiMap.java @@ -64,7 +64,11 @@ public class MultiMap { } public void put(K k, V v) { - Set values = map.computeIfAbsent(k, k1 -> new HashSet<>()); + Set values = map.get(k); + if (values == null) { + values = new HashSet<>(); + map.put(k, values); + } values.add(v); } diff --git a/src/main/java/org/pgpainless/pgpainless/util/package-info.java b/src/main/java/org/pgpainless/pgpainless/util/package-info.java new file mode 100644 index 00000000..cada7f7f --- /dev/null +++ b/src/main/java/org/pgpainless/pgpainless/util/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Utility classes. + */ +package org.pgpainless.pgpainless.util; diff --git a/src/test/java/org/pgpainless/pgpainless/LengthTest.java b/src/test/java/org/pgpainless/pgpainless/LengthTest.java index 47d64a91..8592c15c 100644 --- a/src/test/java/org/pgpainless/pgpainless/LengthTest.java +++ b/src/test/java/org/pgpainless/pgpainless/LengthTest.java @@ -43,7 +43,7 @@ public class LengthTest extends AbstractPGPainlessTest { private static final Logger LOGGER = Logger.getLogger(LengthTest.class.getName()); - //@Test + // @Test public void ecEc() throws PGPException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, IOException { @@ -54,7 +54,7 @@ public class LengthTest extends AbstractPGPainlessTest { } - //@Test + // @Test public void RsaRsa() throws PGPException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, IOException { @@ -64,7 +64,7 @@ public class LengthTest extends AbstractPGPainlessTest { encryptDecryptForSecretKeyRings(sender, recipient); } - //@Test + // @Test public void RsaRsa4096() throws PGPException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, IOException { @@ -74,7 +74,7 @@ public class LengthTest extends AbstractPGPainlessTest { encryptDecryptForSecretKeyRings(sender, recipient); } - //@Test + // @Test public void rsaEc() throws PGPException, IOException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException { LOGGER.log(Level.INFO, "\nRSA-2048 -> EC"); @@ -83,7 +83,7 @@ public class LengthTest extends AbstractPGPainlessTest { encryptDecryptForSecretKeyRings(sender, recipient); } - //@Test + // @Test public void ecRsa() throws PGPException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, IOException { @@ -111,7 +111,7 @@ public class LengthTest extends AbstractPGPainlessTest { OutputStream encryptor = PGPainless.createEncryptor() .onOutputStream(envelope) .toRecipients(recipientPub) - //.doNotEncrypt() + // .doNotEncrypt() .usingSecureAlgorithms() .signWith(keyDecryptor, sender) .noArmor(); diff --git a/src/test/java/org/pgpainless/pgpainless/SymmetricTest.java b/src/test/java/org/pgpainless/pgpainless/SymmetricTest.java index 9d7c3a99..50f67c67 100644 --- a/src/test/java/org/pgpainless/pgpainless/SymmetricTest.java +++ b/src/test/java/org/pgpainless/pgpainless/SymmetricTest.java @@ -20,6 +20,8 @@ import static junit.framework.TestCase.assertTrue; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; +import java.util.logging.Level; +import java.util.logging.Logger; import org.bouncycastle.bcpg.ArmoredOutputStream; import org.bouncycastle.openpgp.PGPException; @@ -28,6 +30,8 @@ import org.pgpainless.pgpainless.algorithm.SymmetricKeyAlgorithm; public class SymmetricTest extends AbstractPGPainlessTest { + private static final Logger LOGGER = Logger.getLogger(SymmetricTest.class.getName()); + private static final String message = "I grew up with the understanding that the world " + "I lived in was one where people enjoyed a sort of freedom " + "to communicate with each other in privacy, without it " + @@ -49,7 +53,7 @@ public class SymmetricTest extends AbstractPGPainlessTest { armor.close(); // Print cipher text for validation with GnuPG. - System.out.println(new String(out.toByteArray())); + LOGGER.log(Level.INFO, new String(out.toByteArray())); byte[] plain2 = PGPainless.decryptWithPassword(enc, "choose_a_better_password_please".toCharArray()); assertTrue(Arrays.equals(plain, plain2));