mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 19:22:14 -05:00
move v3 key import prevention into canonicalization method
This commit is contained in:
parent
0a1de8deea
commit
62f7bf6215
@ -36,6 +36,7 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||
import org.sufficientlysecure.keychain.service.OperationResultParcel.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.OperationResultParcel.LogType;
|
||||
import org.sufficientlysecure.keychain.service.OperationResultParcel.OperationLog;
|
||||
import org.sufficientlysecure.keychain.service.OperationResults;
|
||||
import org.sufficientlysecure.keychain.util.IterableIterator;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
@ -245,6 +246,12 @@ public class UncachedKeyRing {
|
||||
indent, PgpKeyHelper.convertKeyIdToHex(getMasterKeyId()));
|
||||
indent += 1;
|
||||
|
||||
// do not accept v3 keys
|
||||
if (getVersion() <= 3) {
|
||||
log.add(LogLevel.ERROR, LogType.MSG_KC_V3_KEY, indent);
|
||||
return null;
|
||||
}
|
||||
|
||||
final Date now = new Date();
|
||||
|
||||
int redundantCerts = 0, badCerts = 0;
|
||||
|
@ -642,11 +642,6 @@ public class ProviderHelper {
|
||||
log(LogLevel.START, LogType.MSG_IP, PgpKeyHelper.convertKeyIdToHex(masterKeyId));
|
||||
mIndent += 1;
|
||||
|
||||
if (publicRing.getVersion() <= 3) {
|
||||
log(LogLevel.ERROR, LogType.MSG_IP_V3_KEY);
|
||||
return new SaveKeyringResult(SaveKeyringResult.RESULT_ERROR, mLog);
|
||||
}
|
||||
|
||||
if (publicRing.isSecret()) {
|
||||
log(LogLevel.ERROR, LogType.MSG_IP_BAD_TYPE_SECRET);
|
||||
return new SaveKeyringResult(SaveKeyringResult.RESULT_ERROR, mLog);
|
||||
@ -739,11 +734,6 @@ public class ProviderHelper {
|
||||
log(LogLevel.START, LogType.MSG_IS, PgpKeyHelper.convertKeyIdToHex(masterKeyId));
|
||||
mIndent += 1;
|
||||
|
||||
if (secretRing.getVersion() <= 3) {
|
||||
log(LogLevel.ERROR, LogType.MSG_IP_V3_KEY);
|
||||
return new SaveKeyringResult(SaveKeyringResult.RESULT_ERROR, mLog);
|
||||
}
|
||||
|
||||
if ( ! secretRing.isSecret()) {
|
||||
log(LogLevel.ERROR, LogType.MSG_IS_BAD_TYPE_PUBLIC);
|
||||
return new SaveKeyringResult(SaveKeyringResult.RESULT_ERROR, mLog);
|
||||
|
@ -231,7 +231,6 @@ public class OperationResultParcel implements Parcelable {
|
||||
MSG_IP(R.string.msg_ip),
|
||||
MSG_IP_APPLY_BATCH (R.string.msg_ip_apply_batch),
|
||||
MSG_IP_BAD_TYPE_SECRET (R.string.msg_ip_bad_type_secret),
|
||||
MSG_IP_V3_KEY (R.string.msg_ip_v3_key),
|
||||
MSG_IP_DELETE_OLD_FAIL (R.string.msg_ip_delete_old_fail),
|
||||
MSG_IP_DELETE_OLD_OK (R.string.msg_ip_delete_old_ok),
|
||||
MSG_IP_ENCODE_FAIL (R.string.msg_ip_encode_fail),
|
||||
@ -290,6 +289,7 @@ public class OperationResultParcel implements Parcelable {
|
||||
MSG_IS_SUCCESS (R.string.msg_is_success),
|
||||
|
||||
// keyring canonicalization
|
||||
MSG_KC_V3_KEY (R.string.msg_kc_v3_key),
|
||||
MSG_KC_PUBLIC (R.string.msg_kc_public),
|
||||
MSG_KC_SECRET (R.string.msg_kc_secret),
|
||||
MSG_KC_FATAL_NO_UID (R.string.msg_kc_fatal_no_uid),
|
||||
|
@ -497,7 +497,7 @@
|
||||
<!-- Import Public log entries -->
|
||||
<string name="msg_ip_apply_batch">Applying insert batch operation.</string>
|
||||
<string name="msg_ip_bad_type_secret">Tried to import secret keyring as public. This is a bug, please file a report!</string>
|
||||
<string name="msg_ip_v3_key">This key is an OpenPGP version 3 key and thus insecure. It has not been imported.</string>
|
||||
<string name="msg_kc_v3_key">This key is an OpenPGP version 3 key and thus insecure. It has not been imported.</string>
|
||||
<string name="msg_ip_delete_old_fail">No old key deleted (creating a new one?)</string>
|
||||
<string name="msg_ip_delete_old_ok">Deleted old key from database</string>
|
||||
<string name="msg_ip_encode_fail">Operation failed due to encoding error</string>
|
||||
|
Loading…
Reference in New Issue
Block a user