当前位置: 首页>>代码示例>>Java>>正文


Java OpenPgpError类代码示例

本文整理汇总了Java中org.openintents.openpgp.OpenPgpError的典型用法代码示例。如果您正苦于以下问题:Java OpenPgpError类的具体用法?Java OpenPgpError怎么用?Java OpenPgpError使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OpenPgpError类属于org.openintents.openpgp包,在下文中一共展示了OpenPgpError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CryptoResultAnnotation

import org.openintents.openpgp.OpenPgpError; //导入依赖的package包/类
private CryptoResultAnnotation(@NonNull CryptoError errorType, MimeBodyPart replacementData,
        OpenPgpDecryptionResult openPgpDecryptionResult,
        OpenPgpSignatureResult openPgpSignatureResult,
        PendingIntent openPgpPendingIntent,
        PendingIntent openPgpInsecureWarningPendingIntent,
        OpenPgpError openPgpError,
        boolean overrideCryptoWarning) {
    this.errorType = errorType;
    this.replacementData = replacementData;

    this.openPgpDecryptionResult = openPgpDecryptionResult;
    this.openPgpSignatureResult = openPgpSignatureResult;
    this.openPgpPendingIntent = openPgpPendingIntent;
    this.openPgpError = openPgpError;
    this.openPgpInsecureWarningPendingIntent = openPgpInsecureWarningPendingIntent;
    this.sMimeDecryptionResult = null;
    this.sMimeSignatureResult = null;
    this.sMimePendingIntent = null;
    this.sMimeError = null;
    this.sMimeInsecureWarningPendingIntent = null;
    this.overrideCryptoWarning = overrideCryptoWarning;

    this.encapsulatedResult = null;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:25,代码来源:CryptoResultAnnotation.java

示例2: onReturn

import org.openintents.openpgp.OpenPgpError; //导入依赖的package包/类
@Override
public void onReturn(Intent result) {
    switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
        case OpenPgpApi.RESULT_CODE_SUCCESS: {

            long keyId = result.getLongExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, NO_KEY);
            save(keyId);

            break;
        }
        case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED: {

            PendingIntent pi = result.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
            try {
                Activity act = (Activity) getContext();
                act.startIntentSenderFromChild(
                        act, pi.getIntentSender(),
                        requestCode, null, 0, 0, 0);
            } catch (IntentSender.SendIntentException e) {
                Log.e(OpenPgpApi.TAG, "SendIntentException", e);
            }
            break;
        }
        case OpenPgpApi.RESULT_CODE_ERROR: {
            OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR);
            Log.e(OpenPgpApi.TAG, "RESULT_CODE_ERROR: " + error.getMessage());

            break;
        }
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:32,代码来源:OpenPgpKeyPreference.java

示例3: chooseKey

import org.openintents.openpgp.OpenPgpError; //导入依赖的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

示例4: hasKey

import org.openintents.openpgp.OpenPgpError; //导入依赖的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

示例5: onReturn

import org.openintents.openpgp.OpenPgpError; //导入依赖的package包/类
@Override
public void onReturn(Intent result) {
    switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
        case OpenPgpApi.RESULT_CODE_SUCCESS: {
            //long keyId = result.getLongExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, NO_KEY);
            break;
        }
        case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED: {
            PendingIntent pi = result.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
            try {
                act.startIntentSenderFromChild(
                        act, pi.getIntentSender(), requestCode, null, 0, 0, 0);
            } catch (IntentSender.SendIntentException e) {
                Pager.log += e.getMessage() + "\n\n";
            }
            break;
        }
        case OpenPgpApi.RESULT_CODE_ERROR: {
            Pager.log += ((OpenPgpError) result.getParcelableExtra(OpenPgpApi.RESULT_ERROR))
                    .getMessage() + "\n\n";
            break;
        }
    }
}
 
开发者ID:itprojects,项目名称:InboxPager,代码行数:25,代码来源:InboxGPG.java

示例6: handleError

