internal renaming, cleanup

This commit is contained in:
Dominik Schürmann
2014-02-21 02:40:44 +01:00
parent aaddd26b51
commit fb0816c126
5 changed files with 50 additions and 36 deletions

View File

@@ -70,7 +70,7 @@ import java.util.Iterator;
/**
* This class uses a Builder pattern!
*/
public class PgpOperationIncoming {
public class PgpDecryptVerify {
private Context context;
private InputData data;
private OutputStream outStream;
@@ -79,7 +79,7 @@ public class PgpOperationIncoming {
boolean assumeSymmetric;
String passphrase;
private PgpOperationIncoming(Builder builder) {
private PgpDecryptVerify(Builder builder) {
// private Constructor can only be called from Builder
this.context = builder.context;
this.data = builder.data;
@@ -122,8 +122,8 @@ public class PgpOperationIncoming {
return this;
}
public PgpOperationIncoming build() {
return new PgpOperationIncoming(this);
public PgpDecryptVerify build() {
return new PgpDecryptVerify(this);
}
}
@@ -177,9 +177,8 @@ public class PgpOperationIncoming {
* @throws PGPException
* @throws SignatureException
*/
public Bundle decryptVerify()
public Bundle execute()
throws IOException, PgpGeneralException, PGPException, SignatureException {
Bundle returnData = new Bundle();
// automatically works with ascii armor input and binary
InputStream in = PGPUtil.getDecoderStream(data.getInputStream());
@@ -191,14 +190,30 @@ public class PgpOperationIncoming {
if (aIn.isClearText()) {
// a cleartext signature, verify it with the other method
return verifyCleartextSignature(aIn);
} else {
// go on...
}
// else: ascii armored encryption! go on...
}
return decryptVerify(in);
}
/**
* Decrypt and/or verifies binary or ascii armored pgp
*
* @param in
* @return
* @throws IOException
* @throws PgpGeneralException
* @throws PGPException
* @throws SignatureException
*/
private Bundle decryptVerify(InputStream in)
throws IOException, PgpGeneralException, PGPException, SignatureException {
Bundle returnData = new Bundle();
PGPObjectFactory pgpF = new PGPObjectFactory(in);
PGPEncryptedDataList enc;
Object o = pgpF.nextObject();
Log.d(Constants.TAG, "o: " + o.getClass().getName());
int currentProgress = 0;
updateProgress(R.string.progress_reading_data, currentProgress, 100);

View File

@@ -62,7 +62,7 @@ import java.util.Date;
/**
* This class uses a Builder pattern!
*/
public class PgpOperationOutgoing {
public class PgpSignEncrypt {
private Context context;
private InputData data;
private OutputStream outStream;
@@ -78,7 +78,7 @@ public class PgpOperationOutgoing {
private boolean signatureForceV3;
private String signaturePassphrase;
private PgpOperationOutgoing(Builder builder) {
private PgpSignEncrypt(Builder builder) {
// private Constructor can only be called from Builder
this.context = builder.context;
this.data = builder.data;
@@ -170,8 +170,8 @@ public class PgpOperationOutgoing {
return this;
}
public PgpOperationOutgoing build() {
return new PgpOperationOutgoing(this);
public PgpSignEncrypt build() {
return new PgpSignEncrypt(this);
}
}
@@ -197,7 +197,7 @@ public class PgpOperationOutgoing {
* @throws NoSuchAlgorithmException
* @throws SignatureException
*/
public void signEncrypt()
public void execute()
throws IOException, PgpGeneralException, PGPException, NoSuchProviderException,
NoSuchAlgorithmException, SignatureException {
@@ -442,7 +442,7 @@ public class PgpOperationOutgoing {
updateProgress(R.string.progress_done, 100, 100);
}
// TODO: merge this into signEncrypt method!
// TODO: merge this into execute method!
// TODO: allow binary input for this class
public void generateSignature()
throws PgpGeneralException, PGPException, IOException, NoSuchAlgorithmException,