use buffers for encryption, so large files work as well... also showing encryption progress with better accuracy, which is especially useful for large encryptions

Fixes issue 18.
This commit is contained in:
Thialfihar
2010-05-04 14:07:18 +00:00
parent 778f51dbaa
commit e542c37eb3
5 changed files with 41 additions and 43 deletions

View File

@@ -193,12 +193,12 @@ public class EncryptMessageActivity extends BaseActivity {
message = message.replaceFirst("\n*$", "\n");
}
ByteArrayInputStream in =
new ByteArrayInputStream(Strings.toUTF8ByteArray(message));
byte[] byteData = Strings.toUTF8ByteArray(message);
ByteArrayInputStream in = new ByteArrayInputStream(byteData);
ByteArrayOutputStream out = new ByteArrayOutputStream();
if (encryptIt) {
Apg.encrypt(in, out, true, mEncryptionKeyIds, getSecretKeyId(),
Apg.encrypt(in, out, byteData.length, true, mEncryptionKeyIds, getSecretKeyId(),
Apg.getPassPhrase(), this,
getDefaultEncryptionAlgorithm(), getDefaultHashAlgorithm(),
null);