1.0.x merged back into trunk

This commit is contained in:
Thialfihar 2010-08-15 17:32:08 +00:00
parent e6dc995126
commit bd99b2590b
8 changed files with 111 additions and 51 deletions

View File

@ -17,7 +17,7 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="org.thialfihar.android.apg"
android:versionCode="20" android:versionName="1.0.6">
android:versionCode="21" android:versionName="1.0.7">
<application
android:icon="@drawable/icon"

View File

@ -124,6 +124,9 @@
<string name="choice_3mins">3 min</string>
<string name="choice_5mins">5 min</string>
<string name="choice_10mins">10 min</string>
<string name="choice_20mins">20 min</string>
<string name="choice_40mins">40 min</string>
<string name="choice_60mins">60 min</string>
<string name="choice_untilQuit">Indtil slut</string>
<string name="dsa">DSA</string>

View File

@ -129,8 +129,10 @@
<string name="choice_1min">1 Min.</string>
<string name="choice_3mins">3 Min.</string>
<string name="choice_5mins">5 Min.</string>
<string name="choice_10mins">10 Min.</string>
<string name="choice_20mins">20 Min.</string>
<string name="choice_40mins">40 Min.</string>
<string name="choice_60mins">60 Min.</string>
<string name="choice_untilQuit">Bis Programmende</string>
<string name="dsa">DSA</string>

View File

@ -126,6 +126,9 @@
<string name="choice_3mins">3 min</string>
<string name="choice_5mins">5 min</string>
<string name="choice_10mins">10 min</string>
<string name="choice_20mins">20 min</string>
<string name="choice_40mins">40 min</string>
<string name="choice_60mins">60 min</string>
<string name="choice_untilQuit">tutta la sessione</string>
<string name="dsa">DSA</string>

View File

@ -135,6 +135,9 @@
<string name="choice_3mins">3 min</string>
<string name="choice_5mins">5 min</string>
<string name="choice_10mins">10 min</string>
<string name="choice_20mins">20 min</string>
<string name="choice_40mins">40 min</string>
<string name="choice_60mins">60 min</string>
<string name="choice_untilQuit">do izhoda</string>
<string name="choice_language_system">Sistemsko nastavljeno</string>
@ -270,9 +273,15 @@
<string name="filterInfo">Filter: \"%s\"</string>
<!-- misc -->
<<<<<<< HEAD
<string name="fast">hitro</string>
<string name="slow">počasi</string>
<string name="very_slow">zelo počasi</string>
=======
<string name="fast">hiter</string>
<string name="slow">počasen</string>
<string name="very_slow">zelo počasen</string>
>>>>>>> 1.0.x
<!-- texts -->
<!-- "OI File Manager", "ASTRO", and "K-9 Mail" must not be translated in order for the links to the market to work. -->
@ -280,7 +289,11 @@
\n\nZaželjeno je, da namestite programa OI File Manager ali ASTRO, ki omogočata iskanje, izbiro in vnos datotek v APG.
\n\nZa začetek potrebujete nekaj ključev. Lahko jih uvozite s klikom na menija \"Upravljanje javnih ključev\" in \"Upravljanje zasebnih ključev\" ali jih ustvarite v meniju \"Upravljanje zasebnih ključev\".
\n\nPreko menija \"Dodaj račun\" lahko dodate vaše GMail račune in tako poenostavite dešifriranje e-pošte prejete nanje.
<<<<<<< HEAD
\n\nDa bi odkrili dodatne funkcije in zmožnosti programa APG, se sprehodite skozi njegove menije.
=======
\n\Da bi odkrili dodatne funkcije in zmožnosti programa APG, se sprehodite skozi njegove menije.
>>>>>>> 1.0.x
</string>
</resources>

View File

@ -22,6 +22,9 @@
<item>@string/choice_3mins</item>
<item>@string/choice_5mins</item>
<item>@string/choice_10mins</item>
<item>@string/choice_20mins</item>
<item>@string/choice_40mins</item>
<item>@string/choice_60mins</item>
</string-array>
<string-array name="pass_phrase_cache_ttl_values">
@ -30,6 +33,9 @@
<item>180</item>
<item>300</item>
<item>600</item>
<item>1200</item>
<item>2400</item>
<item>3600</item>
</string-array>
<string-array name="language_entries">

View File

@ -133,6 +133,9 @@
<string name="choice_3mins">3 mins</string>
<string name="choice_5mins">5 mins</string>
<string name="choice_10mins">10 mins</string>
<string name="choice_20mins">20 mins</string>
<string name="choice_40mins">40 mins</string>
<string name="choice_60mins">60 mins</string>
<string name="choice_untilQuit">until quit</string>
<string name="choice_language_system">System default</string>

