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


Java OpenPgpUtils类代码示例

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


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

示例1: migratePgpInlineEncryptedMessage

import org.openintents.openpgp.util.OpenPgpUtils; //导入依赖的package包/类
@Test
public void migratePgpInlineEncryptedMessage() throws Exception {
    SQLiteDatabase db = createV50Database();
    insertPgpInlineEncryptedMessage(db);
    db.close();

    LocalStore localStore = LocalStore.getInstance(account, RuntimeEnvironment.application);

    LocalMessage msg = localStore.getFolder("dev").getMessage("7");
    FetchProfile fp = new FetchProfile();
    fp.add(FetchProfile.Item.BODY);
    localStore.getFolder("dev").fetch(Collections.singletonList(msg), fp, null);

    Assert.assertEquals(6, msg.getDatabaseId());
    Assert.assertEquals(12, msg.getHeaderNames().size());
    Assert.assertEquals("text/plain", msg.getMimeType());
    Assert.assertEquals(0, msg.getAttachmentCount());
    Assert.assertTrue(msg.getBody() instanceof BinaryMemoryBody);

    String msgTextContent = MessageExtractor.getTextFromPart(msg);
    Assert.assertEquals(OpenPgpUtils.PARSE_RESULT_MESSAGE, OpenPgpUtils.parseMessage(msgTextContent));
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:23,代码来源:MigrationTest.java

示例2: migratePgpInlineClearsignedMessage

import org.openintents.openpgp.util.OpenPgpUtils; //导入依赖的package包/类
@Test
public void migratePgpInlineClearsignedMessage() throws Exception {
    SQLiteDatabase db = createV50Database();
    insertPgpInlineClearsignedMessage(db);
    db.close();

    LocalStore localStore = LocalStore.getInstance(account, RuntimeEnvironment.application);

    LocalMessage msg = localStore.getFolder("dev").getMessage("8");
    FetchProfile fp = new FetchProfile();
    fp.add(FetchProfile.Item.BODY);
    localStore.getFolder("dev").fetch(Collections.singletonList(msg), fp, null);

    Assert.assertEquals(7, msg.getDatabaseId());
    Assert.assertEquals(12, msg.getHeaderNames().size());
    Assert.assertEquals("text/plain", msg.getMimeType());
    Assert.assertEquals(0, msg.getAttachmentCount());
    Assert.assertTrue(msg.getBody() instanceof BinaryMemoryBody);

    String msgTextContent = MessageExtractor.getTextFromPart(msg);
    Assert.assertEquals(OpenPgpUtils.PARSE_RESULT_SIGNED_MESSAGE, OpenPgpUtils.parseMessage(msgTextContent));
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:23,代码来源:MigrationTest.java

示例3: migratePgpInlineEncryptedMessage

import org.openintents.openpgp.util.OpenPgpUtils; //导入依赖的package包/类
@Test
public void migratePgpInlineEncryptedMessage() throws Exception {
    SQLiteDatabase db = createV50Database();
    insertPgpInlineEncryptedMessage(db);
    db.close();

    LocalStore localStore = LocalStore.getInstance(account, RuntimeEnvironment.application);

    LocalMessage msg = localStore.getFolder("dev").getMessage("7");
    FetchProfile fp = new FetchProfile();
    fp.add(FetchProfile.Item.BODY);
    localStore.getFolder("dev").fetch(Collections.singletonList(msg), fp, null);

    Assert.assertEquals(6, msg.getId());
    Assert.assertEquals(12, msg.getHeaderNames().size());
    Assert.assertEquals("text/plain", msg.getMimeType());
    Assert.assertEquals(0, msg.getAttachmentCount());
    Assert.assertTrue(msg.getBody() instanceof BinaryMemoryBody);

    String msgTextContent = MessageExtractor.getTextFromPart(msg);
    Assert.assertEquals(OpenPgpUtils.PARSE_RESULT_MESSAGE, OpenPgpUtils.parseMessage(msgTextContent));
}
 
开发者ID:scoute-dich,项目名称:K9-MailClient,代码行数:23,代码来源:MigrationTest.java

示例4: migratePgpInlineClearsignedMessage

import org.openintents.openpgp.util.OpenPgpUtils; //导入依赖的package包/类
@Test
public void migratePgpInlineClearsignedMessage() throws Exception {
    SQLiteDatabase db = createV50Database();
    insertPgpInlineClearsignedMessage(db);
    db.close();

    LocalStore localStore = LocalStore.getInstance(account, RuntimeEnvironment.application);

    LocalMessage msg = localStore.getFolder("dev").getMessage("8");
    FetchProfile fp = new FetchProfile();
    fp.add(FetchProfile.Item.BODY);
    localStore.getFolder("dev").fetch(Collections.singletonList(msg), fp, null);

    Assert.assertEquals(7, msg.getId());
    Assert.assertEquals(12, msg.getHeaderNames().size());
    Assert.assertEquals("text/plain", msg.getMimeType());
    Assert.assertEquals(0, msg.getAttachmentCount());
    Assert.assertTrue(msg.getBody() instanceof BinaryMemoryBody);

    String msgTextContent = MessageExtractor.getTextFromPart(msg);
    Assert.assertEquals(OpenPgpUtils.PARSE_RESULT_SIGNED_MESSAGE, OpenPgpUtils.parseMessage(msgTextContent));
}
 
开发者ID:scoute-dich,项目名称:K9-MailClient,代码行数:23,代码来源:MigrationTest.java

示例5: getTextFromPart

import org.openintents.openpgp.util.OpenPgpUtils; //导入依赖的package包/类
private String getTextFromPart(Part part) {
    String textFromPart = MessageExtractor.getTextFromPart(part);

    String extractedClearsignedMessage = OpenPgpUtils.extractClearsignedMessage(textFromPart);
    if (extractedClearsignedMessage != null) {
        textFromPart = extractedClearsignedMessage;
    }

    return textFromPart;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:11,代码来源:MessageViewInfoExtractor.java

示例6: toString

import org.openintents.openpgp.util.OpenPgpUtils; //导入依赖的package包/类
@Override
public String toString() {
    String out = "\nresult: " + result;
    out += "\nprimaryUserId: " + primaryUserId;
    out += "\nuserIds: " + userIds;
    out += "\nkeyId: " + OpenPgpUtils.convertKeyIdToHex(keyId);
    return out;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:9,代码来源:OpenPgpSignatureResult.java

示例7: toString

import org.openintents.openpgp.util.OpenPgpUtils; //导入依赖的package包/类
@Override
public String toString() {
    String out = "\nstatus: " + status;
    out += "\nprimaryUserId: " + primaryUserId;
    out += "\nuserIds: " + userIds;
    out += "\nsignatureOnly: " + signatureOnly;
    out += "\nkeyId: " + OpenPgpUtils.convertKeyIdToHex(keyId);
    return out;
}
 
开发者ID:juanignaciomolina,项目名称:txtr,代码行数:10,代码来源:OpenPgpSignatureResult.java

示例8: onBackendConnected

import org.openintents.openpgp.util.OpenPgpUtils; //导入依赖的package包/类
@Override
void onBackendConnected() {
	SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
	boolean useSubject = preferences.getBoolean("use_subject_in_muc", true);
	if (getIntent().getAction().equals(ACTION_VIEW_MUC)) {
		this.uuid = getIntent().getExtras().getString("uuid");
	}
	if (uuid != null) {
		for (Conversation mConv : xmppConnectionService.getConversations()) {
			if (mConv.getUuid().equals(uuid)) {
				this.conversation = mConv;
			}
		}
		if (this.conversation != null) {
			mSubject.setText(conversation.getMucOptions().getSubject());
			setTitle(conversation.getName(useSubject));
			mFullJid.setText(conversation.getContactJid().split("/")[0]);
			mYourNick.setText(conversation.getMucOptions().getNick());
			mRoleAffiliaton = (TextView) findViewById(R.id.muc_role);
			if (conversation.getMucOptions().online()) {
				mMoreDetails.setVisibility(View.VISIBLE);
				User self = conversation.getMucOptions().getSelf();
				switch (self.getAffiliation()) {
				case User.AFFILIATION_ADMIN:
					mRoleAffiliaton.setText(getReadableRole(self.getRole())
							+ " (" + getString(R.string.admin) + ")");
					break;
				case User.AFFILIATION_OWNER:
					mRoleAffiliaton.setText(getReadableRole(self.getRole())
							+ " (" + getString(R.string.owner) + ")");
					break;
				default:
					mRoleAffiliaton
							.setText(getReadableRole(self.getRole()));
					break;
				}
			}
			this.users.clear();
			this.users.addAll(conversation.getMucOptions().getUsers());
			LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			membersView.removeAllViews();
			for(final User contact : conversation.getMucOptions().getUsers()) {
				View view = (View) inflater.inflate(R.layout.contact, null);
				TextView displayName = (TextView) view.findViewById(R.id.contact_display_name);
				TextView key = (TextView) view.findViewById(R.id.key);
				displayName.setText(contact.getName());
				TextView role = (TextView) view.findViewById(R.id.contact_jid);
				role.setText(getReadableRole(contact.getRole()));
				if (contact.getPgpKeyId()!=0) {
					key.setVisibility(View.VISIBLE);
					key.setOnClickListener(new OnClickListener() {
						
						@Override
						public void onClick(View v) {
							PgpEngine pgp = xmppConnectionService.getPgpEngine();
							if (pgp!=null) {
								PendingIntent intent = pgp.getIntentForKey(conversation.getAccount(), contact.getPgpKeyId());
								if (intent!=null) {
									try {
										startIntentSenderForResult(intent.getIntentSender(), 0, null, 0, 0, 0);
									} catch (SendIntentException e) {
										
									}
								}
							}
						}
					});
					key.setText(OpenPgpUtils.convertKeyIdToHex(contact.getPgpKeyId()));
				}
				ImageView imageView = (ImageView) view
						.findViewById(R.id.contact_photo);
				imageView.setImageBitmap(UIHelper.getContactPicture(contact.getName(), 48,this.getApplicationContext(), false));
				membersView.addView(view);
			}
		}
	} else {
		Log.d("xmppService","uuid in muc details was null");
	}
}
 
开发者ID:GitESS,项目名称:SyncChatAndroid,代码行数:80,代码来源:MucDetailsActivity.java

示例9: isAvailable

import org.openintents.openpgp.util.OpenPgpUtils; //导入依赖的package包/类
public static boolean isAvailable(Context context)
{
    if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD)
        return OpenPgpUtils.isAvailable(context);
    return false;
}
 
开发者ID:jensstein,项目名称:oandbackup,代码行数:7,代码来源:Crypto.java


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