本文整理汇总了Java中org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback类的典型用法代码示例。如果您正苦于以下问题:Java IOpenPgpCallback类的具体用法?Java IOpenPgpCallback怎么用?Java IOpenPgpCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IOpenPgpCallback类属于org.openintents.openpgp.util.OpenPgpApi包,在下文中一共展示了IOpenPgpCallback类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: processAutocryptHeaderForCurrentPart
import org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback; //导入依赖的package包/类
private void processAutocryptHeaderForCurrentPart() {
Intent intent = new Intent(OpenPgpApi.ACTION_UPDATE_AUTOCRYPT_PEER);
boolean hasInlineKeyData = autocryptOperations.addAutocryptPeerUpdateToIntentIfPresent(
(Message) currentCryptoPart.part, intent);
if (hasInlineKeyData) {
Timber.d("Passing autocrypt data from plain mail to OpenPGP API");
// We don't care about the result here, so we just call this fire-and-forget wait to minimize delay
openPgpApi.executeApiAsync(intent, null, null, new IOpenPgpCallback() {
@Override
public void onReturn(Intent result) {
Timber.d("Autocrypt update OK!");
}
});
}
onCryptoFinished();
}
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:17,代码来源:MessageCryptoHelper.java
示例2: chooseKey
import org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback; //导入依赖的package包/类
public void chooseKey(final Account account, final UiCallback<Account> callback) {
Intent p = new Intent();
p.setAction(OpenPgpApi.ACTION_GET_SIGN_KEY_ID);
api.executeApiAsync(p, null, null, new IOpenPgpCallback() {
@Override
public void onReturn(Intent result) {
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, 0)) {
case OpenPgpApi.RESULT_CODE_SUCCESS:
callback.success(account);
return;
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
callback.userInputRequried((PendingIntent) result
.getParcelableExtra(OpenPgpApi.RESULT_INTENT),
account);
return;
case OpenPgpApi.RESULT_CODE_ERROR:
logError(account, (OpenPgpError) result.getParcelableExtra(OpenPgpApi.RESULT_ERROR));
callback.error(R.string.openpgp_error, account);
}
}
});
}
开发者ID:syntafin,项目名称:TenguChat,代码行数:24,代码来源:PgpEngine.java
示例3: hasKey
import org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback; //导入依赖的package包/类
public void hasKey(final Contact contact, final UiCallback<Contact> callback) {
Intent params = new Intent();
params.setAction(OpenPgpApi.ACTION_GET_KEY);
params.putExtra(OpenPgpApi.EXTRA_KEY_ID, contact.getPgpKeyId());
api.executeApiAsync(params, null, null, new IOpenPgpCallback() {
@Override
public void onReturn(Intent result) {
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, 0)) {
case OpenPgpApi.RESULT_CODE_SUCCESS:
callback.success(contact);
return;
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
callback.userInputRequried((PendingIntent) result
.getParcelableExtra(OpenPgpApi.RESULT_INTENT),
contact);
return;
case OpenPgpApi.RESULT_CODE_ERROR:
logError(contact.getAccount(), (OpenPgpError) result.getParcelableExtra(OpenPgpApi.RESULT_ERROR));
callback.error(R.string.openpgp_error, contact);
}
}
});
}
开发者ID:syntafin,项目名称:TenguChat,代码行数:25,代码来源:PgpEngine.java
示例4: chooseKey
import org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback; //导入依赖的package包/类
public void chooseKey(final Account account, final UiCallback<Account> callback) {
Intent p = new Intent();
p.setAction(OpenPgpApi.ACTION_GET_SIGN_KEY_ID);
api.executeApiAsync(p, null, null, new IOpenPgpCallback() {
@Override
public void onReturn(Intent result) {
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, 0)) {
case OpenPgpApi.RESULT_CODE_SUCCESS:
callback.success(account);
return;
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
callback.userInputRequried((PendingIntent) result
.getParcelableExtra(OpenPgpApi.RESULT_INTENT),
account);
return;
case OpenPgpApi.RESULT_CODE_ERROR:
callback.error(R.string.openpgp_error, account);
}
}
});
}
开发者ID:xavierle,项目名称:messengerxmpp,代码行数:23,代码来源:PgpEngine.java
示例5: hasKey
import org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback; //导入依赖的package包/类
public void hasKey(final Contact contact, final UiCallback<Contact> callback) {
Intent params = new Intent();
params.setAction(OpenPgpApi.ACTION_GET_KEY);
params.putExtra(OpenPgpApi.EXTRA_KEY_ID, contact.getPgpKeyId());
api.executeApiAsync(params, null, null, new IOpenPgpCallback() {
@Override
public void onReturn(Intent result) {
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, 0)) {
case OpenPgpApi.RESULT_CODE_SUCCESS:
callback.success(contact);
return;
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
callback.userInputRequried((PendingIntent) result
.getParcelableExtra(OpenPgpApi.RESULT_INTENT),
contact);
return;
case OpenPgpApi.RESULT_CODE_ERROR:
callback.error(R.string.openpgp_error, contact);
}
}
});
}
开发者ID:xavierle,项目名称:messengerxmpp,代码行数:24,代码来源:PgpEngine.java
示例6: chooseKey
import org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback; //导入依赖的package包/类
public void chooseKey(final Account account, final UiCallback<Account> callback) {
Intent p = new Intent();
p.setAction(OpenPgpApi.ACTION_GET_SIGN_KEY_ID);
api.executeApiAsync(p, null, null, new IOpenPgpCallback() {
@Override
public void onReturn(Intent result) {
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, 0)) {
case OpenPgpApi.RESULT_CODE_SUCCESS:
callback.success(account);
return;
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
callback.userInputRequried((PendingIntent) result
.getParcelableExtra(OpenPgpApi.RESULT_INTENT),
account);
return;
case OpenPgpApi.RESULT_CODE_ERROR:
logError(account, (OpenPgpError) result.getParcelableExtra(OpenPgpApi.RESULT_ERROR));
callback.error(R.string.openpgp_error, account);
}
}
});
}
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:24,代码来源:PgpEngine.java
示例7: hasKey
import org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback; //导入依赖的package包/类
public void hasKey(final Contact contact, final UiCallback<Contact> callback) {
Intent params = new Intent();
params.setAction(OpenPgpApi.ACTION_GET_KEY);
params.putExtra(OpenPgpApi.EXTRA_KEY_ID, contact.getPgpKeyId());
api.executeApiAsync(params, null, null, new IOpenPgpCallback() {
@Override
public void onReturn(Intent result) {
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, 0)) {
case OpenPgpApi.RESULT_CODE_SUCCESS:
callback.success(contact);
return;
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
callback.userInputRequried((PendingIntent) result
.getParcelableExtra(OpenPgpApi.RESULT_INTENT),
contact);
return;
case OpenPgpApi.RESULT_CODE_ERROR:
logError(contact.getAccount(), (OpenPgpError) result.getParcelableExtra(OpenPgpApi.RESULT_ERROR));
callback.error(R.string.openpgp_error, contact);
}
}
});
}
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:25,代码来源:PgpEngine.java
示例8: hasKey
import org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback; //导入依赖的package包/类
public void hasKey(final Contact contact, final UiCallback<Contact> callback) {
Intent params = new Intent();
params.setAction(OpenPgpApi.ACTION_GET_KEY);
params.putExtra(OpenPgpApi.EXTRA_KEY_ID, contact.getPgpKeyId());
params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, contact.getAccount()
.getJid().toBareJid().toString());
api.executeApiAsync(params, null, null, new IOpenPgpCallback() {
@Override
public void onReturn(Intent result) {
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, 0)) {
case OpenPgpApi.RESULT_CODE_SUCCESS:
callback.success(contact);
return;
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
callback.userInputRequried((PendingIntent) result
.getParcelableExtra(OpenPgpApi.RESULT_INTENT),
contact);
return;
case OpenPgpApi.RESULT_CODE_ERROR:
callback.error(R.string.openpgp_error, contact);
}
}
});
}
开发者ID:juanignaciomolina,项目名称:txtr,代码行数:26,代码来源:PgpEngine.java
示例9: hasKey
import org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback; //导入依赖的package包/类
public void hasKey(final Contact contact, final UiCallback<Contact> callback) {
Intent params = new Intent();
params.setAction(OpenPgpApi.ACTION_GET_KEY);
params.putExtra(OpenPgpApi.EXTRA_KEY_ID, contact.getPgpKeyId());
params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, contact.getAccount()
.getJid());
api.executeApiAsync(params, null, null, new IOpenPgpCallback() {
@Override
public void onReturn(Intent result) {
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, 0)) {
case OpenPgpApi.RESULT_CODE_SUCCESS:
callback.success(contact);
return;
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
callback.userInputRequried((PendingIntent) result
.getParcelableExtra(OpenPgpApi.RESULT_INTENT),
contact);
return;
case OpenPgpApi.RESULT_CODE_ERROR:
callback.error(R.string.openpgp_error, contact);
return;
}
}
});
}
开发者ID:GitESS,项目名称:SyncChatAndroid,代码行数:27,代码来源:PgpEngine.java
示例10: textPlainWithAutocrypt_withOpenPgpApi
import org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback; //导入依赖的package包/类
@Test
public void textPlainWithAutocrypt_withOpenPgpApi() throws Exception {
setUpWithOpenPgpApi();
MimeMessage message = new MimeMessage();
message.setUid("msguid");
message.setHeader("Content-Type", "text/plain");
when(autocryptOperations.hasAutocryptHeader(message)).thenReturn(true);
when(autocryptOperations.addAutocryptPeerUpdateToIntentIfPresent(same(message), any(Intent.class))).thenReturn(true);
MessageCryptoCallback messageCryptoCallback = mock(MessageCryptoCallback.class);
messageCryptoHelper.asyncStartOrResumeProcessingMessage(message, messageCryptoCallback,
null, null, false);
ArgumentCaptor<MessageCryptoAnnotations> captor = ArgumentCaptor.forClass(MessageCryptoAnnotations.class);
verify(messageCryptoCallback).onCryptoOperationsFinished(captor.capture());
MessageCryptoAnnotations annotations = captor.getValue();
assertTrue(annotations.isEmpty());
verifyNoMoreInteractions(messageCryptoCallback);
ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
verify(autocryptOperations).addAutocryptPeerUpdateToIntentIfPresent(same(message), intentCaptor.capture());
verify(openPgpApi).executeApiAsync(same(intentCaptor.getValue()), same((InputStream) null),
same((OutputStream) null), any(IOpenPgpCallback.class));
}
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:28,代码来源:MessageCryptoHelperTest.java
示例11: generateSignature
import org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback; //导入依赖的package包/类
public void generateSignature(final Account account, String status,
final UiCallback<Account> callback) {
Intent params = new Intent();
params.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
params.setAction(OpenPgpApi.ACTION_SIGN);
params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, account.getJid());
InputStream is = new ByteArrayInputStream(status.getBytes());
final OutputStream os = new ByteArrayOutputStream();
api.executeApiAsync(params, is, os, new IOpenPgpCallback() {
@Override
public void onReturn(Intent result) {
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, 0)) {
case OpenPgpApi.RESULT_CODE_SUCCESS:
StringBuilder signatureBuilder = new StringBuilder();
String[] lines = os.toString().split("\n");
for (int i = 7; i < lines.length - 1; ++i) {
signatureBuilder.append(lines[i].trim());
}
account.setKey("pgp_signature", signatureBuilder.toString());
callback.success(account);
return;
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
callback.userInputRequried((PendingIntent) result
.getParcelableExtra(OpenPgpApi.RESULT_INTENT),
account);
return;
case OpenPgpApi.RESULT_CODE_ERROR:
callback.error(R.string.openpgp_error, account);
return;
}
}
});
}
开发者ID:GitESS,项目名称:SyncChatAndroid,代码行数:35,代码来源:PgpEngine.java
示例12: generateSignature
import org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback; //导入依赖的package包/类
public void generateSignature(final Account account, String status,
final UiCallback<Account> callback) {
if (account.getPgpId() == -1) {
return;
}
Intent params = new Intent();
params.setAction(OpenPgpApi.ACTION_CLEARTEXT_SIGN);
params.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
params.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, account.getPgpId());
InputStream is = new ByteArrayInputStream(status.getBytes());
final OutputStream os = new ByteArrayOutputStream();
api.executeApiAsync(params, is, os, new IOpenPgpCallback() {
@Override
public void onReturn(Intent result) {
notifyPgpDecryptionService(account, OpenPgpApi.ACTION_SIGN, result);
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, 0)) {
case OpenPgpApi.RESULT_CODE_SUCCESS:
StringBuilder signatureBuilder = new StringBuilder();
try {
os.flush();
String[] lines = os.toString().split("\n");
boolean sig = false;
for (String line : lines) {
if (sig) {
if (line.contains("END PGP SIGNATURE")) {
sig = false;
} else {
if (!line.contains("Version")) {
signatureBuilder.append(line.trim());
}
}
}
if (line.contains("BEGIN PGP SIGNATURE")) {
sig = true;
}
}
} catch (IOException e) {
callback.error(R.string.openpgp_error, account);
return;
}
account.setPgpSignature(signatureBuilder.toString());
callback.success(account);
return;
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
callback.userInputRequried((PendingIntent) result
.getParcelableExtra(OpenPgpApi.RESULT_INTENT),
account);
return;
case OpenPgpApi.RESULT_CODE_ERROR:
callback.error(R.string.openpgp_error, account);
}
}
});
}
开发者ID:xavierle,项目名称:messengerxmpp,代码行数:56,代码来源:PgpEngine.java
示例13: generateSignature
import org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback; //导入依赖的package包/类
public void generateSignature(final Account account, String status,
final UiCallback<Account> callback) {
Intent params = new Intent();
params.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
params.setAction(OpenPgpApi.ACTION_SIGN);
params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, account.getJid().toBareJid().toString());
InputStream is = new ByteArrayInputStream(status.getBytes());
final OutputStream os = new ByteArrayOutputStream();
api.executeApiAsync(params, is, os, new IOpenPgpCallback() {
@Override
public void onReturn(Intent result) {
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, 0)) {
case OpenPgpApi.RESULT_CODE_SUCCESS:
StringBuilder signatureBuilder = new StringBuilder();
try {
os.flush();
String[] lines = os.toString().split("\n");
boolean sig = false;
for (String line : lines) {
if (sig) {
if (line.contains("END PGP SIGNATURE")) {
sig = false;
} else {
if (!line.contains("Version")) {
signatureBuilder.append(line.trim());
}
}
}
if (line.contains("BEGIN PGP SIGNATURE")) {
sig = true;
}
}
} catch (IOException e) {
callback.error(R.string.openpgp_error, account);
return;
}
account.setKey("pgp_signature", signatureBuilder.toString());
callback.success(account);
return;
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
callback.userInputRequried((PendingIntent) result
.getParcelableExtra(OpenPgpApi.RESULT_INTENT),
account);
return;
case OpenPgpApi.RESULT_CODE_ERROR:
callback.error(R.string.openpgp_error, account);
}
}
});
}
开发者ID:juanignaciomolina,项目名称:txtr,代码行数:52,代码来源:PgpEngine.java
注:本文中的org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论