diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-04-02 11:26:46 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-04-02 11:26:46 +0200 |
commit | 64358bb3f82ed3463c2cc54d306d1e646006deba (patch) | |
tree | fa38eb33481924d1ec2b9cdbb878430db9ee5dd1 /OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util | |
parent | 5583fd513ee134cb5fbe4e96e6d9a1c823c3010f (diff) | |
parent | 22fe3832ba0cf1102d7a2c8d53ad101464bccaff (diff) | |
download | open-keychain-64358bb3f82ed3463c2cc54d306d1e646006deba.tar.gz open-keychain-64358bb3f82ed3463c2cc54d306d1e646006deba.tar.bz2 open-keychain-64358bb3f82ed3463c2cc54d306d1e646006deba.zip |
Merge pull request #502 from thi/conform-to-style-guide
Conform to style guide, #466
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util')
8 files changed, 51 insertions, 39 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java index b987e1533..fbf93aeda 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java @@ -31,7 +31,6 @@ import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.pgp.PgpHelper; -import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry; import java.io.ByteArrayOutputStream; @@ -43,8 +42,6 @@ import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; -import static org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry.getAlgorithmFromId; - public class HkpKeyServer extends KeyServer { private static class HttpError extends Exception { private static final long serialVersionUID = 1718783705229428893L; @@ -72,20 +69,22 @@ public class HkpKeyServer extends KeyServer { /** * pub:%keyid%:%algo%:%keylen%:%creationdate%:%expirationdate%:%flags% * <ul> - * <li>%<b>keyid</b>% = this is either the fingerprint or the key ID of the key. Either the 16-digit or 8-digit - * key IDs are acceptable, but obviously the fingerprint is best.</li> + * <li>%<b>keyid</b>% = this is either the fingerprint or the key ID of the key. + * Either the 16-digit or 8-digit 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>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> + * <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 - * 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. + * <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 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. * <ul> * <li>r == revoked</li> * <li>d == disabled</li> @@ -94,7 +93,8 @@ public class HkpKeyServer extends KeyServer { * </li> * </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 */ public static final Pattern PUB_KEY_LINE = Pattern @@ -105,17 +105,19 @@ public class HkpKeyServer extends KeyServer { /** * uid:%escaped uid string%:%creationdate%:%expirationdate%:%flags% * <ul> - * <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> + * <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> * <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> + * <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 - * 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. + * <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 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. * <ul> * <li>r == revoked</li> * <li>d == disabled</li> @@ -244,11 +246,10 @@ public class HkpKeyServer extends KeyServer { entry.setBitStrength(Integer.parseInt(matcher.group(3))); final int algorithmId = Integer.decode(matcher.group(2)); - entry.setAlgorithm(getAlgorithmFromId(algorithmId)); + entry.setAlgorithm(ImportKeysListEntry.getAlgorithmFromId(algorithmId)); // group 1 contains the full fingerprint (v4) or the long key id if available - // see https://bitbucket.org/skskeyserver/sks-keyserver/pull-request/12/fixes-for-machine-readable-indexes/diff - // and https://github.com/openpgp-keychain/openpgp-keychain/issues/259#issuecomment-38168176 + // see http://bit.ly/1d4bxbk and http://bit.ly/1gD1wwr String fingerprintOrKeyId = matcher.group(1); if (fingerprintOrKeyId.length() > 16) { entry.setFingerPrintHex(fingerprintOrKeyId.toLowerCase(Locale.US)); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/InputData.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/InputData.java index 092c14e00..28cfa11f2 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/InputData.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/InputData.java @@ -1,4 +1,6 @@ /* + * Copyright (C) 2010-2014 Thialfihar <thi@thialfihar.org> + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/IntentIntegratorSupportV4.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/IntentIntegratorSupportV4.java index b95b3ee6a..ae87deb31 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/IntentIntegratorSupportV4.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/IntentIntegratorSupportV4.java @@ -16,9 +16,10 @@ package org.sufficientlysecure.keychain.util; +import com.google.zxing.integration.android.IntentIntegrator; + import android.content.Intent; import android.support.v4.app.Fragment; -import com.google.zxing.integration.android.IntentIntegrator; /** * IntentIntegrator for the V4 Android compatibility package. diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/IterableIterator.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/IterableIterator.java index 40105df4f..3af674526 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/IterableIterator.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/IterableIterator.java @@ -24,7 +24,7 @@ public class IterableIterator<T> implements Iterable<T> { public IterableIterator(Iterator<T> iter, boolean failsafe) { mIter = iter; - if(failsafe && mIter == null) { + if (failsafe && mIter == null) { // is there a better way? mIter = new ArrayList<T>().iterator(); } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeychainServiceListener.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeychainServiceListener.java index 14b2a2211..b205bd556 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeychainServiceListener.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeychainServiceListener.java @@ -1,16 +1,20 @@ /* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de> * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + package org.sufficientlysecure.keychain.util; public interface KeychainServiceListener { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/PositionAwareInputStream.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/PositionAwareInputStream.java index a783d7820..4fcd3047f 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/PositionAwareInputStream.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/PositionAwareInputStream.java @@ -1,4 +1,6 @@ /* + * Copyright (C) 2010-2014 Thialfihar <thi@thialfihar.org> + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/ProgressScaler.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/ProgressScaler.java index 15b70e22e..23961c05f 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/ProgressScaler.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/ProgressScaler.java @@ -36,7 +36,7 @@ public class ProgressScaler implements ProgressDialogUpdater { * Set progressDialogUpdater of ProgressDialog by sending message to handler on UI thread */ public void setProgress(String message, int progress, int max) { - mWrapped.setProgress(message, mFrom+ progress*(mTo-mFrom)/max, mMax); + mWrapped.setProgress(message, mFrom + progress * (mTo - mFrom) / max, mMax); } public void setProgress(int resourceId, int progress, int max) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/QrCodeUtils.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/QrCodeUtils.java index 8c3367bea..af9034aa7 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/QrCodeUtils.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/QrCodeUtils.java @@ -18,14 +18,16 @@ package org.sufficientlysecure.keychain.util; -import android.graphics.Bitmap; -import android.graphics.Color; import com.google.zxing.BarcodeFormat; import com.google.zxing.EncodeHintType; import com.google.zxing.WriterException; import com.google.zxing.common.BitMatrix; import com.google.zxing.qrcode.QRCodeWriter; import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; + +import android.graphics.Bitmap; +import android.graphics.Color; + import org.sufficientlysecure.keychain.Constants; import java.util.Hashtable; |