diff options
Diffstat (limited to 'OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp')
5 files changed, 59 insertions, 59 deletions
diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpHelper.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpHelper.java index c5f6c5891..7ac904d89 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpHelper.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpHelper.java @@ -91,7 +91,7 @@ public class PgpHelper { } if (enc == null) { - throw new PgpGeneralException(context.getString(R.string.error_invalidData)); + throw new PgpGeneralException(context.getString(R.string.error_invalid_data)); } // TODO: currently we always only look at the first known key @@ -205,7 +205,7 @@ public class PgpHelper { raf.getFilePointer(); byte[] data = new byte[1 << 16]; int pos = 0; - String msg = context.getString(R.string.progress_deletingSecurely, file.getName()); + String msg = context.getString(R.string.progress_deleting_securely, file.getName()); while (pos < length) { if (progress != null) progress.setProgress(msg, (int) (100 * pos / length), 100); diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpImportExport.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpImportExport.java index eff8de224..2d112cc72 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpImportExport.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpImportExport.java @@ -117,7 +117,7 @@ public class PgpImportExport { throws PgpGeneralException, FileNotFoundException, PGPException, IOException { Bundle returnData = new Bundle(); - updateProgress(R.string.progress_importingSecretKeys, 0, 100); + updateProgress(R.string.progress_importing_secret_keys, 0, 100); PositionAwareInputStream progressIn = new PositionAwareInputStream(data.getInputStream()); @@ -158,7 +158,7 @@ public class PgpImportExport { if (status == Id.return_value.error) { throw new PgpGeneralException( - mContext.getString(R.string.error_savingKeys)); + mContext.getString(R.string.error_saving_keys)); } // update the counts to display to the user at the end @@ -195,14 +195,14 @@ public class PgpImportExport { Bundle returnData = new Bundle(); if (keyRingMasterKeyIds.size() == 1) { - updateProgress(R.string.progress_exportingKey, 0, 100); + updateProgress(R.string.progress_exporting_key, 0, 100); } else { - updateProgress(R.string.progress_exportingKeys, 0, 100); + updateProgress(R.string.progress_exporting_keys, 0, 100); } if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { throw new PgpGeneralException( - mContext.getString(R.string.error_externalStorageNotReady)); + mContext.getString(R.string.error_external_storage_not_ready)); } // export public keyrings... diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java index 37a3cb8e2..e2d89bfab 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java @@ -280,7 +280,7 @@ public class PgpKeyHelper { public static String getMainUserIdSafe(Context context, PGPPublicKey key) { String userId = getMainUserId(key); if (userId == null || userId.equals("")) { - userId = context.getString(R.string.unknownUserId); + userId = context.getString(R.string.unknown_user_id); } return userId; } @@ -288,7 +288,7 @@ public class PgpKeyHelper { public static String getMainUserIdSafe(Context context, PGPSecretKey key) { String userId = getMainUserId(key); if (userId == null || userId.equals("")) { - userId = context.getString(R.string.unknownUserId); + userId = context.getString(R.string.unknown_user_id); } return userId; } diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java index 0a1227a59..2cbfed28b 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java @@ -122,7 +122,7 @@ public class PgpKeyOperation { NoSuchProviderException, PgpGeneralException, InvalidAlgorithmParameterException { if (keySize < 512) { - throw new PgpGeneralException(mContext.getString(R.string.error_keySizeMinimum512bit)); + throw new PgpGeneralException(mContext.getString(R.string.error_key_size_minimum512bit)); } if (passPhrase == null) { @@ -143,7 +143,7 @@ public class PgpKeyOperation { case Id.choice.algorithm.elgamal: { if (masterSecretKey == null) { throw new PgpGeneralException( - mContext.getString(R.string.error_masterKeyMustNotBeElGamal)); + mContext.getString(R.string.error_master_key_must_not_be_el_gamal)); } keyGen = KeyPairGenerator.getInstance("ElGamal", Constants.BOUNCY_CASTLE_PROVIDER_NAME); BigInteger p = Primes.getBestPrime(keySize); @@ -165,7 +165,7 @@ public class PgpKeyOperation { } default: { - throw new PgpGeneralException(mContext.getString(R.string.error_unknownAlgorithmChoice)); + throw new PgpGeneralException(mContext.getString(R.string.error_unknown_algorithm_choice)); } } @@ -216,7 +216,7 @@ public class PgpKeyOperation { String newPassPhrase) throws IOException, PGPException, PGPException, NoSuchProviderException { - updateProgress(R.string.progress_buildingKey, 0, 100); + updateProgress(R.string.progress_building_key, 0, 100); if (oldPassPhrase == null) { oldPassPhrase = ""; } @@ -232,7 +232,7 @@ public class PgpKeyOperation { new JcePBESecretKeyEncryptorBuilder(keyRing.getSecretKey() .getKeyEncryptionAlgorithm()).build(newPassPhrase.toCharArray())); - updateProgress(R.string.progress_savingKeyRing, 50, 100); + updateProgress(R.string.progress_saving_key_ring, 50, 100); ProviderHelper.saveKeyRing(mContext, newKeyRing); @@ -247,7 +247,7 @@ public class PgpKeyOperation { Log.d(Constants.TAG, "userIds: " + userIds.toString()); - updateProgress(R.string.progress_buildingKey, 0, 100); + updateProgress(R.string.progress_building_key, 0, 100); if (oldPassPhrase == null) { oldPassPhrase = ""; @@ -256,7 +256,7 @@ public class PgpKeyOperation { newPassPhrase = ""; } - updateProgress(R.string.progress_preparingMasterKey, 10, 100); + updateProgress(R.string.progress_preparing_master_key, 10, 100); int usageId = keysUsages.get(0); boolean canSign = (usageId == Id.choice.usage.sign_only || usageId == Id.choice.usage.sign_and_encrypt); @@ -287,7 +287,7 @@ public class PgpKeyOperation { Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(oldPassPhrase.toCharArray()); PGPPrivateKey masterPrivateKey = masterKey.extractPrivateKey(keyDecryptor); - updateProgress(R.string.progress_certifyingMasterKey, 20, 100); + updateProgress(R.string.progress_certifying_master_key, 20, 100); for (String userId : userIds) { PGPContentSignerBuilder signerBuilder = new JcaPGPContentSignerBuilder( @@ -332,7 +332,7 @@ public class PgpKeyOperation { // hashedPacketsGen.setKeyExpirationTime(true, numDays * 86400); // } - updateProgress(R.string.progress_buildingMasterKeyRing, 30, 100); + updateProgress(R.string.progress_building_master_key, 30, 100); // define hashing and signing algos PGPDigestCalculator sha1Calc = new JcaPGPDigestCalculatorProviderBuilder().build().get( @@ -350,7 +350,7 @@ public class PgpKeyOperation { masterKeyPair, mainUserId, sha1Calc, hashedPacketsGen.generate(), unhashedPacketsGen.generate(), certificationSignerBuilder, keyEncryptor); - updateProgress(R.string.progress_addingSubKeys, 40, 100); + updateProgress(R.string.progress_adding_sub_keys, 40, 100); for (int i = 1; i < keys.size(); ++i) { updateProgress(40 + 50 * (i - 1) / (keys.size() - 1), 100); @@ -401,7 +401,7 @@ public class PgpKeyOperation { PGPSecretKeyRing secretKeyRing = keyGen.generateSecretKeyRing(); PGPPublicKeyRing publicKeyRing = keyGen.generatePublicKeyRing(); - updateProgress(R.string.progress_savingKeyRing, 90, 100); + updateProgress(R.string.progress_saving_key_ring, 90, 100); ProviderHelper.saveKeyRing(mContext, secretKeyRing); ProviderHelper.saveKeyRing(mContext, publicKeyRing); @@ -420,7 +420,7 @@ public class PgpKeyOperation { PGPSecretKey signingKey = PgpKeyHelper.getCertificationKey(mContext, masterKeyId); if (signingKey == null) { - throw new PgpGeneralException(mContext.getString(R.string.error_signatureFailed)); + throw new PgpGeneralException(mContext.getString(R.string.error_signature_failed)); } PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder().setProvider( @@ -428,7 +428,7 @@ public class PgpKeyOperation { PGPPrivateKey signaturePrivateKey = signingKey.extractPrivateKey(keyDecryptor); if (signaturePrivateKey == null) { throw new PgpGeneralException( - mContext.getString(R.string.error_couldNotExtractPrivateKey)); + mContext.getString(R.string.error_could_not_extract_private_key)); } // TODO: SHA256 fixed? diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpOperation.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpOperation.java index d79ccdf3b..755537012 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpOperation.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/pgp/PgpOperation.java @@ -137,32 +137,32 @@ public class PgpOperation { if (encryptionKeyIds.length == 0 && encryptionPassphrase == null) { throw new PgpGeneralException( - mContext.getString(R.string.error_noEncryptionKeysOrPassPhrase)); + mContext.getString(R.string.error_no_encryption_keys_or_passphrase)); } if (signatureKeyId != Id.key.none) { signingKeyRing = ProviderHelper.getPGPSecretKeyRingByKeyId(mContext, signatureKeyId); signingKey = PgpKeyHelper.getSigningKey(mContext, signatureKeyId); if (signingKey == null) { - throw new PgpGeneralException(mContext.getString(R.string.error_signatureFailed)); + throw new PgpGeneralException(mContext.getString(R.string.error_signature_failed)); } if (signaturePassphrase == null) { throw new PgpGeneralException( - mContext.getString(R.string.error_noSignaturePassPhrase)); + mContext.getString(R.string.error_no_signature_passphrase)); } - updateProgress(R.string.progress_extractingSignatureKey, 0, 100); + updateProgress(R.string.progress_extracting_signature_key, 0, 100); PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder().setProvider( Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(signaturePassphrase.toCharArray()); signaturePrivateKey = signingKey.extractPrivateKey(keyDecryptor); if (signaturePrivateKey == null) { throw new PgpGeneralException( - mContext.getString(R.string.error_couldNotExtractPrivateKey)); + mContext.getString(R.string.error_could_not_extract_private_key)); } } - updateProgress(R.string.progress_preparingStreams, 5, 100); + updateProgress(R.string.progress_preparing_streams, 5, 100); // encrypt and compress input file content JcePGPDataEncryptorBuilder encryptorBuilder = new JcePGPDataEncryptorBuilder( @@ -196,7 +196,7 @@ public class PgpOperation { PGPV3SignatureGenerator signatureV3Generator = null; if (signatureKeyId != Id.key.none) { - updateProgress(R.string.progress_preparingSignature, 10, 100); + updateProgress(R.string.progress_preparing_signature, 10, 100); // content signer based on signing key algorithm and choosen hash algorithm JcaPGPContentSignerBuilder contentSignerBuilder = new JcaPGPContentSignerBuilder( @@ -262,7 +262,7 @@ public class PgpOperation { literalGen.close(); if (signatureKeyId != Id.key.none) { - updateProgress(R.string.progress_generatingSignature, 95, 100); + updateProgress(R.string.progress_generating_signature, 95, 100); if (signatureForceV3) { signatureV3Generator.generate().encode(pOut); } else { @@ -293,19 +293,19 @@ public class PgpOperation { if (signatureKeyId == 0) { armorOut.close(); - throw new PgpGeneralException(mContext.getString(R.string.error_noSignatureKey)); + throw new PgpGeneralException(mContext.getString(R.string.error_no_signature_key)); } signingKeyRing = ProviderHelper.getPGPSecretKeyRingByKeyId(mContext, signatureKeyId); signingKey = PgpKeyHelper.getSigningKey(mContext, signatureKeyId); if (signingKey == null) { armorOut.close(); - throw new PgpGeneralException(mContext.getString(R.string.error_signatureFailed)); + throw new PgpGeneralException(mContext.getString(R.string.error_signature_failed)); } if (signaturePassphrase == null) { armorOut.close(); - throw new PgpGeneralException(mContext.getString(R.string.error_noSignaturePassPhrase)); + throw new PgpGeneralException(mContext.getString(R.string.error_no_signature_passphrase)); } PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder().setProvider( Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(signaturePassphrase.toCharArray()); @@ -313,11 +313,11 @@ public class PgpOperation { if (signaturePrivateKey == null) { armorOut.close(); throw new PgpGeneralException( - mContext.getString(R.string.error_couldNotExtractPrivateKey)); + mContext.getString(R.string.error_could_not_extract_private_key)); } - updateProgress(R.string.progress_preparingStreams, 0, 100); + updateProgress(R.string.progress_preparing_streams, 0, 100); - updateProgress(R.string.progress_preparingSignature, 30, 100); + updateProgress(R.string.progress_preparing_signature, 30, 100); PGPSignatureGenerator signatureGenerator = null; PGPV3SignatureGenerator signatureV3Generator = null; @@ -408,17 +408,17 @@ public class PgpOperation { PGPPrivateKey signaturePrivateKey = null; if (signatureKeyId == 0) { - throw new PgpGeneralException(mContext.getString(R.string.error_noSignatureKey)); + throw new PgpGeneralException(mContext.getString(R.string.error_no_signature_key)); } signingKeyRing = ProviderHelper.getPGPSecretKeyRingByKeyId(mContext, signatureKeyId); signingKey = PgpKeyHelper.getSigningKey(mContext, signatureKeyId); if (signingKey == null) { - throw new PgpGeneralException(mContext.getString(R.string.error_signatureFailed)); + throw new PgpGeneralException(mContext.getString(R.string.error_signature_failed)); } if (signaturePassPhrase == null) { - throw new PgpGeneralException(mContext.getString(R.string.error_noSignaturePassPhrase)); + throw new PgpGeneralException(mContext.getString(R.string.error_no_signature_passphrase)); } PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder().setProvider( @@ -426,11 +426,11 @@ public class PgpOperation { signaturePrivateKey = signingKey.extractPrivateKey(keyDecryptor); if (signaturePrivateKey == null) { throw new PgpGeneralException( - mContext.getString(R.string.error_couldNotExtractPrivateKey)); + mContext.getString(R.string.error_could_not_extract_private_key)); } - updateProgress(R.string.progress_preparingStreams, 0, 100); + updateProgress(R.string.progress_preparing_streams, 0, 100); - updateProgress(R.string.progress_preparingSignature, 30, 100); + updateProgress(R.string.progress_preparing_signature, 30, 100); PGPSignatureGenerator signatureGenerator = null; PGPV3SignatureGenerator signatureV3Generator = null; @@ -520,7 +520,7 @@ public class PgpOperation { } if (enc == null) { - throw new PgpGeneralException(context.getString(R.string.error_invalidData)); + throw new PgpGeneralException(context.getString(R.string.error_invalid_data)); } Iterator<?> it = enc.getEncryptedDataObjects(); @@ -548,7 +548,7 @@ public class PgpOperation { long signatureKeyId = 0; int currentProgress = 0; - updateProgress(R.string.progress_readingData, currentProgress, 100); + updateProgress(R.string.progress_reading_data, currentProgress, 100); if (o instanceof PGPEncryptedDataList) { enc = (PGPEncryptedDataList) o; @@ -557,7 +557,7 @@ public class PgpOperation { } if (enc == null) { - throw new PgpGeneralException(mContext.getString(R.string.error_invalidData)); + throw new PgpGeneralException(mContext.getString(R.string.error_invalid_data)); } InputStream clear = null; @@ -581,10 +581,10 @@ public class PgpOperation { if (pbe == null) { throw new PgpGeneralException( - mContext.getString(R.string.error_noSymmetricEncryptionPacket)); + mContext.getString(R.string.error_no_symmetric_encryption_packet)); } - updateProgress(R.string.progress_preparingStreams, currentProgress, 100); + updateProgress(R.string.progress_preparing_streams, currentProgress, 100); PGPDigestCalculatorProvider digestCalcProvider = new JcaPGPDigestCalculatorProviderBuilder() .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(); @@ -597,7 +597,7 @@ public class PgpOperation { encryptedData = pbe; currentProgress += 5; } else { - updateProgress(R.string.progress_findingKey, currentProgress, 100); + updateProgress(R.string.progress_finding_key, currentProgress, 100); PGPPublicKeyEncryptedData pbe = null; PGPSecretKey secretKey = null; @@ -616,11 +616,11 @@ public class PgpOperation { } if (secretKey == null) { - throw new PgpGeneralException(mContext.getString(R.string.error_noSecretKeyFound)); + throw new PgpGeneralException(mContext.getString(R.string.error_no_secret_key_found)); } currentProgress += 5; - updateProgress(R.string.progress_extractingKey, currentProgress, 100); + updateProgress(R.string.progress_extracting_key, currentProgress, 100); PGPPrivateKey privateKey = null; try { PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder() @@ -628,14 +628,14 @@ public class PgpOperation { passphrase.toCharArray()); privateKey = secretKey.extractPrivateKey(keyDecryptor); } catch (PGPException e) { - throw new PGPException(mContext.getString(R.string.error_wrongPassPhrase)); + throw new PGPException(mContext.getString(R.string.error_wrong_passphrase)); } if (privateKey == null) { throw new PgpGeneralException( - mContext.getString(R.string.error_couldNotExtractPrivateKey)); + mContext.getString(R.string.error_could_not_extract_private_key)); } currentProgress += 5; - updateProgress(R.string.progress_preparingStreams, currentProgress, 100); + updateProgress(R.string.progress_preparing_streams, currentProgress, 100); PublicKeyDataDecryptorFactory decryptorFactory = new JcePublicKeyDataDecryptorFactoryBuilder() .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(privateKey); @@ -653,7 +653,7 @@ public class PgpOperation { int signatureIndex = -1; if (dataChunk instanceof PGPCompressedData) { - updateProgress(R.string.progress_decompressingData, currentProgress, 100); + updateProgress(R.string.progress_decompressing_data, currentProgress, 100); PGPObjectFactory fact = new PGPObjectFactory( ((PGPCompressedData) dataChunk).getDataStream()); @@ -663,7 +663,7 @@ public class PgpOperation { } if (dataChunk instanceof PGPOnePassSignatureList) { - updateProgress(R.string.progress_processingSignature, currentProgress, 100); + updateProgress(R.string.progress_processing_signature, currentProgress, 100); returnData.putBoolean(KeychainIntentService.RESULT_SIGNATURE, true); PGPOnePassSignatureList sigList = (PGPOnePassSignatureList) dataChunk; @@ -753,7 +753,7 @@ public class PgpOperation { } if (signature != null) { - updateProgress(R.string.progress_verifyingSignature, 90, 100); + updateProgress(R.string.progress_verifying_signature, 90, 100); PGPSignatureList signatureList = (PGPSignatureList) plainFact.nextObject(); PGPSignature messageSignature = signatureList.get(signatureIndex); @@ -767,7 +767,7 @@ public class PgpOperation { // TODO: add integrity somewhere if (encryptedData.isIntegrityProtected()) { - updateProgress(R.string.progress_verifyingIntegrity, 95, 100); + updateProgress(R.string.progress_verifying_integrity, 95, 100); if (encryptedData.verify()) { // passed @@ -814,12 +814,12 @@ public class PgpOperation { returnData.putBoolean(KeychainIntentService.RESULT_SIGNATURE, true); - updateProgress(R.string.progress_processingSignature, 60, 100); + updateProgress(R.string.progress_processing_signature, 60, 100); PGPObjectFactory pgpFact = new PGPObjectFactory(aIn); PGPSignatureList sigList = (PGPSignatureList) pgpFact.nextObject(); if (sigList == null) { - throw new PgpGeneralException(mContext.getString(R.string.error_corruptData)); + throw new PgpGeneralException(mContext.getString(R.string.error_corrupt_data)); } PGPSignature signature = null; long signatureKeyId = 0; |