import org.openintents.openpgp.OpenPgpError; //导入依赖的package包/类
private void handleError(final OpenPgpError error) {
    Activity activity = mFragment.getActivity();
    if (activity == null) {
        return;
    }
    activity.runOnUiThread(new Runnable() {

        @Override
        public void run() {
            mProgress.setVisibility(View.GONE);

            if (K9.DEBUG) {
                Log.d(K9.LOG_TAG, "OpenPGP Error ID:" + error.getErrorId());
                Log.d(K9.LOG_TAG, "OpenPGP Error Message:" + error.getMessage());
            }

            mText.setText(mFragment.getString(R.string.openpgp_error) + " "
                    + error.getMessage());
            MessageOpenPgpView.this.setBackgroundColor(mFragment.getResources().getColor(
                    R.color.openpgp_red));
        }
    });
}
 
开发者ID:daxslab,项目名称:daxSmail,代码行数:24,代码来源:MessageOpenPgpView.java

示例7: chooseKey

import org.openintents.openpgp.OpenPgpError; //导入依赖的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

示例8: hasKey

import org.openintents.openpgp.OpenPgpError; //导入依赖的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

示例9: sendOpenKeychainIntent

import org.openintents.openpgp.OpenPgpError; //导入依赖的package包/类
private void sendOpenKeychainIntent(Intent data) throws Exception {
    InputStream is = new ByteArrayInputStream(data.getExtras().getString("PGPAuth_SIGNDATA").getBytes());
    ByteArrayOutputStream os = new ByteArrayOutputStream();

    OpenPgpApi api = new OpenPgpApi(_context, _serviceConnection.getService());
    Intent result = api.executeApi(data, is, os);

    switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
        case OpenPgpApi.RESULT_CODE_SUCCESS: {
            _signedData = os.toString("UTF-8");
            _event.set();
            break;
        }
        case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED: {
            PendingIntent pi = result.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
            _guiHelper.startIntentSenderForResult(pi.getIntentSender(), 2);
            break;
        }
        case OpenPgpApi.RESULT_CODE_ERROR: {
            OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR);
            throw new RuntimeException(error.getMessage());
        }
    }
}
 
开发者ID:PGPAuth,项目名称:PGPAuth_Android,代码行数:25,代码来源:Logic.java

示例10: retrieveCryptoProviderRecipientStatus

import org.openintents.openpgp.OpenPgpError; //导入依赖的package包/类
@WorkerThread
public RecipientAutocryptStatus retrieveCryptoProviderRecipientStatus(
        OpenPgpApi openPgpApi, String[] recipientAddresses) {
    Intent intent = new Intent(OpenPgpApi.ACTION_QUERY_AUTOCRYPT_STATUS);
    intent.putExtra(OpenPgpApi.EXTRA_USER_IDS, recipientAddresses);

    Intent result = openPgpApi.executeApi(intent, (InputStream) null, null);

    switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
        case OpenPgpApi.RESULT_CODE_SUCCESS:
            RecipientAutocryptStatusType type = getRecipientAutocryptStatusFromIntent(result);
            PendingIntent pendingIntent = result.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
            return new RecipientAutocryptStatus(type, pendingIntent);

        case OpenPgpApi.RESULT_CODE_ERROR:
            OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR);
            if (error != null) {
                Timber.w("OpenPGP API Error #%s: %s", error.getErrorId(), error.getMessage());
            } else {
                Timber.w("OpenPGP API Unknown Error");
            }
            return new RecipientAutocryptStatus(RecipientAutocryptStatusType.ERROR, null);
        case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
            // should never happen, so treat as error!
        default:
            return new RecipientAutocryptStatus(RecipientAutocryptStatusType.ERROR, null);
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:29,代码来源:AutocryptStatusInteractor.java

示例11: onCryptoOperationFailed

