本文整理汇总了Java中org.openintents.openpgp.util.OpenPgpApi.executeApiAsync方法的典型用法代码示例。如果您正苦于以下问题:Java OpenPgpApi.executeApiAsync方法的具体用法?Java OpenPgpApi.executeApiAsync怎么用?Java OpenPgpApi.executeApiAsync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openintents.openpgp.util.OpenPgpApi
的用法示例。
在下文中一共展示了OpenPgpApi.executeApiAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encrypt
import org.openintents.openpgp.util.OpenPgpApi; //导入方法依赖的package包/类
private void encrypt(Intent data) {
data.setAction(OpenPgpApi.ACTION_ENCRYPT);
if (cb_sign_to_self.isChecked()) {
long[] ll = new long[rcpt_keys.length + 1];
for (int ii = 0;ii < ll.length;++ii) {
if (ii == rcpt_keys.length) {
ll[ii] = l_sign_key_id;
} else {
ll[ii] = rcpt_keys[ii];
}
}
data.putExtra(OpenPgpApi.EXTRA_KEY_IDS, ll);
} else {
data.putExtra(OpenPgpApi.EXTRA_KEY_IDS, rcpt_keys);
}
//data.putExtra(OpenPgpApi.EXTRA_USER_IDS, rcpt_mailboxes);
data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
InputStream is = get_input_stream(true, false);
ByteArrayOutputStream os = new ByteArrayOutputStream();
OpenPgpApi api = new OpenPgpApi(this, open_pgp_service_connection.getService());
api.executeApiAsync(data, is, os, new ResultsCallback(os, REQUEST_CODE_ENCRYPT));
}
示例2: sign_and_encrypt
import org.openintents.openpgp.util.OpenPgpApi; //导入方法依赖的package包/类
public void sign_and_encrypt(Intent data) {
data.setAction(OpenPgpApi.ACTION_SIGN_AND_ENCRYPT);
data.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, l_sign_key_id);
if (cb_sign_to_self.isChecked()) {
long[] ll = new long[rcpt_keys.length + 1];
for (int ii = 0;ii < ll.length;++ii) {
if (ii == rcpt_keys.length) {
ll[ii] = l_sign_key_id;
} else {
ll[ii] = rcpt_keys[ii];
}
}
data.putExtra(OpenPgpApi.EXTRA_KEY_IDS, ll);
} else {
data.putExtra(OpenPgpApi.EXTRA_KEY_IDS, rcpt_keys);
}
//data.putExtra(OpenPgpApi.EXTRA_USER_IDS, rcpt_mailboxes);
data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
InputStream is = get_input_stream(true, false);
ByteArrayOutputStream os = new ByteArrayOutputStream();
OpenPgpApi api = new OpenPgpApi(this, open_pgp_service_connection.getService());
api.executeApiAsync(data, is, os, new ResultsCallback(os, REQUEST_CODE_SIGN_AND_ENCRYPT));
}
示例3: attemptPgpApiAccess
import org.openintents.openpgp.util.OpenPgpApi; //导入方法依赖的package包/类
private void attemptPgpApiAccess(String input) {
// PGP data (possibly) detected, try using OpenPGP API
Log.d("ResultShowActivity", "Attempting decryption");
Intent data = new Intent();
data.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY);
if (pgpKeyPassword != null) {
Log.d("ResultShowActivity", "Key applied - embedding key");
data.putExtra(OpenPgpApi.EXTRA_PASSPHRASE, pgpKeyPassword.toCharArray());
}
InputStream is;
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
is = new ByteArrayInputStream(input.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return;
}
OpenPgpApi api = new OpenPgpApi(this, serviceConnection.getService());
api.executeApiAsync(data, is, os, new CallBack(os, REQUEST_CODE_DECRYPT_AND_VERIFY));
}
示例4: get_rcpt_keys
import org.openintents.openpgp.util.OpenPgpApi; //导入方法依赖的package包/类
private void get_rcpt_keys(Intent data) {
data.setAction(OpenPgpApi.ACTION_GET_KEY_IDS);
data.putExtra(OpenPgpApi.EXTRA_USER_IDS, rcpt_mailboxes);
OpenPgpApi api = new OpenPgpApi(this, open_pgp_service_connection.getService());
api.executeApiAsync(data, null, null, new ResultsCallback(null, REQUEST_CODE_GET_KEY_IDS));
}
示例5: cleartext_sign
import org.openintents.openpgp.util.OpenPgpApi; //导入方法依赖的package包/类
/**
* Inline non-mime pgp messages. Not implemented.
**/
public void cleartext_sign(Intent data) {
data.setAction(OpenPgpApi.ACTION_CLEARTEXT_SIGN);
data.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, l_sign_key_id);
InputStream is = get_input_stream(true, true);
ByteArrayOutputStream os = new ByteArrayOutputStream();
OpenPgpApi api = new OpenPgpApi(this, open_pgp_service_connection.getService());
api.executeApiAsync(data, is, os, new ResultsCallback(os, REQUEST_CODE_CLEARTEXT_SIGN));
}
示例6: detached_sign
import org.openintents.openpgp.util.OpenPgpApi; //导入方法依赖的package包/类
/**
* Clear text signature PGP/MIME message.
**/
public void detached_sign(Intent data) {
data.setAction(OpenPgpApi.ACTION_DETACHED_SIGN);
data.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, l_sign_key_id);
InputStream is = get_input_stream(true, true);
OpenPgpApi api = new OpenPgpApi(this, open_pgp_service_connection.getService());
api.executeApiAsync(data, is, null, new ResultsCallback(null, REQUEST_CODE_DETACHED_SIGN));
}
示例7: decrypt_and_verify
import org.openintents.openpgp.util.OpenPgpApi; //导入方法依赖的package包/类
private void decrypt_and_verify(Intent data) {
data.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY);
InputStream is = get_input_stream(false, false);
ByteArrayOutputStream os = new ByteArrayOutputStream();
OpenPgpApi api = new OpenPgpApi(this, open_pgp_service_connection.getService());
api.executeApiAsync(data, is, os, new ResultsCallback(os, REQUEST_CODE_DECRYPT_AND_VERIFY));
}
示例8: decrypt_and_verify_detached
import org.openintents.openpgp.util.OpenPgpApi; //导入方法依赖的package包/类
public void decrypt_and_verify_detached(Intent data) {
data.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY);
if (msg_signature == null) {
toaster(getString(R.string.open_pgp_failure));
} else {
data.putExtra(OpenPgpApi.EXTRA_DETACHED_SIGNATURE, msg_signature.getBytes());
InputStream is = get_input_stream(false, false);
OpenPgpApi api = new OpenPgpApi(this, open_pgp_service_connection.getService());
api.executeApiAsync(data, is, null, new ResultsCallback
(null, REQUEST_CODE_DECRYPT_AND_VERIFY_DETACHED));
}
}
示例9: executeOpenPgpMethod
import org.openintents.openpgp.util.OpenPgpApi; //导入方法依赖的package包/类
private void executeOpenPgpMethod(Intent intent) {
intent.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
// this follows user id format of OpenPGP to allow key generation based on it
// includes account number to make it unique
String accName = OpenPgpApiHelper.buildAccountName(mIdentity);
intent.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, accName);
final InputStream is = getOpenPgpInputStream();
final ByteArrayOutputStream os = new ByteArrayOutputStream();
SignEncryptCallback callback = new SignEncryptCallback(os, REQUEST_CODE_SIGN_ENCRYPT);
OpenPgpApi api = new OpenPgpApi(this, mOpenPgpServiceConnection.getService());
api.executeApiAsync(intent, is, os, callback);
}
示例10: cleartextSign
import org.openintents.openpgp.util.OpenPgpApi; //导入方法依赖的package包/类
public void cleartextSign(Intent data) {
data.setAction(OpenPgpApi.ACTION_CLEARTEXT_SIGN);
data.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, mSignKeyId);
InputStream is = getInputstream(false);
ByteArrayOutputStream os = new ByteArrayOutputStream();
OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService());
api.executeApiAsync(data, is, os, new MyCallback(true, os, REQUEST_CODE_CLEARTEXT_SIGN));
}
示例11: detachedSign
import org.openintents.openpgp.util.OpenPgpApi; //导入方法依赖的package包/类
public void detachedSign(Intent data) {
data.setAction(OpenPgpApi.ACTION_DETACHED_SIGN);
data.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, mSignKeyId);
InputStream is = getInputstream(false);
// no output stream needed, detached signature is returned as RESULT_DETACHED_SIGNATURE
OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService());
api.executeApiAsync(data, is, null, new MyCallback(true, null, REQUEST_CODE_DETACHED_SIGN));
}
示例12: encrypt
import org.openintents.openpgp.util.OpenPgpApi; //导入方法依赖的package包/类
public void encrypt(Intent data) {
data.setAction(OpenPgpApi.ACTION_ENCRYPT);
if (!TextUtils.isEmpty(mEncryptUserIds.getText().toString())) {
data.putExtra(OpenPgpApi.EXTRA_USER_IDS, mEncryptUserIds.getText().toString().split(","));
}
data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
InputStream is = getInputstream(false);
ByteArrayOutputStream os = new ByteArrayOutputStream();
OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService());
api.executeApiAsync(data, is, os, new MyCallback(true, os, REQUEST_CODE_ENCRYPT));
}
示例13: signAndEncrypt
import org.openintents.openpgp.util.OpenPgpApi; //导入方法依赖的package包/类
public void signAndEncrypt(Intent data) {
data.setAction(OpenPgpApi.ACTION_SIGN_AND_ENCRYPT);
data.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, mSignKeyId);
if (!TextUtils.isEmpty(mEncryptUserIds.getText().toString())) {
data.putExtra(OpenPgpApi.EXTRA_USER_IDS, mEncryptUserIds.getText().toString().split(","));
}
data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
InputStream is = getInputstream(false);
ByteArrayOutputStream os = new ByteArrayOutputStream();
OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService());
api.executeApiAsync(data, is, os, new MyCallback(true, os, REQUEST_CODE_SIGN_AND_ENCRYPT));
}
示例14: decryptAndVerify
import org.openintents.openpgp.util.OpenPgpApi; //导入方法依赖的package包/类
public void decryptAndVerify(Intent data) {
data.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY);
InputStream is = getInputstream(true);
ByteArrayOutputStream os = new ByteArrayOutputStream();
OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService());
api.executeApiAsync(data, is, os, new MyCallback(false, os, REQUEST_CODE_DECRYPT_AND_VERIFY));
}
示例15: decryptAndVerifyDetached
import org.openintents.openpgp.util.OpenPgpApi; //导入方法依赖的package包/类
public void decryptAndVerifyDetached(Intent data) {
data.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY);
data.putExtra(OpenPgpApi.EXTRA_DETACHED_SIGNATURE, mDetachedSignature.getText().toString().getBytes());
// use from text from mMessage
InputStream is = getInputstream(false);
OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService());
api.executeApiAsync(data, is, null, new MyCallback(false, null, REQUEST_CODE_DECRYPT_AND_VERIFY_DETACHED));
}