Search in sources :

Example 1 with SignedPublicKeySelfCertification

use of co.krypt.krypton.pgp.publickey.SignedPublicKeySelfCertification in project krypton-android by kryptco.

the class PGPPublicKey method serialize.

@Override
public void serialize(DataOutputStream out) throws IOException {
    publicKeyPacket.serialize(out);
    for (SignedPublicKeySelfCertification identity : signedIdentities) {
        identity.certification.userIDPacket.serialize(out);
        identity.signature.serialize(out);
    }
}
Also used : SignedPublicKeySelfCertification(co.krypt.krypton.pgp.publickey.SignedPublicKeySelfCertification)

Example 2 with SignedPublicKeySelfCertification

use of co.krypt.krypton.pgp.publickey.SignedPublicKeySelfCertification in project krypton-android by kryptco.

the class Notifications method notifyPGPKeyExportJob.

private static void notifyPGPKeyExportJob(Context context, PGPPublicKey pubkey) {
    Intent clickIntent = new Intent(context, MainActivity.class);
    if (new OnboardingProgress(context).inProgress()) {
        clickIntent.setClass(context, OnboardingActivity.class);
    }
    clickIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
    PendingIntent clickPendingIntent = PendingIntent.getActivity(context, ("CLICK-PGPPUBKEY").hashCode(), clickIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    String userIDs = "";
    for (SignedPublicKeySelfCertification signedIdentity : pubkey.signedIdentities) {
        userIDs += signedIdentity.certification.userIDPacket.userID.toString() + "\n";
    }
    NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
    inboxStyle.setBigContentTitle("Exported PGP Public Key");
    for (SignedPublicKeySelfCertification signedIdentity : pubkey.signedIdentities) {
        inboxStyle.addLine(signedIdentity.certification.userIDPacket.userID.toString());
    }
    NotificationCompat.Builder mBuilder = buildNotification(context, APPROVED_CHANNEL_ID).setContentTitle("Exported PGP Public Key").setContentText(userIDs.trim()).setColor(ContextCompat.getColor(context, R.color.colorPrimary)).setPriority(NotificationCompat.PRIORITY_MAX).setCategory(NotificationCompat.CATEGORY_MESSAGE).setVisibility(NotificationCompat.VISIBILITY_PUBLIC).setContentIntent(clickPendingIntent).setAutoCancel(true).setStyle(inboxStyle);
    if (!new Settings(context).silenceNotifications()) {
        mBuilder.setDefaults(Notification.DEFAULT_SOUND).setVibrate(new long[] { 0, 100, 100, 100 });
    }
    NotificationManagerCompat mNotifyMgr = NotificationManagerCompat.from(context);
    mNotifyMgr.notify(1, mBuilder.build());
}
Also used : NotificationManagerCompat(android.support.v4.app.NotificationManagerCompat) NotificationCompat(android.support.v4.app.NotificationCompat) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) PendingIntent(android.app.PendingIntent) OnboardingProgress(co.krypt.krypton.onboarding.OnboardingProgress) SignedPublicKeySelfCertification(co.krypt.krypton.pgp.publickey.SignedPublicKeySelfCertification) Settings(co.krypt.krypton.settings.Settings)

Aggregations

SignedPublicKeySelfCertification (co.krypt.krypton.pgp.publickey.SignedPublicKeySelfCertification)2 PendingIntent (android.app.PendingIntent)1 Intent (android.content.Intent)1 NotificationCompat (android.support.v4.app.NotificationCompat)1 NotificationManagerCompat (android.support.v4.app.NotificationManagerCompat)1 OnboardingProgress (co.krypt.krypton.onboarding.OnboardingProgress)1 Settings (co.krypt.krypton.settings.Settings)1