import org.openintents.openpgp.OpenPgpError; //导入依赖的package包/类
private void onCryptoOperationFailed(OpenPgpError error) {
    CryptoResultAnnotation annotation;
    if (currentCryptoPart.type == CryptoPartType.PGP_SIGNED) {
        MimeBodyPart replacementPart = getMultipartSignedContentPartIfAvailable(currentCryptoPart.part);
        annotation = CryptoResultAnnotation.createOpenPgpSignatureErrorAnnotation(error, replacementPart);
    } else {
        annotation = CryptoResultAnnotation.createOpenPgpEncryptionErrorAnnotation(error);
    }
    addCryptoResultAnnotationToMessage(annotation);
    onCryptoFinished();
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:12,代码来源:MessageCryptoHelper.java

示例12: showMessageCryptoErrorView

import org.openintents.openpgp.OpenPgpError; //导入依赖的package包/类
public void showMessageCryptoErrorView(MessageViewInfo messageViewInfo, Drawable providerIcon) {
    resetAndPrepareMessageView(messageViewInfo);
    View view = mInflater.inflate(R.layout.message_content_crypto_error, containerView, false);
    setCryptoProviderIcon(providerIcon, view);

    TextView cryptoErrorText = (TextView) view.findViewById(R.id.crypto_error_text);
    OpenPgpError openPgpError = messageViewInfo.cryptoResultAnnotation.getOpenPgpError();
    if (openPgpError != null) {
        String errorText = openPgpError.getMessage();
        cryptoErrorText.setText(errorText);
    }

    containerView.addView(view);
    displayViewOnLoadFinished(false);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:16,代码来源:MessageTopView.java

示例13: onPgpPermissionCheckResult

import org.openintents.openpgp.OpenPgpError; //导入依赖的package包/类
@Override
public void onPgpPermissionCheckResult(Intent result) {
    int resultCode = result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR);
    switch (resultCode) {
        case OpenPgpApi.RESULT_CODE_SUCCESS:
            setCryptoProviderState(CryptoProviderState.OK);
            break;

        case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
            recipientMvpView.showErrorOpenPgpUserInteractionRequired();
            pendingUserInteractionIntent = result.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
            setCryptoProviderState(CryptoProviderState.ERROR);
            break;

        case OpenPgpApi.RESULT_CODE_ERROR:
        default:
            if (result.hasExtra(OpenPgpApi.RESULT_ERROR)) {
                OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR);
                if (error != null) {
                    handleOpenPgpError(error);
                } else {
                    recipientMvpView.showErrorOpenPgpConnection();
                    setCryptoProviderState(CryptoProviderState.ERROR);
                }
            } else {
                recipientMvpView.showErrorOpenPgpConnection();
                setCryptoProviderState(CryptoProviderState.ERROR);
            }
            break;
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:32,代码来源:RecipientPresenter.java

示例14: handleOpenPgpError

import org.openintents.openpgp.OpenPgpError; //导入依赖的package包/类
private void handleOpenPgpError(OpenPgpError error) {
    Timber.e("OpenPGP Api error: %s", error);

    if (error.getErrorId() == OpenPgpError.INCOMPATIBLE_API_VERSIONS) {
        // nothing we can do here, this is irrecoverable!
        openPgpProvider = null;
        QMail.setOpenPgpProvider(null);
        recipientMvpView.showErrorOpenPgpIncompatible();
        setCryptoProviderState(CryptoProviderState.UNCONFIGURED);
    } else {
        recipientMvpView.showErrorOpenPgpConnection();
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:14,代码来源:RecipientPresenter.java

示例15: buildOpportunisticEncrypt__withNoKeysAndNoSignOnly__shouldNotBeSigned

import org.openintents.openpgp.OpenPgpError; //导入依赖的package包/类
@Test
public void buildOpportunisticEncrypt__withNoKeysAndNoSignOnly__shouldNotBeSigned() throws MessagingException {
    ComposeCryptoStatus cryptoStatus = cryptoStatusBuilder
            .setRecipients(Collections.singletonList(new Recipient("test", "[email protected]", "labru", -1, "key")))
            .setCryptoMode(CryptoMode.NO_CHOICE)
            .build();
    pgpMessageBuilder.setCryptoStatus(cryptoStatus);


    Intent returnIntent = new Intent();
    returnIntent.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR);
    returnIntent.putExtra(OpenPgpApi.RESULT_ERROR,
            new OpenPgpError(OpenPgpError.OPPORTUNISTIC_MISSING_KEYS, "Missing keys"));


    when(openPgpApi.executeApi(any(Intent.class), any(OpenPgpDataSource.class), any(OutputStream.class)))
            .thenReturn(returnIntent);

    Callback mockCallback = mock(Callback.class);
    pgpMessageBuilder.buildAsync(mockCallback);


    ArgumentCaptor<MimeMessage> captor = ArgumentCaptor.forClass(MimeMessage.class);
    verify(mockCallback).onMessageBuildSuccess(captor.capture(), eq(false));
    verifyNoMoreInteractions(mockCallback);

    MimeMessage message = captor.getValue();
    Assert.assertEquals("text/plain", message.getMimeType());
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:30,代码来源:PgpMessageBuilderTest.java


注:本文中的org.openintents.openpgp.OpenPgpError类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。