mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-25 08:28:50 -05:00
Merge pull request #601 from thi/rename-builder-methods
Rename builder methods
This commit is contained in:
commit
e0a0bf04ee
@ -118,18 +118,18 @@ public class PgpDecryptVerify {
|
|||||||
this.mOutStream = outStream;
|
this.mOutStream = outStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder progressable(Progressable progressable) {
|
public Builder setProgressable(Progressable progressable) {
|
||||||
this.mProgressable = progressable;
|
mProgressable = progressable;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder allowSymmetricDecryption(boolean allowSymmetricDecryption) {
|
public Builder setAllowSymmetricDecryption(boolean allowSymmetricDecryption) {
|
||||||
this.mAllowSymmetricDecryption = allowSymmetricDecryption;
|
mAllowSymmetricDecryption = allowSymmetricDecryption;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder passphrase(String passphrase) {
|
public Builder setPassphrase(String passphrase) {
|
||||||
this.mPassphrase = passphrase;
|
mPassphrase = passphrase;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ public class PgpDecryptVerify {
|
|||||||
* @param allowedKeyIds
|
* @param allowedKeyIds
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Builder allowedKeyIds(Set<Long> allowedKeyIds) {
|
public Builder setAllowedKeyIds(Set<Long> allowedKeyIds) {
|
||||||
this.mAllowedKeyIds = allowedKeyIds;
|
this.mAllowedKeyIds = allowedKeyIds;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -141,53 +141,53 @@ public class PgpSignEncrypt {
|
|||||||
this.mOutStream = outStream;
|
this.mOutStream = outStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder progressable(Progressable progressable) {
|
public Builder setProgressable(Progressable progressable) {
|
||||||
this.mProgressable = progressable;
|
mProgressable = progressable;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder enableAsciiArmorOutput(boolean enableAsciiArmorOutput) {
|
public Builder setEnableAsciiArmorOutput(boolean enableAsciiArmorOutput) {
|
||||||
this.mEnableAsciiArmorOutput = enableAsciiArmorOutput;
|
mEnableAsciiArmorOutput = enableAsciiArmorOutput;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder compressionId(int compressionId) {
|
public Builder setCompressionId(int compressionId) {
|
||||||
this.mCompressionId = compressionId;
|
mCompressionId = compressionId;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder encryptionMasterKeyIds(long[] encryptionMasterKeyIds) {
|
public Builder setEncryptionMasterKeyIds(long[] encryptionMasterKeyIds) {
|
||||||
this.mEncryptionMasterKeyIds = encryptionMasterKeyIds;
|
this.mEncryptionMasterKeyIds = encryptionMasterKeyIds;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder symmetricPassphrase(String symmetricPassphrase) {
|
public Builder setSymmetricPassphrase(String symmetricPassphrase) {
|
||||||
this.mSymmetricPassphrase = symmetricPassphrase;
|
this.mSymmetricPassphrase = symmetricPassphrase;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder symmetricEncryptionAlgorithm(int symmetricEncryptionAlgorithm) {
|
public Builder setSymmetricEncryptionAlgorithm(int symmetricEncryptionAlgorithm) {
|
||||||
this.mSymmetricEncryptionAlgorithm = symmetricEncryptionAlgorithm;
|
mSymmetricEncryptionAlgorithm = symmetricEncryptionAlgorithm;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder signatureMasterKeyId(long signatureMasterKeyId) {
|
public Builder setSignatureMasterKeyId(long signatureMasterKeyId) {
|
||||||
this.mSignatureMasterKeyId = signatureMasterKeyId;
|
this.mSignatureMasterKeyId = signatureMasterKeyId;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder signatureHashAlgorithm(int signatureHashAlgorithm) {
|
public Builder setSignatureHashAlgorithm(int signatureHashAlgorithm) {
|
||||||
this.mSignatureHashAlgorithm = signatureHashAlgorithm;
|
mSignatureHashAlgorithm = signatureHashAlgorithm;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder signatureForceV3(boolean signatureForceV3) {
|
public Builder setSignatureForceV3(boolean signatureForceV3) {
|
||||||
this.mSignatureForceV3 = signatureForceV3;
|
mSignatureForceV3 = signatureForceV3;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder signaturePassphrase(String signaturePassphrase) {
|
public Builder setSignaturePassphrase(String signaturePassphrase) {
|
||||||
this.mSignaturePassphrase = signaturePassphrase;
|
mSignaturePassphrase = signaturePassphrase;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ public class PgpSignEncrypt {
|
|||||||
* @param encryptToSigner
|
* @param encryptToSigner
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Builder encryptToSigner(boolean encryptToSigner) {
|
public Builder setEncryptToSigner(boolean encryptToSigner) {
|
||||||
this.mEncryptToSigner = encryptToSigner;
|
this.mEncryptToSigner = encryptToSigner;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ public class PgpSignEncrypt {
|
|||||||
* @param cleartextInput
|
* @param cleartextInput
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Builder cleartextInput(boolean cleartextInput) {
|
public Builder setCleartextInput(boolean cleartextInput) {
|
||||||
this.mCleartextInput = cleartextInput;
|
this.mCleartextInput = cleartextInput;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -170,14 +170,14 @@ public class OpenPgpService extends RemoteService {
|
|||||||
new ProviderHelper(getContext()),
|
new ProviderHelper(getContext()),
|
||||||
PgpHelper.getFullVersion(getContext()),
|
PgpHelper.getFullVersion(getContext()),
|
||||||
inputData, os);
|
inputData, os);
|
||||||
builder.enableAsciiArmorOutput(asciiArmor)
|
builder.setEnableAsciiArmorOutput(asciiArmor)
|
||||||
.signatureHashAlgorithm(accSettings.getHashAlgorithm())
|
.setSignatureHashAlgorithm(accSettings.getHashAlgorithm())
|
||||||
.signatureForceV3(false)
|
.setSignatureForceV3(false)
|
||||||
.signatureMasterKeyId(accSettings.getKeyId())
|
.setSignatureMasterKeyId(accSettings.getKeyId())
|
||||||
.signaturePassphrase(passphrase);
|
.setSignaturePassphrase(passphrase);
|
||||||
|
|
||||||
// TODO: currently always assume cleartext input, no sign-only of binary currently!
|
// TODO: currently always assume cleartext input, no sign-only of binary currently!
|
||||||
builder.cleartextInput(true);
|
builder.setCleartextInput(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
builder.build().execute();
|
builder.build().execute();
|
||||||
@ -254,10 +254,10 @@ public class OpenPgpService extends RemoteService {
|
|||||||
new ProviderHelper(getContext()),
|
new ProviderHelper(getContext()),
|
||||||
PgpHelper.getFullVersion(getContext()),
|
PgpHelper.getFullVersion(getContext()),
|
||||||
inputData, os);
|
inputData, os);
|
||||||
builder.enableAsciiArmorOutput(asciiArmor)
|
builder.setEnableAsciiArmorOutput(asciiArmor)
|
||||||
.compressionId(accSettings.getCompression())
|
.setCompressionId(accSettings.getCompression())
|
||||||
.symmetricEncryptionAlgorithm(accSettings.getEncryptionAlgorithm())
|
.setSymmetricEncryptionAlgorithm(accSettings.getEncryptionAlgorithm())
|
||||||
.encryptionMasterKeyIds(keyIds);
|
.setEncryptionMasterKeyIds(keyIds);
|
||||||
|
|
||||||
if (sign) {
|
if (sign) {
|
||||||
String passphrase;
|
String passphrase;
|
||||||
@ -274,13 +274,13 @@ public class OpenPgpService extends RemoteService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sign and encrypt
|
// sign and encrypt
|
||||||
builder.signatureHashAlgorithm(accSettings.getHashAlgorithm())
|
builder.setSignatureHashAlgorithm(accSettings.getHashAlgorithm())
|
||||||
.signatureForceV3(false)
|
.setSignatureForceV3(false)
|
||||||
.signatureMasterKeyId(accSettings.getKeyId())
|
.setSignatureMasterKeyId(accSettings.getKeyId())
|
||||||
.signaturePassphrase(passphrase);
|
.setSignaturePassphrase(passphrase);
|
||||||
} else {
|
} else {
|
||||||
// encrypt only
|
// encrypt only
|
||||||
builder.signatureMasterKeyId(Constants.key.none);
|
builder.setSignatureMasterKeyId(Constants.key.none);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -337,10 +337,10 @@ public class OpenPgpService extends RemoteService {
|
|||||||
},
|
},
|
||||||
inputData, os
|
inputData, os
|
||||||
);
|
);
|
||||||
builder.allowSymmetricDecryption(false) // no support for symmetric encryption
|
builder.setAllowSymmetricDecryption(false) // no support for symmetric encryption
|
||||||
.allowedKeyIds(allowedKeyIds) // allow only private keys associated with
|
.setAllowedKeyIds(allowedKeyIds) // allow only private keys associated with
|
||||||
// accounts of this app
|
// accounts of this app
|
||||||
.passphrase(passphrase);
|
.setPassphrase(passphrase);
|
||||||
|
|
||||||
PgpDecryptVerifyResult decryptVerifyResult;
|
PgpDecryptVerifyResult decryptVerifyResult;
|
||||||
try {
|
try {
|
||||||
|
@ -313,24 +313,24 @@ public class KeychainIntentService extends IntentService
|
|||||||
new ProviderHelper(this),
|
new ProviderHelper(this),
|
||||||
PgpHelper.getFullVersion(this),
|
PgpHelper.getFullVersion(this),
|
||||||
inputData, outStream);
|
inputData, outStream);
|
||||||
builder.progressable(this);
|
builder.setProgressable(this);
|
||||||
|
|
||||||
builder.enableAsciiArmorOutput(useAsciiArmor)
|
builder.setEnableAsciiArmorOutput(useAsciiArmor)
|
||||||
.compressionId(compressionId)
|
.setCompressionId(compressionId)
|
||||||
.symmetricEncryptionAlgorithm(
|
.setSymmetricEncryptionAlgorithm(
|
||||||
Preferences.getPreferences(this).getDefaultEncryptionAlgorithm())
|
Preferences.getPreferences(this).getDefaultEncryptionAlgorithm())
|
||||||
.signatureForceV3(Preferences.getPreferences(this).getForceV3Signatures())
|
.setSignatureForceV3(Preferences.getPreferences(this).getForceV3Signatures())
|
||||||
.encryptionMasterKeyIds(encryptionKeyIds)
|
.setEncryptionMasterKeyIds(encryptionKeyIds)
|
||||||
.symmetricPassphrase(symmetricPassphrase)
|
.setSymmetricPassphrase(symmetricPassphrase)
|
||||||
.signatureMasterKeyId(signatureKeyId)
|
.setSignatureMasterKeyId(signatureKeyId)
|
||||||
.signatureHashAlgorithm(
|
.setSignatureHashAlgorithm(
|
||||||
Preferences.getPreferences(this).getDefaultHashAlgorithm())
|
Preferences.getPreferences(this).getDefaultHashAlgorithm())
|
||||||
.signaturePassphrase(
|
.setSignaturePassphrase(
|
||||||
PassphraseCacheService.getCachedPassphrase(this, signatureKeyId));
|
PassphraseCacheService.getCachedPassphrase(this, signatureKeyId));
|
||||||
|
|
||||||
// this assumes that the bytes are cleartext (valid for current implementation!)
|
// this assumes that the bytes are cleartext (valid for current implementation!)
|
||||||
if (target == TARGET_BYTES) {
|
if (target == TARGET_BYTES) {
|
||||||
builder.cleartextInput(true);
|
builder.setCleartextInput(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.build().execute();
|
builder.build().execute();
|
||||||
@ -457,10 +457,10 @@ public class KeychainIntentService extends IntentService
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
inputData, outStream);
|
inputData, outStream);
|
||||||
builder.progressable(this);
|
builder.setProgressable(this);
|
||||||
|
|
||||||
builder.allowSymmetricDecryption(true)
|
builder.setAllowSymmetricDecryption(true)
|
||||||
.passphrase(passphrase);
|
.setPassphrase(passphrase);
|
||||||
|
|
||||||
PgpDecryptVerifyResult decryptVerifyResult = builder.build().execute();
|
PgpDecryptVerifyResult decryptVerifyResult = builder.build().execute();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user