mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-14 21:05:09 -05:00
Prepare API for OpenPgpSignatureResult extensions
This commit is contained in:
parent
0fc1a09bfc
commit
40e6b24b14
@ -78,7 +78,7 @@ public class OpenPgpSignatureResultBuilder {
|
|||||||
if (mKnownKey) {
|
if (mKnownKey) {
|
||||||
if (mValidSignature) {
|
if (mValidSignature) {
|
||||||
result.setKeyId(mKeyId);
|
result.setKeyId(mKeyId);
|
||||||
result.setUserId(mUserId);
|
result.setPrimaryUserId(mUserId);
|
||||||
|
|
||||||
if (mIsSignatureKeyCertified) {
|
if (mIsSignatureKeyCertified) {
|
||||||
Log.d(Constants.TAG, "SIGNATURE_SUCCESS_CERTIFIED");
|
Log.d(Constants.TAG, "SIGNATURE_SUCCESS_CERTIFIED");
|
||||||
@ -94,8 +94,8 @@ public class OpenPgpSignatureResultBuilder {
|
|||||||
} else {
|
} else {
|
||||||
result.setKeyId(mKeyId);
|
result.setKeyId(mKeyId);
|
||||||
|
|
||||||
Log.d(Constants.TAG, "SIGNATURE_UNKNOWN_PUB_KEY");
|
Log.d(Constants.TAG, "SIGNATURE_KEY_MISSING");
|
||||||
result.setStatus(OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY);
|
result.setStatus(OpenPgpSignatureResult.SIGNATURE_KEY_MISSING);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -31,7 +31,6 @@ import org.openintents.openpgp.OpenPgpError;
|
|||||||
import org.openintents.openpgp.OpenPgpSignatureResult;
|
import org.openintents.openpgp.OpenPgpSignatureResult;
|
||||||
import org.openintents.openpgp.util.OpenPgpApi;
|
import org.openintents.openpgp.util.OpenPgpApi;
|
||||||
import org.openkeychain.nfc.NfcActivity;
|
import org.openkeychain.nfc.NfcActivity;
|
||||||
import org.spongycastle.util.Arrays;
|
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.pgp.PgpDecryptVerify;
|
import org.sufficientlysecure.keychain.pgp.PgpDecryptVerify;
|
||||||
@ -447,7 +446,15 @@ public class OpenPgpService extends RemoteService {
|
|||||||
if (signatureResult != null) {
|
if (signatureResult != null) {
|
||||||
result.putExtra(OpenPgpApi.RESULT_SIGNATURE, signatureResult);
|
result.putExtra(OpenPgpApi.RESULT_SIGNATURE, signatureResult);
|
||||||
|
|
||||||
if (signatureResult.getStatus() == OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY) {
|
if (data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) < 5) {
|
||||||
|
// SIGNATURE_KEY_REVOKED and SIGNATURE_KEY_EXPIRED have been added in version 5
|
||||||
|
if (signatureResult.getStatus() == OpenPgpSignatureResult.SIGNATURE_KEY_REVOKED
|
||||||
|
|| signatureResult.getStatus() == OpenPgpSignatureResult.SIGNATURE_KEY_EXPIRED) {
|
||||||
|
signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (signatureResult.getStatus() == OpenPgpSignatureResult.SIGNATURE_KEY_MISSING) {
|
||||||
// If signature is unknown we return an _additional_ PendingIntent
|
// If signature is unknown we return an _additional_ PendingIntent
|
||||||
// to retrieve the missing key
|
// to retrieve the missing key
|
||||||
Intent intent = new Intent(getBaseContext(), ImportKeysActivity.class);
|
Intent intent = new Intent(getBaseContext(), ImportKeysActivity.class);
|
||||||
@ -577,9 +584,10 @@ public class OpenPgpService extends RemoteService {
|
|||||||
|
|
||||||
// version code is required and needs to correspond to version code of service!
|
// version code is required and needs to correspond to version code of service!
|
||||||
// History of versions in org.openintents.openpgp.util.OpenPgpApi
|
// History of versions in org.openintents.openpgp.util.OpenPgpApi
|
||||||
// we support 3 and 4
|
// we support 3, 4, 5
|
||||||
if (data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) != 3
|
if (data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) != 3
|
||||||
&& data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) != 4) {
|
&& data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) != 4
|
||||||
|
&& data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) != 5) {
|
||||||
Intent result = new Intent();
|
Intent result = new Intent();
|
||||||
OpenPgpError error = new OpenPgpError
|
OpenPgpError error = new OpenPgpError
|
||||||
(OpenPgpError.INCOMPATIBLE_API_VERSIONS, "Incompatible API versions!\n"
|
(OpenPgpError.INCOMPATIBLE_API_VERSIONS, "Incompatible API versions!\n"
|
||||||
|
@ -110,7 +110,7 @@ public abstract class DecryptFragment extends Fragment {
|
|||||||
|
|
||||||
mSignatureKeyId = signatureResult.getKeyId();
|
mSignatureKeyId = signatureResult.getKeyId();
|
||||||
|
|
||||||
String userId = signatureResult.getUserId();
|
String userId = signatureResult.getPrimaryUserId();
|
||||||
String[] userIdSplit = KeyRing.splitUserId(userId);
|
String[] userIdSplit = KeyRing.splitUserId(userId);
|
||||||
if (userIdSplit[0] != null) {
|
if (userIdSplit[0] != null) {
|
||||||
mUserId.setText(userIdSplit[0]);
|
mUserId.setText(userIdSplit[0]);
|
||||||
@ -153,7 +153,7 @@ public abstract class DecryptFragment extends Fragment {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY: {
|
case OpenPgpSignatureResult.SIGNATURE_KEY_MISSING: {
|
||||||
if (signatureResult.isSignatureOnly()) {
|
if (signatureResult.isSignatureOnly()) {
|
||||||
mResultText.setText(R.string.decrypt_result_signature_unknown_pub_key);
|
mResultText.setText(R.string.decrypt_result_signature_unknown_pub_key);
|
||||||
} else {
|
} else {
|
||||||
|
@ -596,7 +596,7 @@
|
|||||||
<!-- Keyring Canonicalization log entries -->
|
<!-- Keyring Canonicalization log entries -->
|
||||||
<string name="msg_kc_public">Canonicalizing public keyring %s</string>
|
<string name="msg_kc_public">Canonicalizing public keyring %s</string>
|
||||||
<string name="msg_kc_secret">Canonicalizing secret keyring %s</string>
|
<string name="msg_kc_secret">Canonicalizing secret keyring %s</string>
|
||||||
<string name="msg_kc_error_v3">This is an OpenPGP version 3 key, which have been deprecated and are no longer supported!</string>
|
<string name="msg_kc_error_v3">This is an OpenPGP version 3 key, which has been deprecated and is no longer supported!</string>
|
||||||
<string name="msg_kc_error_no_uid">Keyring has no valid user ids!</string>
|
<string name="msg_kc_error_no_uid">Keyring has no valid user ids!</string>
|
||||||
<string name="msg_kc_error_master_algo">The master key uses an unknown (%s) algorithm!</string>
|
<string name="msg_kc_error_master_algo">The master key uses an unknown (%s) algorithm!</string>
|
||||||
<string name="msg_kc_master">Processing master key</string>
|
<string name="msg_kc_master">Processing master key</string>
|
||||||
@ -604,7 +604,7 @@
|
|||||||
<string name="msg_kc_revoke_bad_local">Removing keyring revocation certificate with "local" flag</string>
|
<string name="msg_kc_revoke_bad_local">Removing keyring revocation certificate with "local" flag</string>
|
||||||
<string name="msg_kc_revoke_bad_time">Removing keyring revocation certificate with future timestamp</string>
|
<string name="msg_kc_revoke_bad_time">Removing keyring revocation certificate with future timestamp</string>
|
||||||
<string name="msg_kc_revoke_bad_type">Removing master key certificate of unknown type (%s)</string>
|
<string name="msg_kc_revoke_bad_type">Removing master key certificate of unknown type (%s)</string>
|
||||||
<string name="msg_kc_revoke_bad_type_uid">Removing user id certification in bad position</string>
|
<string name="msg_kc_revoke_bad_type_uid">Removing user id certificate in bad position</string>
|
||||||
<string name="msg_kc_revoke_bad">Removing bad keyring revocation certificate</string>
|
<string name="msg_kc_revoke_bad">Removing bad keyring revocation certificate</string>
|
||||||
<string name="msg_kc_revoke_dup">Removing redundant keyring revocation certificate</string>
|
<string name="msg_kc_revoke_dup">Removing redundant keyring revocation certificate</string>
|
||||||
<string name="msg_kc_sub">Processing subkey %s</string>
|
<string name="msg_kc_sub">Processing subkey %s</string>
|
||||||
@ -644,7 +644,7 @@
|
|||||||
<string name="msg_kc_uid_revoke_old">Removing outdated revocation certificate for user id "%s"</string>
|
<string name="msg_kc_uid_revoke_old">Removing outdated revocation certificate for user id "%s"</string>
|
||||||
<string name="msg_kc_uid_no_cert">No valid self-certificate found for user id %s, removing from ring</string>
|
<string name="msg_kc_uid_no_cert">No valid self-certificate found for user id %s, removing from ring</string>
|
||||||
<string name="msg_kc_uid_remove">Removing invalid user id %s</string>
|
<string name="msg_kc_uid_remove">Removing invalid user id %s</string>
|
||||||
<string name="msg_kc_uid_dup">Removing duplicate user id "%s". The secret key contained two of them. This may result in missing certifications!</string>
|
<string name="msg_kc_uid_dup">Removing duplicate user id "%s". The secret key contained two of them. This may result in missing certificates!</string>
|
||||||
|
|
||||||
<!-- Keyring merging log entries -->
|
<!-- Keyring merging log entries -->
|
||||||
<string name="msg_mg_error_secret_dummy">New public subkey found, but secret subkey dummy generation is not supported!</string>
|
<string name="msg_mg_error_secret_dummy">New public subkey found, but secret subkey dummy generation is not supported!</string>
|
||||||
|
2
extern/openpgp-api-lib
vendored
2
extern/openpgp-api-lib
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 1d0eeef047c4938f4e25bc06f7e92e83aa46a4c4
|
Subproject commit 8b36d286680ee57b2181e86a3f02ba1278a81166
|
Loading…
Reference in New Issue
Block a user