aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2016-02-23 14:55:23 +0100
committerVincent Breitmoser <valodim@mugenguild.com>2016-02-23 15:01:22 +0100
commit03e695c6509ee6ada0ad6a0a21181277ba298c34 (patch)
tree6b697636d7e065e4bf15e567059f200ff250419a /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java
parent8714a5eac42449dc3584a6bc14a7404c6a4686b5 (diff)
downloadopen-keychain-03e695c6509ee6ada0ad6a0a21181277ba298c34.tar.gz
open-keychain-03e695c6509ee6ada0ad6a0a21181277ba298c34.tar.bz2
open-keychain-03e695c6509ee6ada0ad6a0a21181277ba298c34.zip
ditch isLikelyText flag, set mimeType to text/plain in that case
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java18
1 files changed, 7 insertions, 11 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java
index b0d39d88f..e15139a7f 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java
@@ -417,7 +417,7 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp
metadata = new OpenPgpMetadata(
originalFilename, mimeType,
literalData.getModificationTime().getTime(),
- originalSize == null ? 0 : originalSize, charset, false);
+ originalSize == null ? 0 : originalSize, charset);
log.add(LogType.MSG_DC_OK_META_ONLY, indent);
DecryptVerifyResult result =
@@ -483,24 +483,20 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp
Log.d(Constants.TAG, "decrypt time taken: " + String.format("%.2f", opTime / 1000.0) + "s");
// special treatment to detect pgp mime types
+ // TODO move into CharsetVerifier? seems like that would be a plausible place for this logic
if (matchesPrefix(firstBytes, "-----BEGIN PGP PUBLIC KEY BLOCK-----")
|| matchesPrefix(firstBytes, "-----BEGIN PGP PRIVATE KEY BLOCK-----")) {
mimeType = Constants.MIME_TYPE_KEYS;
} else if (matchesPrefix(firstBytes, "-----BEGIN PGP MESSAGE-----")) {
// this is NOT application/pgp-encrypted, see RFC 3156!
mimeType = Constants.MIME_TYPE_ENCRYPTED_ALTERNATE;
- }
-
- log.add(LogType.MSG_DC_CLEAR_META_MIME, indent + 1, mimeType);
-
- if (charsetVerifier.isDefinitelyBinary()) {
- metadata = new OpenPgpMetadata(originalFilename, mimeType, literalData.getModificationTime().getTime(),
- alreadyWritten);
} else {
- metadata = new OpenPgpMetadata(originalFilename, mimeType, literalData.getModificationTime().getTime(),
- alreadyWritten, charsetVerifier.getCharset(), charsetVerifier.isProbablyText());
+ mimeType = charsetVerifier.getGuessedMimeType();
}
+ metadata = new OpenPgpMetadata(originalFilename, mimeType, literalData.getModificationTime().getTime(),
+ alreadyWritten, charsetVerifier.getCharset());
+ log.add(LogType.MSG_DC_CLEAR_META_MIME, indent + 1, mimeType);
Log.d(Constants.TAG, metadata.toString());
indent -= 1;
@@ -883,7 +879,7 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp
log.add(LogType.MSG_DC_OK, indent);
- OpenPgpMetadata metadata = new OpenPgpMetadata("", "text/plain", -1, clearText.length, "utf-8", true);
+ OpenPgpMetadata metadata = new OpenPgpMetadata("", "text/plain", -1, clearText.length, "utf-8");
DecryptVerifyResult result = new DecryptVerifyResult(DecryptVerifyResult.RESULT_OK, log);
result.setSignatureResult(signatureChecker.getSignatureResult());