View File

@ -17,6 +17,7 @@
package org.thialfihar.android.apg;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.EOFException;
@ -24,6 +25,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.math.BigInteger;
@ -1336,35 +1338,33 @@ public class Apg {
armorOut.beginClearText(hashAlgorithm);
ByteArrayOutputStream lineOut = new ByteArrayOutputStream();
InputStream inStream = data.getInputStream();
int lookAhead = readInputLine(lineOut, inStream);
final BufferedReader reader = new BufferedReader(new InputStreamReader(inStream));
final byte[] newline = "\r\n".getBytes("UTF-8");
if (forceV3Signature) {
processLine(armorOut, signatureV3Generator, lineOut.toByteArray());
processLine(reader.readLine(), armorOut, signatureV3Generator);
} else {
processLine(armorOut, signatureGenerator, lineOut.toByteArray());
processLine(reader.readLine(), armorOut, signatureGenerator);
}
if (lookAhead != -1) {
do {
lookAhead = readInputLine(lineOut, lookAhead, inStream);
while (true) {
final String line = reader.readLine();
if (forceV3Signature) {
signatureV3Generator.update((byte)'\r');
signatureV3Generator.update((byte)'\n');
} else {
signatureGenerator.update((byte)'\r');
signatureGenerator.update((byte)'\n');
}
if (forceV3Signature) {
processLine(armorOut, signatureV3Generator, lineOut.toByteArray());
} else {
processLine(armorOut, signatureGenerator, lineOut.toByteArray());
}
if (line == null) {
armorOut.write(newline);
break;
}
armorOut.write(newline);
if (forceV3Signature) {
signatureV3Generator.update(newline);
processLine(line, armorOut, signatureV3Generator);
} else {
signatureGenerator.update(newline);
processLine(line, armorOut, signatureGenerator);
}
while (lookAhead != -1);
}
armorOut.endClearText();
@ -1784,7 +1784,65 @@ public class Apg {
return Id.content.unknown;
}
private static void processLine(final String pLine,
final ArmoredOutputStream pArmoredOutput,
final PGPSignatureGenerator pSignatureGenerator)
throws IOException, SignatureException {
if (pLine == null) {
return;
}
final char[] chars = pLine.toCharArray();
int len = chars.length;
while (len > 0) {
if (!Character.isWhitespace(chars[len - 1])) {
break;
}
len--;
}
final byte[] data = pLine.substring(0, len).getBytes("UTF-8");
pArmoredOutput.write(data);
pSignatureGenerator.update(data);
}
private static void processLine(final String pLine,
final ArmoredOutputStream pArmoredOutput,
final PGPV3SignatureGenerator pSignatureGenerator)
throws IOException, SignatureException {
if (pLine == null) {
return;
}
final char[] chars = pLine.toCharArray();
int len = chars.length;
while (len > 0) {
if (!Character.isWhitespace(chars[len - 1])) {
break;
}
len--;
}
final byte[] data = pLine.substring(0, len).getBytes("UTF-8");
pArmoredOutput.write(data);
pSignatureGenerator.update(data);
}
// taken from ClearSignedFileProcessor in BC
private static void processLine(PGPSignature sig, byte[] line)
throws SignatureException, IOException {
int length = getLengthWithoutWhiteSpace(line);
if (length > 0) {
sig.update(line, 0, length);
}
}
private static int readInputLine(ByteArrayOutputStream bOut, InputStream fIn)
throws IOException {
bOut.reset();
@ -1837,34 +1895,6 @@ public class Apg {
return lookAhead;
}
private static void processLine(PGPSignature sig, byte[] line)
throws SignatureException, IOException {
int length = getLengthWithoutWhiteSpace(line);
if (length > 0) {
sig.update(line, 0, length);
}
}
private static void processLine(OutputStream aOut, PGPSignatureGenerator sGen, byte[] line)
throws SignatureException, IOException {
int length = getLengthWithoutWhiteSpace(line);
if (length > 0) {
sGen.update(line, 0, length);
}
aOut.write(line, 0, line.length);
}
private static void processLine(OutputStream aOut, PGPV3SignatureGenerator sGen, byte[] line)
throws SignatureException, IOException {
int length = getLengthWithoutWhiteSpace(line);
if (length > 0) {
sGen.update(line, 0, length);
}
aOut.write(line, 0, line.length);
}
private static int getLengthWithoutSeparator(byte[] line) {
int end = line.length - 1;