From a21c633f48918796c27a1d1c92fe9e6599926435 Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Thu, 11 Jun 2015 13:05:48 +0200 Subject: [PATCH] some needed types --- src/org/pEp/jniadapter/Blob.java | 8 ++ src/org/pEp/jniadapter/CommType.java | 67 +++++++++++++++ src/org/pEp/jniadapter/Identity.java | 15 ++++ src/org/pEp/jniadapter/MimeMessage.java | 103 ++++++++++++++++++++++++ src/org/pEp/jniadapter/Pair.java | 7 ++ 5 files changed, 200 insertions(+) create mode 100644 src/org/pEp/jniadapter/Blob.java create mode 100644 src/org/pEp/jniadapter/CommType.java create mode 100644 src/org/pEp/jniadapter/Identity.java create mode 100644 src/org/pEp/jniadapter/MimeMessage.java create mode 100644 src/org/pEp/jniadapter/Pair.java diff --git a/src/org/pEp/jniadapter/Blob.java b/src/org/pEp/jniadapter/Blob.java new file mode 100644 index 0000000..3be5ae4 --- /dev/null +++ b/src/org/pEp/jniadapter/Blob.java @@ -0,0 +1,8 @@ +package org.pEp.jniadapter; + +public class Blob { + public byte[] data; + public String mime_type; + public String filename; +} + diff --git a/src/org/pEp/jniadapter/CommType.java b/src/org/pEp/jniadapter/CommType.java new file mode 100644 index 0000000..8cb144e --- /dev/null +++ b/src/org/pEp/jniadapter/CommType.java @@ -0,0 +1,67 @@ +package org.pEp.jniadapter; + +public enum CommType { + PEP_ct_unknown (0), + + // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable + + PEP_ct_no_encryption (0x01), // generic + PEP_ct_no_encrypted_channel (0x02), + PEP_ct_key_not_found (0x03), + PEP_ct_key_expired (0x04), + PEP_ct_key_revoked (0x05), + PEP_ct_key_b0rken (0x06), + PEP_ct_my_key_not_included (0x09), + + PEP_ct_security_by_obscurity (0x0a), + PEP_ct_b0rken_crypto (0x0b), + PEP_ct_key_too_short (0x0e), + + PEP_ct_compromized (0x0f), // known compromized connection + + // range 0x10 to 0x3f: unconfirmed encryption + + PEP_ct_unconfirmed_encryption (0x10), // generic + PEP_ct_OpenPGP_weak_unconfirmed (0x11), // RSA 1024 is weak + + PEP_ct_to_be_checked (0x20), // generic + PEP_ct_SMIME_unconfirmed (0x21), + PEP_ct_CMS_unconfirmed (0x22), + + PEP_ct_strong_but_unconfirmed (0x30), // generic + PEP_ct_OpenPGP_unconfirmed (0x38), // key at least 2048 bit RSA or EC + PEP_ct_OTR_unconfirmed (0x3a), + + // range 0x40 to 0x7f: unconfirmed encryption and anonymization + + PEP_ct_unconfirmed_enc_anon (0x40), // generic + PEP_ct_PEP_unconfirmed (0x7f), + + PEP_ct_confirmed (0x80), // this bit decides if trust is confirmed + + // range 0x81 to 0x8f: reserved + // range 0x90 to 0xbf: confirmed encryption + + PEP_ct_confirmed_encryption (0x90), // generic + PEP_ct_OpenPGP_weak (0x91), // RSA 1024 is weak + + PEP_ct_to_be_checked_confirmed (0xa0), //generic + PEP_ct_SMIME (0xa1), + PEP_ct_CMS (0xa2), + + PEP_ct_strong_encryption (0xb0), // generic + PEP_ct_OpenPGP (0xb8), // key at least 2048 bit RSA or EC + PEP_ct_OTR (0xba), + + // range 0xc0 to 0xff: confirmed encryption and anonymization + + PEP_ct_confirmed_enc_anon (0xc0), // generic + PEP_ct_pEp (0xff); + + public final int value; + + CommType(int value) { + this.value = value; + } +} + diff --git a/src/org/pEp/jniadapter/Identity.java b/src/org/pEp/jniadapter/Identity.java new file mode 100644 index 0000000..c544f86 --- /dev/null +++ b/src/org/pEp/jniadapter/Identity.java @@ -0,0 +1,15 @@ +package org.pEp.jniadapter; + +public class Identity { + public String address; + public String fpr; + public String user_id; + public String username; + CommType comm_type; + public String lang; + private boolean me; + + public Identity() { this.me = false; } + public Identity(boolean me) { this.me = me; } +} + diff --git a/src/org/pEp/jniadapter/MimeMessage.java b/src/org/pEp/jniadapter/MimeMessage.java new file mode 100644 index 0000000..a445a77 --- /dev/null +++ b/src/org/pEp/jniadapter/MimeMessage.java @@ -0,0 +1,103 @@ +package org.pEp.jniadapter; + +import java.util.Date; + +public class MimeMessage { + public enum TextFormat { + plain (0), + html (1), + other (255); + + public final int value; + + TextFormat(int value) { + this.value = value; + } + } + + public enum Direction { + incoming (0), + outgoing (1); + + public final int value; + + Direction(int value) { + this.value = value; + } + } + + public enum EncFormat { + none (0), + pieces (1), + S_MIME (2), + PGP_MIME (3), + PEP (4); + + public final int value; + + EncFormat(int value) { + this.value = value; + } + } + + public native Direction dir(); + public native void dir(Direction value); + + public native String id(); + public native void id(String value); + + public native String shortmsg(); + public native void shortmsg(String value); + + public native String longmsg(); + public native void longmsg(String value); + + public native String longmsg_formatted(); + public native void longmsg_formatted(String value); + + public native Blob[] attachments(); + public native void attachments(Blob[] value); + + public native Date sent(); + public native void sent(Date value); + + public native Date recv(); + public native void recv(Date value); + + public native Identity from(); + public native void from(Identity value); + + public native Identity[] to(); + public native void to(Identity[] value); + + public native Identity recv_by(); + public native void recv_by(Identity value); + + public native Identity[] cc(); + public native void cc(Identity[] value); + + public native Identity[] bcc(); + public native void bcc(Identity[] value); + + public native Identity[] reply_to(); + public native void reply_to(Identity[] value); + + public native String[] in_reply_to(); + public native void in_reply_to(String[] value); + + public native String[] references(); + public native void references(String[] value); + + public native String[] keywords(); + public native void keywords(String[] value); + + public native String comments(); + public native void comments(String value); + + public native Pair[] opt_fields(); + public native void opt_fields(Pair[] value); + + public native EncFormat enc_format(); + public native void enc_format(EncFormat value); +} + diff --git a/src/org/pEp/jniadapter/Pair.java b/src/org/pEp/jniadapter/Pair.java new file mode 100644 index 0000000..9ea7d57 --- /dev/null +++ b/src/org/pEp/jniadapter/Pair.java @@ -0,0 +1,7 @@ +package org.pEp.jniadapter; + +public class Pair { + private F first; + private S second; +} +