Fixed coding style.

This commit is contained in:
gogowitczak
2014-03-18 15:44:20 +01:00
parent 5277e4c1e7
commit fee18bd33e
2 changed files with 144 additions and 137 deletions

View File

@@ -199,7 +199,4 @@ public class ImportKeysListEntry implements Serializable, Parcelable {
public static String getAlgorithmFromId(int algorithmId) { public static String getAlgorithmFromId(int algorithmId) {
return (ALGORITHM_IDS.get(algorithmId) != null ? ALGORITHM_IDS.get(algorithmId) : ALGORITHM_IDS.get(-1)); return (ALGORITHM_IDS.get(algorithmId) != null ? ALGORITHM_IDS.get(algorithmId) : ALGORITHM_IDS.get(-1));
} }
} }

View File

@@ -72,12 +72,17 @@ public class HkpKeyServer extends KeyServer {
/** /**
* pub:%keyid%:%algo%:%keylen%:%creationdate%:%expirationdate%:%flags% * pub:%keyid%:%algo%:%keylen%:%creationdate%:%expirationdate%:%flags%
* <ul> * <ul>
* <li>%<b>keyid</b>% = this is either the fingerprint or the key ID of the key. * <li>%<b>keyid</b>% = this is either the fingerprint or the key ID of the key. Either the 16-digit or 8-digit
* Either the 16-digit or 8-digit key IDs are acceptable, but obviously the fingerprint is best.</li> * key IDs are acceptable, but obviously the fingerprint is best.</li>
* <li>%<b>algo</b>% = the algorithm number, (i.e. 1==RSA, 17==DSA, etc). See <a href="http://tools.ietf.org/html/rfc2440#section-9.1">RFC-2440</a></li> * <li>%<b>algo</b>% = the algorithm number, (i.e. 1==RSA, 17==DSA, etc).
* See <a href="http://tools.ietf.org/html/rfc2440#section-9.1">RFC-2440</a></li>
* <li>%<b>keylen</b>% = the key length (i.e. 1024, 2048, 4096, etc.)</li> * <li>%<b>keylen</b>% = the key length (i.e. 1024, 2048, 4096, etc.)</li>
* <li>%<b>creationdate</b>% = creation date of the key in standard <a href="http://tools.ietf.org/html/rfc2440#section-9.1">RFC-2440</a> form (i.e. number of seconds since 1/1/1970 UTC time)</li> * <li>%<b>creationdate</b>% = creation date of the key in standard
* <li>%<b>expirationdate</b>% = expiration date of the key in standard <a href="http://tools.ietf.org/html/rfc2440#section-9.1">RFC-2440</a> form (i.e. number of seconds since 1/1/1970 UTC time)</li> * <a href="http://tools.ietf.org/html/rfc2440#section-9.1">RFC-2440</a> form (i.e. number of seconds since
* 1/1/1970 UTC time)</li>
* <li>%<b>expirationdate</b>% = expiration date of the key in standard
* <a href="http://tools.ietf.org/html/rfc2440#section-9.1">RFC-2440</a> form (i.e. number of seconds since
* 1/1/1970 UTC time)</li>
* <li>%<b>flags</b>% = letter codes to indicate details of the key, if any. Flags may be in any order. The * <li>%<b>flags</b>% = letter codes to indicate details of the key, if any. Flags may be in any order. The
* meaning of "disabled" is implementation-specific. Note that individual flags may be unimplemented, so * meaning of "disabled" is implementation-specific. Note that individual flags may be unimplemented, so
* the absence of a given flag does not necessarily mean the absence of the detail. * the absence of a given flag does not necessarily mean the absence of the detail.
@@ -89,8 +94,8 @@ public class HkpKeyServer extends KeyServer {
* </li> * </li>
* </ul> * </ul>
* *
* * @see <a href="http://tools.ietf.org/html/draft-shaw-openpgp-hkp-00#section-5.2">5.2. Machine Readable Indexes</a>
* @see <a href="http://tools.ietf.org/html/draft-shaw-openpgp-hkp-00#section-5.2">5.2. Machine Readable Indexes</a> in Internet-Draft OpenPGP HTTP Keyserver Protocol Document * in Internet-Draft OpenPGP HTTP Keyserver Protocol Document
*/ */
public static final Pattern PUB_KEY_LINE = Pattern public static final Pattern PUB_KEY_LINE = Pattern
.compile("pub:([0-9a-fA-F]+):([0-9]+):([0-9]+):([0-9]+):([0-9]*):([rde]*)[ \n\r]*" // pub line .compile("pub:([0-9a-fA-F]+):([0-9]+):([0-9]+):([0-9]+):([0-9]*):([rde]*)[ \n\r]*" // pub line
@@ -102,8 +107,12 @@ public class HkpKeyServer extends KeyServer {
* <ul> * <ul>
* <li>%<b>escaped uid string</b>% = the user ID string, with HTTP %-escaping for anything that isn't 7-bit * <li>%<b>escaped uid string</b>% = the user ID string, with HTTP %-escaping for anything that isn't 7-bit
* safe as well as for the ":" character. Any other characters may be escaped, as desired.</li> * safe as well as for the ":" character. Any other characters may be escaped, as desired.</li>
* <li>%<b>creationdate</b>% = creation date of the key in standard <a href="http://tools.ietf.org/html/rfc2440#section-9.1">RFC-2440</a> form (i.e. number of seconds since 1/1/1970 UTC time)</li> * <li>%<b>creationdate</b>% = creation date of the key in standard
* <li>%<b>expirationdate</b>% = expiration date of the key in standard <a href="http://tools.ietf.org/html/rfc2440#section-9.1">RFC-2440</a> form (i.e. number of seconds since 1/1/1970 UTC time)</li> * <a href="http://tools.ietf.org/html/rfc2440#section-9.1">RFC-2440</a> form (i.e. number of seconds since
* 1/1/1970 UTC time)</li>
* <li>%<b>expirationdate</b>% = expiration date of the key in standard
* <a href="http://tools.ietf.org/html/rfc2440#section-9.1">RFC-2440</a> form (i.e. number of seconds since
* 1/1/1970 UTC time)</li>
* <li>%<b>flags</b>% = letter codes to indicate details of the key, if any. Flags may be in any order. The * <li>%<b>flags</b>% = letter codes to indicate details of the key, if any. Flags may be in any order. The
* meaning of "disabled" is implementation-specific. Note that individual flags may be unimplemented, so * meaning of "disabled" is implementation-specific. Note that individual flags may be unimplemented, so
* the absence of a given flag does not necessarily mean the absence of the detail. * the absence of a given flag does not necessarily mean the absence of the detail.
@@ -239,7 +248,7 @@ public class HkpKeyServer extends KeyServer {
final long creationDate = Long.parseLong(matcher.group(4)); final long creationDate = Long.parseLong(matcher.group(4));
final GregorianCalendar tmpGreg = new GregorianCalendar(TimeZone.getTimeZone("UTC")); final GregorianCalendar tmpGreg = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
tmpGreg.setTimeInMillis(creationDate*1000); tmpGreg.setTimeInMillis(creationDate * 1000);
info.date = tmpGreg.getTime(); info.date = tmpGreg.getTime();
info.revoked = matcher.group(6).contains("r"); info.revoked = matcher.group(6).contains("r");
@@ -250,11 +259,12 @@ public class HkpKeyServer extends KeyServer {
while (uidMatcher.find()) { while (uidMatcher.find()) {
String tmp = uidMatcher.group(1).replaceAll("<.*?>", ""); String tmp = uidMatcher.group(1).replaceAll("<.*?>", "");
tmp = Html.fromHtml(tmp).toString().trim(); tmp = Html.fromHtml(tmp).toString().trim();
if (tmp.contains("%")) if (tmp.contains("%")) {
{
try { try {
tmp = (URLDecoder.decode(tmp, "UTF8")); // converts String like "Universit%C3%A4t" to a proper form "Universität". // converts Strings like "Universit%C3%A4t" to a proper encoding form "Universität".
tmp = (URLDecoder.decode(tmp, "UTF8"));
} catch (UnsupportedEncodingException ignored) { } catch (UnsupportedEncodingException ignored) {
// will never happen, because "UTF8" is supported
} }
} }
info.userIds.add(tmp); info.userIds.add(tmp);