mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 19:22:14 -05:00
fix signature passing and verify in demo
This commit is contained in:
parent
16284f0cfd
commit
c7c45a80fa
@ -185,7 +185,7 @@ public class OpenPgpProviderActivity extends Activity {
|
|||||||
Log.e(Constants.TAG, "UnsupportedEncodingException", e);
|
Log.e(Constants.TAG, "UnsupportedEncodingException", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.getBoolean(OpenPgpConstants.RESULT_SIGNATURE, false)) {
|
if (result.containsKey(OpenPgpConstants.RESULT_SIGNATURE)) {
|
||||||
OpenPgpSignatureResult sigResult
|
OpenPgpSignatureResult sigResult
|
||||||
= result.getParcelable(OpenPgpConstants.RESULT_SIGNATURE);
|
= result.getParcelable(OpenPgpConstants.RESULT_SIGNATURE);
|
||||||
handleSignature(sigResult);
|
handleSignature(sigResult);
|
||||||
|
@ -281,7 +281,8 @@ public class OpenPgpService extends RemoteService {
|
|||||||
// Get Input- and OutputStream from ParcelFileDescriptor
|
// Get Input- and OutputStream from ParcelFileDescriptor
|
||||||
InputStream is = new ParcelFileDescriptor.AutoCloseInputStream(input);
|
InputStream is = new ParcelFileDescriptor.AutoCloseInputStream(input);
|
||||||
OutputStream os = new ParcelFileDescriptor.AutoCloseOutputStream(output);
|
OutputStream os = new ParcelFileDescriptor.AutoCloseOutputStream(output);
|
||||||
OpenPgpSignatureResult sigResult = null;
|
|
||||||
|
Bundle result = new Bundle();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// PGPUtil.getDecoderStream(is)
|
// PGPUtil.getDecoderStream(is)
|
||||||
@ -403,9 +404,10 @@ public class OpenPgpService extends RemoteService {
|
|||||||
|
|
||||||
// byte[] outputBytes = ((ByteArrayOutputStream) outputStream).toByteArray();
|
// byte[] outputBytes = ((ByteArrayOutputStream) outputStream).toByteArray();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// get signature informations from bundle
|
// get signature informations from bundle
|
||||||
boolean signature = outputBundle.getBoolean(KeychainIntentService.RESULT_SIGNATURE, false);
|
boolean signature = outputBundle.getBoolean(KeychainIntentService.RESULT_SIGNATURE, false);
|
||||||
|
|
||||||
if (signature) {
|
if (signature) {
|
||||||
long signatureKeyId = outputBundle
|
long signatureKeyId = outputBundle
|
||||||
.getLong(KeychainIntentService.RESULT_SIGNATURE_KEY_ID, 0);
|
.getLong(KeychainIntentService.RESULT_SIGNATURE_KEY_ID, 0);
|
||||||
@ -425,17 +427,16 @@ public class OpenPgpService extends RemoteService {
|
|||||||
signatureStatus = OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY;
|
signatureStatus = OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
sigResult = new OpenPgpSignatureResult(signatureStatus, signatureUserId,
|
OpenPgpSignatureResult sigResult = new OpenPgpSignatureResult(signatureStatus, signatureUserId,
|
||||||
signatureOnly, signatureKeyId);
|
signatureOnly, signatureKeyId);
|
||||||
|
result.putParcelable(OpenPgpConstants.RESULT_SIGNATURE, sigResult);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
is.close();
|
is.close();
|
||||||
os.close();
|
os.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
Bundle result = new Bundle();
|
|
||||||
result.putInt(OpenPgpConstants.RESULT_CODE, OpenPgpConstants.RESULT_CODE_SUCCESS);
|
result.putInt(OpenPgpConstants.RESULT_CODE, OpenPgpConstants.RESULT_CODE_SUCCESS);
|
||||||
result.putParcelable(OpenPgpConstants.RESULT_SIGNATURE, sigResult);
|
|
||||||
return result;
|
return result;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Bundle result = new Bundle();
|
Bundle result = new Bundle();
|
||||||
|
Loading…
Reference in New Issue
Block a user