mirror of https://github.com/apache/nifi.git
NIFI-1324:
- Addressing lengthy lines contrib-check issue. - This closes #162
This commit is contained in:
parent
ffbfffce6d
commit
44ffddd8b9
|
@ -97,7 +97,8 @@ public class OpenPGPKeyBasedEncryptor implements Encryptor {
|
|||
/**
|
||||
* Returns true if the passphrase is valid.
|
||||
* <p>
|
||||
* This is used in the EncryptContent custom validation to check if the passphrase can extract a private key from the secret key ring. After BC was upgraded from 1.46 to 1.53, the API changed so this is performed differently but the functionality is equivalent.
|
||||
* This is used in the EncryptContent custom validation to check if the passphrase can extract a private key from the secret key ring. After BC was upgraded from 1.46 to 1.53, the API changed
|
||||
* so this is performed differently but the functionality is equivalent.
|
||||
*
|
||||
* @param provider the provider name
|
||||
* @param secretKeyringFile the file path to the keyring
|
||||
|
|
|
@ -46,7 +46,9 @@ public class PGPUtil {
|
|||
public static final int BUFFER_SIZE = 65536;
|
||||
public static final int BLOCK_SIZE = 4096;
|
||||
|
||||
public static void encrypt(InputStream in, OutputStream out, String algorithm, String provider, int cipher, String filename, PGPKeyEncryptionMethodGenerator encryptionMethodGenerator) throws IOException, PGPException {
|
||||
public static void encrypt(InputStream in, OutputStream out, String algorithm, String provider, int cipher, String filename,
|
||||
PGPKeyEncryptionMethodGenerator encryptionMethodGenerator) throws IOException, PGPException {
|
||||
|
||||
final boolean isArmored = EncryptContent.isPGPArmoredAlgorithm(algorithm);
|
||||
OutputStream output = out;
|
||||
if (isArmored) {
|
||||
|
|
|
@ -79,10 +79,12 @@ public class OpenPGPKeyBasedEncryptorTest {
|
|||
String filename = "tempFile.txt";
|
||||
|
||||
// Encryptor does not require password
|
||||
OpenPGPKeyBasedEncryptor encryptor = new OpenPGPKeyBasedEncryptor(EncryptionMethod.PGP.getAlgorithm(), EncryptionMethod.PGP.getProvider(), PUBLIC_KEYRING_PATH, USER_ID, new char[0], filename);
|
||||
OpenPGPKeyBasedEncryptor encryptor = new OpenPGPKeyBasedEncryptor(
|
||||
EncryptionMethod.PGP.getAlgorithm(), EncryptionMethod.PGP.getProvider(), PUBLIC_KEYRING_PATH, USER_ID, new char[0], filename);
|
||||
StreamCallback encryptionCallback = encryptor.getEncryptionCallback();
|
||||
|
||||
OpenPGPKeyBasedEncryptor decryptor = new OpenPGPKeyBasedEncryptor(EncryptionMethod.PGP.getAlgorithm(), EncryptionMethod.PGP.getProvider(), SECRET_KEYRING_PATH, USER_ID, PASSWORD.toCharArray(), filename);
|
||||
OpenPGPKeyBasedEncryptor decryptor = new OpenPGPKeyBasedEncryptor(
|
||||
EncryptionMethod.PGP.getAlgorithm(), EncryptionMethod.PGP.getProvider(), SECRET_KEYRING_PATH, USER_ID, PASSWORD.toCharArray(), filename);
|
||||
StreamCallback decryptionCallback = decryptor.getDecryptionCallback();
|
||||
|
||||
// Act
|
||||
|
@ -113,7 +115,8 @@ public class OpenPGPKeyBasedEncryptorTest {
|
|||
// No file, just streams
|
||||
String filename = unsignedFile.getName();
|
||||
|
||||
OpenPGPKeyBasedEncryptor encryptor = new OpenPGPKeyBasedEncryptor(EncryptionMethod.PGP.getAlgorithm(), EncryptionMethod.PGP.getProvider(), SECRET_KEYRING_PATH, USER_ID, PASSWORD.toCharArray(), filename);
|
||||
OpenPGPKeyBasedEncryptor encryptor = new OpenPGPKeyBasedEncryptor(
|
||||
EncryptionMethod.PGP.getAlgorithm(), EncryptionMethod.PGP.getProvider(), SECRET_KEYRING_PATH, USER_ID, PASSWORD.toCharArray(), filename);
|
||||
|
||||
StreamCallback decryptionCallback = encryptor.getDecryptionCallback();
|
||||
|
||||
|
|
Loading…
Reference in New Issue