本文整理汇总了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));
}
示例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));
}
示例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));
}
示例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));
}
示例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;
}
示例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;
}
示例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;
}
示例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");
}
}
示例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;
}