mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
determine correct filesize during decryption from LiteralData packet
This commit is contained in:
parent
a468c667bb
commit
3efaac2175
@ -555,6 +555,7 @@ public abstract class OperationResult implements Parcelable {
|
|||||||
MSG_DC_CLEAR_META_FILE (LogLevel.DEBUG, R.string.msg_dc_clear_meta_file),
|
MSG_DC_CLEAR_META_FILE (LogLevel.DEBUG, R.string.msg_dc_clear_meta_file),
|
||||||
MSG_DC_CLEAR_META_MIME (LogLevel.DEBUG, R.string.msg_dc_clear_meta_mime),
|
MSG_DC_CLEAR_META_MIME (LogLevel.DEBUG, R.string.msg_dc_clear_meta_mime),
|
||||||
MSG_DC_CLEAR_META_SIZE (LogLevel.DEBUG, R.string.msg_dc_clear_meta_size),
|
MSG_DC_CLEAR_META_SIZE (LogLevel.DEBUG, R.string.msg_dc_clear_meta_size),
|
||||||
|
MSG_DC_CLEAR_META_SIZE_UNKNOWN (LogLevel.DEBUG, R.string.msg_dc_clear_meta_size_unknown),
|
||||||
MSG_DC_CLEAR_META_TIME (LogLevel.DEBUG, R.string.msg_dc_clear_meta_time),
|
MSG_DC_CLEAR_META_TIME (LogLevel.DEBUG, R.string.msg_dc_clear_meta_time),
|
||||||
MSG_DC_CLEAR (LogLevel.DEBUG, R.string.msg_dc_clear),
|
MSG_DC_CLEAR (LogLevel.DEBUG, R.string.msg_dc_clear),
|
||||||
MSG_DC_CLEAR_SIGNATURE_BAD (LogLevel.WARN, R.string.msg_dc_clear_signature_bad),
|
MSG_DC_CLEAR_SIGNATURE_BAD (LogLevel.WARN, R.string.msg_dc_clear_signature_bad),
|
||||||
|
@ -540,12 +540,8 @@ public class PgpDecryptVerify extends BaseOperation {
|
|||||||
|
|
||||||
PGPLiteralData literalData = (PGPLiteralData) dataChunk;
|
PGPLiteralData literalData = (PGPLiteralData) dataChunk;
|
||||||
|
|
||||||
// TODO: how to get the real original size?
|
|
||||||
// this is the encrypted size so if we enable compression this value is wrong!
|
// this is the encrypted size so if we enable compression this value is wrong!
|
||||||
long originalSize = mData.getSize() - mData.getStreamPosition();
|
Long originalSize = literalData.getDataLengthIfAvailable();
|
||||||
if (originalSize < 0) {
|
|
||||||
originalSize = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
String originalFilename = literalData.getFileName();
|
String originalFilename = literalData.getFileName();
|
||||||
String mimeType = null;
|
String mimeType = null;
|
||||||
@ -573,7 +569,7 @@ public class PgpDecryptVerify extends BaseOperation {
|
|||||||
originalFilename,
|
originalFilename,
|
||||||
mimeType,
|
mimeType,
|
||||||
literalData.getModificationTime().getTime(),
|
literalData.getModificationTime().getTime(),
|
||||||
originalSize);
|
originalSize == null ? 0 : originalSize);
|
||||||
|
|
||||||
if (!originalFilename.equals("")) {
|
if (!originalFilename.equals("")) {
|
||||||
log.add(LogType.MSG_DC_CLEAR_META_FILE, indent + 1, originalFilename);
|
log.add(LogType.MSG_DC_CLEAR_META_FILE, indent + 1, originalFilename);
|
||||||
@ -582,9 +578,11 @@ public class PgpDecryptVerify extends BaseOperation {
|
|||||||
mimeType);
|
mimeType);
|
||||||
log.add(LogType.MSG_DC_CLEAR_META_TIME, indent + 1,
|
log.add(LogType.MSG_DC_CLEAR_META_TIME, indent + 1,
|
||||||
new Date(literalData.getModificationTime().getTime()).toString());
|
new Date(literalData.getModificationTime().getTime()).toString());
|
||||||
if (originalSize != 0) {
|
if (originalSize != null) {
|
||||||
log.add(LogType.MSG_DC_CLEAR_META_SIZE, indent + 1,
|
log.add(LogType.MSG_DC_CLEAR_META_SIZE, indent + 1,
|
||||||
Long.toString(originalSize));
|
Long.toString(originalSize));
|
||||||
|
} else {
|
||||||
|
log.add(LogType.MSG_DC_CLEAR_META_SIZE_UNKNOWN, indent + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// return here if we want to decrypt the metadata only
|
// return here if we want to decrypt the metadata only
|
||||||
|
@ -935,6 +935,7 @@
|
|||||||
<string name="msg_dc_clear_meta_file">"Filename: %s"</string>
|
<string name="msg_dc_clear_meta_file">"Filename: %s"</string>
|
||||||
<string name="msg_dc_clear_meta_mime">"MIME type: %s"</string>
|
<string name="msg_dc_clear_meta_mime">"MIME type: %s"</string>
|
||||||
<string name="msg_dc_clear_meta_size">"Filesize: %s"</string>
|
<string name="msg_dc_clear_meta_size">"Filesize: %s"</string>
|
||||||
|
<string name="msg_dc_clear_meta_size_unknown">"Filesize is unknown"</string>
|
||||||
<string name="msg_dc_clear_meta_time">"Modification time: %s"</string>
|
<string name="msg_dc_clear_meta_time">"Modification time: %s"</string>
|
||||||
<string name="msg_dc_clear_signature_bad">"Signature check NOT OK!"</string>
|
<string name="msg_dc_clear_signature_bad">"Signature check NOT OK!"</string>
|
||||||
<string name="msg_dc_clear_signature_check">"Verifying signature data"</string>
|
<string name="msg_dc_clear_signature_check">"Verifying signature data"</string>
|
||||||
|
2
extern/spongycastle
vendored
2
extern/spongycastle
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 26c232f31b62404ecb5d3ae3d2c1730fd0a0a0eb
|
Subproject commit 939914d9ffd1e8cc2710de6c600c9ccfc86aa545
|
Loading…
Reference in New Issue
Block a user