Merge pull request #601 from thi/rename-builder-methods

Rename builder methods
This commit is contained in:
Dominik Schürmann 2014-04-29 19:51:21 +02:00
commit e0a0bf04ee
4 changed files with 58 additions and 58 deletions

View file

@ -118,18 +118,18 @@ public class PgpDecryptVerify {
this.mOutStream = outStream;
}
public Builder progressable(Progressable progressable) {
this.mProgressable = progressable;
public Builder setProgressable(Progressable progressable) {
mProgressable = progressable;
return this;
}
public Builder allowSymmetricDecryption(boolean allowSymmetricDecryption) {
this.mAllowSymmetricDecryption = allowSymmetricDecryption;
public Builder setAllowSymmetricDecryption(boolean allowSymmetricDecryption) {
mAllowSymmetricDecryption = allowSymmetricDecryption;
return this;
}
public Builder passphrase(String passphrase) {
this.mPassphrase = passphrase;
public Builder setPassphrase(String passphrase) {
mPassphrase = passphrase;
return this;
}
@ -140,7 +140,7 @@ public class PgpDecryptVerify {
* @param allowedKeyIds
* @return
*/
public Builder allowedKeyIds(Set<Long> allowedKeyIds) {
public Builder setAllowedKeyIds(Set<Long> allowedKeyIds) {
this.mAllowedKeyIds = allowedKeyIds;
return this;
}

View file

@ -141,53 +141,53 @@ public class PgpSignEncrypt {
this.mOutStream = outStream;
}
public Builder progressable(Progressable progressable) {
this.mProgressable = progressable;
public Builder setProgressable(Progressable progressable) {
mProgressable = progressable;
return this;
}
public Builder enableAsciiArmorOutput(boolean enableAsciiArmorOutput) {
this.mEnableAsciiArmorOutput = enableAsciiArmorOutput;
public Builder setEnableAsciiArmorOutput(boolean enableAsciiArmorOutput) {
mEnableAsciiArmorOutput = enableAsciiArmorOutput;
return this;
}
public Builder compressionId(int compressionId) {
this.mCompressionId = compressionId;
public Builder setCompressionId(int compressionId) {
mCompressionId = compressionId;
return this;
}
public Builder encryptionMasterKeyIds(long[] encryptionMasterKeyIds) {
public Builder setEncryptionMasterKeyIds(long[] encryptionMasterKeyIds) {
this.mEncryptionMasterKeyIds = encryptionMasterKeyIds;
return this;
}
public Builder symmetricPassphrase(String symmetricPassphrase) {
public Builder setSymmetricPassphrase(String symmetricPassphrase) {
this.mSymmetricPassphrase = symmetricPassphrase;
return this;
}
public Builder symmetricEncryptionAlgorithm(int symmetricEncryptionAlgorithm) {
this.mSymmetricEncryptionAlgorithm = symmetricEncryptionAlgorithm;
public Builder setSymmetricEncryptionAlgorithm(int symmetricEncryptionAlgorithm) {
mSymmetricEncryptionAlgorithm = symmetricEncryptionAlgorithm;
return this;
}
public Builder signatureMasterKeyId(long signatureMasterKeyId) {
public Builder setSignatureMasterKeyId(long signatureMasterKeyId) {
this.mSignatureMasterKeyId = signatureMasterKeyId;
return this;
}
public Builder signatureHashAlgorithm(int signatureHashAlgorithm) {
this.mSignatureHashAlgorithm = signatureHashAlgorithm;
public Builder setSignatureHashAlgorithm(int signatureHashAlgorithm) {
mSignatureHashAlgorithm = signatureHashAlgorithm;
return this;
}
public Builder signatureForceV3(boolean signatureForceV3) {
this.mSignatureForceV3 = signatureForceV3;
public Builder setSignatureForceV3(boolean signatureForceV3) {
mSignatureForceV3 = signatureForceV3;
return this;
}
public Builder signaturePassphrase(String signaturePassphrase) {
this.mSignaturePassphrase = signaturePassphrase;
public Builder setSignaturePassphrase(String signaturePassphrase) {
mSignaturePassphrase = signaturePassphrase;
return this;
}
@ -197,7 +197,7 @@ public class PgpSignEncrypt {
* @param encryptToSigner
* @return
*/
public Builder encryptToSigner(boolean encryptToSigner) {
public Builder setEncryptToSigner(boolean encryptToSigner) {
this.mEncryptToSigner = encryptToSigner;
return this;
}
@ -208,7 +208,7 @@ public class PgpSignEncrypt {
* @param cleartextInput
* @return
*/
public Builder cleartextInput(boolean cleartextInput) {
public Builder setCleartextInput(boolean cleartextInput) {
this.mCleartextInput = cleartextInput;
return this;
}

View file

@ -170,14 +170,14 @@ public class OpenPgpService extends RemoteService {
new ProviderHelper(getContext()),
PgpHelper.getFullVersion(getContext()),
inputData, os);
builder.enableAsciiArmorOutput(asciiArmor)
.signatureHashAlgorithm(accSettings.getHashAlgorithm())
.signatureForceV3(false)
.signatureMasterKeyId(accSettings.getKeyId())
.signaturePassphrase(passphrase);
builder.setEnableAsciiArmorOutput(asciiArmor)
.setSignatureHashAlgorithm(accSettings.getHashAlgorithm())
.setSignatureForceV3(false)
.setSignatureMasterKeyId(accSettings.getKeyId())
.setSignaturePassphrase(passphrase);
// TODO: currently always assume cleartext input, no sign-only of binary currently!
builder.cleartextInput(true);
builder.setCleartextInput(true);
try {
builder.build().execute();
@ -254,10 +254,10 @@ public class OpenPgpService extends RemoteService {
new ProviderHelper(getContext()),
PgpHelper.getFullVersion(getContext()),
inputData, os);
builder.enableAsciiArmorOutput(asciiArmor)
.compressionId(accSettings.getCompression())
.symmetricEncryptionAlgorithm(accSettings.getEncryptionAlgorithm())
.encryptionMasterKeyIds(keyIds);
builder.setEnableAsciiArmorOutput(asciiArmor)
.setCompressionId(accSettings.getCompression())
.setSymmetricEncryptionAlgorithm(accSettings.getEncryptionAlgorithm())
.setEncryptionMasterKeyIds(keyIds);
if (sign) {
String passphrase;
@ -274,13 +274,13 @@ public class OpenPgpService extends RemoteService {
}
// sign and encrypt
builder.signatureHashAlgorithm(accSettings.getHashAlgorithm())
.signatureForceV3(false)
.signatureMasterKeyId(accSettings.getKeyId())
.signaturePassphrase(passphrase);
builder.setSignatureHashAlgorithm(accSettings.getHashAlgorithm())
.setSignatureForceV3(false)
.setSignatureMasterKeyId(accSettings.getKeyId())
.setSignaturePassphrase(passphrase);
} else {
// encrypt only
builder.signatureMasterKeyId(Constants.key.none);
builder.setSignatureMasterKeyId(Constants.key.none);
}
try {
@ -337,10 +337,10 @@ public class OpenPgpService extends RemoteService {
},
inputData, os
);
builder.allowSymmetricDecryption(false) // no support for symmetric encryption
.allowedKeyIds(allowedKeyIds) // allow only private keys associated with
builder.setAllowSymmetricDecryption(false) // no support for symmetric encryption
.setAllowedKeyIds(allowedKeyIds) // allow only private keys associated with
// accounts of this app
.passphrase(passphrase);
.setPassphrase(passphrase);
PgpDecryptVerifyResult decryptVerifyResult;
try {

View file

@ -313,24 +313,24 @@ public class KeychainIntentService extends IntentService
new ProviderHelper(this),
PgpHelper.getFullVersion(this),
inputData, outStream);
builder.progressable(this);
builder.setProgressable(this);
builder.enableAsciiArmorOutput(useAsciiArmor)
.compressionId(compressionId)
.symmetricEncryptionAlgorithm(
builder.setEnableAsciiArmorOutput(useAsciiArmor)
.setCompressionId(compressionId)
.setSymmetricEncryptionAlgorithm(
Preferences.getPreferences(this).getDefaultEncryptionAlgorithm())
.signatureForceV3(Preferences.getPreferences(this).getForceV3Signatures())
.encryptionMasterKeyIds(encryptionKeyIds)
.symmetricPassphrase(symmetricPassphrase)
.signatureMasterKeyId(signatureKeyId)
.signatureHashAlgorithm(
.setSignatureForceV3(Preferences.getPreferences(this).getForceV3Signatures())
.setEncryptionMasterKeyIds(encryptionKeyIds)
.setSymmetricPassphrase(symmetricPassphrase)
.setSignatureMasterKeyId(signatureKeyId)
.setSignatureHashAlgorithm(
Preferences.getPreferences(this).getDefaultHashAlgorithm())
.signaturePassphrase(
.setSignaturePassphrase(
PassphraseCacheService.getCachedPassphrase(this, signatureKeyId));
// this assumes that the bytes are cleartext (valid for current implementation!)
if (target == TARGET_BYTES) {
builder.cleartextInput(true);
builder.setCleartextInput(true);
}
builder.build().execute();
@ -457,10 +457,10 @@ public class KeychainIntentService extends IntentService
}
},
inputData, outStream);
builder.progressable(this);
builder.setProgressable(this);
builder.allowSymmetricDecryption(true)
.passphrase(passphrase);
builder.setAllowSymmetricDecryption(true)
.setPassphrase(passphrase);
PgpDecryptVerifyResult decryptVerifyResult = builder.build().execute();