hs = new HashSet<>();
101 | hs.add(RIJNDAEL_CIPHER);// AES
102 | hs.add(TWOFISH_CIPHER);
103 | hs.add(NULL_CIPHER);
104 |
105 | return Collections.unmodifiableSet(hs);
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/gnu/crypto/mode/ECB.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2001, 2002 Free Software Foundation, Inc.
3 | *
4 | * This file is part of GNU Crypto.
5 | *
6 | * GNU Crypto is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 2, or (at your option)
9 | * any later version.
10 | *
11 | * GNU Crypto is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program; see the file COPYING. If not, write to the
18 | *
19 | * Free Software Foundation Inc.,
20 | * 59 Temple Place - Suite 330,
21 | * Boston, MA 02111-1307
22 | * USA
23 | *
24 | * Linking this library statically or dynamically with other modules is
25 | * making a combined work based on this library. Thus, the terms and
26 | * conditions of the GNU General Public License cover the whole
27 | * combination.
28 | *
29 | * As a special exception, the copyright holders of this library give
30 | * you permission to link this library with independent modules to
31 | * produce an executable, regardless of the license terms of these
32 | * independent modules, and to copy and distribute the resulting
33 | * executable under terms of your choice, provided that you also meet,
34 | * for each linked independent module, the terms and conditions of the
35 | * license of that module. An independent module is a module which is
36 | * not derived from or based on this library. If you modify this
37 | * library, you may extend this exception to your version of the
38 | * library, but you are not obligated to do so. If you do not wish to
39 | * do so, delete this exception statement from your version.
40 | **/
41 | package gnu.crypto.mode;
42 |
43 | import gnu.crypto.Registry;
44 | import gnu.crypto.cipher.IBlockCipher;
45 |
46 | /*
47 | * The implementation of the Electronic Codebook mode.
48 | *
49 | * The Electronic Codebook (ECB) mode is a confidentiality mode that is
50 | * defined as follows:
51 | *
52 | *
53 | * - ECB Encryption: Cj = CIPHK(Pj) for j = 1...n
54 | * - ECB Decryption: Pj = CIPH-1K(Cj) for j = 1...n
55 | *
56 | *
57 | * In ECB encryption, the forward cipher function is applied directly, and
58 | * independently, to each block of the plaintext. The resulting sequence of
59 | * output blocks is the ciphertext.
60 | *
61 | * In ECB decryption, the inverse cipher function is applied directly, and
62 | * independently, to each block of the ciphertext. The resulting sequence of
63 | * output blocks is the plaintext.
64 | *
65 | * References:
66 | *
67 | *
68 | * -
69 | * Recommendation for Block Cipher Modes of Operation Methods and Techniques,
70 | * Morris Dworkin.
71 | *
72 | *
73 | * @version $Revision: 1.5 $
74 | **/
75 | public class ECB extends BaseMode implements Cloneable {
76 |
77 | /**
78 | * Trivial package-private constructor for use by the Factory class.
79 | *
80 | * @param underlyingCipher the underlying cipher implementation.
81 | * @param cipherBlockSize the underlying cipher block size to use.
82 | */
83 | ECB(IBlockCipher underlyingCipher, int cipherBlockSize) {
84 | super(Registry.ECB_MODE, underlyingCipher, cipherBlockSize);
85 | }
86 |
87 | /**
88 | * Private constructor for cloning purposes.
89 | *
90 | * @param that the mode to clone.
91 | */
92 | private ECB(ECB that) {
93 | this((IBlockCipher) that.cipher.clone(), that.cipherBlockSize);
94 | }
95 |
96 | public Object clone() {
97 | return new ECB(this);
98 | }
99 |
100 | public void setup() {
101 | if (modeBlockSize != cipherBlockSize) {
102 | throw new IllegalArgumentException(IMode.MODE_BLOCK_SIZE);
103 | }
104 | }
105 |
106 | public void teardown() {
107 | }
108 |
109 | public void encryptBlock(byte[] in, int i, byte[] out, int o) {
110 | cipher.encryptBlock(in, i, out, o);
111 | }
112 |
113 | public void decryptBlock(byte[] in, int i, byte[] out, int o) {
114 | cipher.decryptBlock(in, i, out, o);
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/gnu/crypto/pad/BasePad.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
3 | *
4 | * This file is part of GNU Crypto.
5 | *
6 | * GNU Crypto is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 2, or (at your option)
9 | * any later version.
10 | *
11 | * GNU Crypto is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program; see the file COPYING. If not, write to the
18 | *
19 | * Free Software Foundation Inc.,
20 | * 59 Temple Place - Suite 330,
21 | * Boston, MA 02111-1307
22 | * USA
23 | *
24 | * Linking this library statically or dynamically with other modules is
25 | * making a combined work based on this library. Thus, the terms and
26 | * conditions of the GNU General Public License cover the whole
27 | * combination.
28 | *
29 | * As a special exception, the copyright holders of this library give
30 | * you permission to link this library with independent modules to
31 | * produce an executable, regardless of the license terms of these
32 | * independent modules, and to copy and distribute the resulting
33 | * executable under terms of your choice, provided that you also meet,
34 | * for each linked independent module, the terms and conditions of the
35 | * license of that module. An independent module is a module which is
36 | * not derived from or based on this library. If you modify this
37 | * library, you may extend this exception to your version of the
38 | * library, but you are not obligated to do so. If you do not wish to
39 | * do so, delete this exception statement from your version.
40 | *
41 | **/
42 | package gnu.crypto.pad;
43 |
44 | /*
45 | * An abstract class to facilitate implementing padding algorithms.
46 | *
47 | * @version $Revision: 1.5 $
48 | **/
49 | public abstract class BasePad implements IPad {
50 |
51 | // The canonical name prefix of the padding algorithm.
52 | protected String name;
53 |
54 | // The block size, in bytes, for this instance.
55 | protected int blockSize;
56 |
57 | protected BasePad(final String name) {
58 | super();
59 |
60 | this.name = name;
61 | blockSize = -1;
62 | }
63 |
64 | public String name() {
65 | final StringBuilder sb = new StringBuilder(name);
66 | if (blockSize != -1) {
67 | sb.append('-').append(8*blockSize);
68 | }
69 | return sb.toString();
70 | }
71 |
72 | public void init(final int bs) throws IllegalStateException {
73 | if (blockSize != -1) {
74 | throw new IllegalStateException();
75 | }
76 | blockSize = bs;
77 | setup();
78 | }
79 |
80 | public void reset() {
81 | blockSize = -1;
82 | }
83 |
84 | public boolean selfTest() {
85 | byte[] padBytes;
86 | final int offset = 5;
87 | final int limit = 1024;
88 | final byte[] in = new byte[limit];
89 | for (int bs = 2; bs < 256; bs++) {
90 | this.init(bs);
91 | for (int i = 0; i < limit-offset-blockSize; i++) {
92 | padBytes = pad(in, offset, i);
93 | if (((i + padBytes.length) % blockSize) != 0) {
94 | new RuntimeException(name()).printStackTrace(System.err);
95 | return false;
96 | }
97 |
98 | System.arraycopy(padBytes, 0, in, offset+i, padBytes.length);
99 | try {
100 | if (padBytes.length != unpad(in, offset, i+padBytes.length)) {
101 | new RuntimeException(name()).printStackTrace(System.err);
102 | return false;
103 | }
104 | } catch (Exception x) {
105 | x.printStackTrace(System.err);
106 | return false;
107 | }
108 | }
109 | this.reset();
110 | }
111 |
112 | return true;
113 | }
114 |
115 | /**
116 | * If any additional checks or resource setup must be done by the
117 | * subclass, then this is the hook for it. This method will be called before
118 | * the {@link #init(int)} method returns.
119 | */
120 | public abstract void setup();
121 |
122 | public abstract byte[] pad(byte[] in, int off, int len);
123 |
124 | public abstract int unpad(byte[] in, int off, int len) throws Exception;
125 | }
126 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/gnu/crypto/pad/IPad.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2001, 2002, Free Software Foundation, Inc.
3 | *
4 | * This file is part of GNU Crypto.
5 | *
6 | * GNU Crypto is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 2, or (at your option)
9 | * any later version.
10 | *
11 | * GNU Crypto is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program; see the file COPYING. If not, write to the
18 | *
19 | * Free Software Foundation Inc.,
20 | * 59 Temple Place - Suite 330,
21 | * Boston, MA 02111-1307
22 | * USA
23 | *
24 | * Linking this library statically or dynamically with other modules is
25 | * making a combined work based on this library. Thus, the terms and
26 | * conditions of the GNU General Public License cover the whole
27 | * combination.
28 | *
29 | * As a special exception, the copyright holders of this library give
30 | * you permission to link this library with independent modules to
31 | * produce an executable, regardless of the license terms of these
32 | * independent modules, and to copy and distribute the resulting
33 | * executable under terms of your choice, provided that you also meet,
34 | * for each linked independent module, the terms and conditions of the
35 | * license of that module. An independent module is a module which is
36 | * not derived from or based on this library. If you modify this
37 | * library, you may extend this exception to your version of the
38 | * library, but you are not obligated to do so. If you do not wish to
39 | * do so, delete this exception statement from your version.
40 | **/
41 | package gnu.crypto.pad;
42 |
43 | /*
44 | * The basic visible methods of any padding algorithm.
45 | *
46 | * Padding algorithms serve to pad and unpad byte arrays usually
47 | * as the last step in an encryption or respectively a decryption
48 | * operation. Their input buffers are usually those processed by instances of
49 | * {@link gnu.crypto.mode.IMode} and/or {@link gnu.crypto.cipher.IBlockCipher}.
50 | *
51 | * @version $Revision: 1.3 $
52 | **/
53 | public interface IPad {
54 |
55 | /** @return the canonical name of this instance. */
56 | String name();
57 |
58 | /**
59 | * Initialises the padding scheme with a designated block size.
60 | *
61 | * @param bs the designated block size.
62 | * @exception IllegalStateException if the instance is already initialised.
63 | * @exception IllegalArgumentException if the block size value is invalid.
64 | */
65 | void init(int bs) throws IllegalStateException;
66 |
67 | /**
68 | * Returns the byte sequence that should be appended to the designated input.
69 | *
70 | * @param in the input buffer containing the bytes to pad.
71 | * @param offset the starting index of meaningful data in in.
72 | * @param length the number of meaningful bytes in in.
73 | * @return the possibly 0-byte long sequence to be appended to the designated
74 | * input.
75 | */
76 | byte[] pad(byte[] in, int offset, int length);
77 |
78 | /**
79 | * Returns the number of bytes to discard from a designated input buffer.
80 | *
81 | * @param in the input buffer containing the bytes to unpad.
82 | * @param offset the starting index of meaningful data in in.
83 | * @param length the number of meaningful bytes in in.
84 | * @return the number of bytes to discard, to the left of index position
85 | * offset + length in in. In other words, if the return
86 | * value of a successful invocation of this method is result, then
87 | * the unpadded byte sequence will be offset + length - result bytes
88 | * in in, starting from index position offset.
89 | * @exception Exception if the data is not terminated with the
90 | * expected padding bytes.
91 | */
92 | int unpad(byte[] in, int offset, int length) throws Exception;
93 |
94 | /**
95 | * Resets the scheme instance for re-initialisation and use with other
96 | * characteristics. This method always succeeds.
97 | */
98 | void reset();
99 |
100 | /**
101 | * A basic symmetric pad/unpad test.
102 | *
103 | * @return true if the implementation passes a basic symmetric
104 | * self-test. Returns false otherwise.
105 | */
106 | boolean selfTest();
107 | }
108 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/gnu/crypto/pad/PKCS7.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2001, 2002 Free Software Foundation, Inc.
3 | *
4 | * This file is part of GNU Crypto.
5 | *
6 | * GNU Crypto is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 2, or (at your option)
9 | * any later version.
10 | *
11 | * GNU Crypto is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program; see the file COPYING. If not, write to the
18 | *
19 | * Free Software Foundation Inc.,
20 | * 59 Temple Place - Suite 330,
21 | * Boston, MA 02111-1307
22 | * USA
23 | *
24 | * Linking this library statically or dynamically with other modules is
25 | * making a combined work based on this library. Thus, the terms and
26 | * conditions of the GNU General Public License cover the whole
27 | * combination.
28 | *
29 | * As a special exception, the copyright holders of this library give
30 | * you permission to link this library with independent modules to
31 | * produce an executable, regardless of the license terms of these
32 | * independent modules, and to copy and distribute the resulting
33 | * executable under terms of your choice, provided that you also meet,
34 | * for each linked independent module, the terms and conditions of the
35 | * license of that module. An independent module is a module which is
36 | * not derived from or based on this library. If you modify this
37 | * library, you may extend this exception to your version of the
38 | * library, but you are not obligated to do so. If you do not wish to
39 | * do so, delete this exception statement from your version.
40 | **/
41 | package gnu.crypto.pad;
42 |
43 | import gnu.crypto.Registry;
44 |
45 | /*
46 | * The implementation of the PKCS7 padding algorithm.
47 | *
48 | * This algorithm is described for 8-byte blocks in [RFC-1423] and extended to
49 | * block sizes of up to 256 bytes in [PKCS-7].
50 | *
51 | * References:
52 | * RFC-1423: Privacy
53 | * Enhancement for Internet Electronic Mail: Part III: Algorithms, Modes, and
54 | * Identifiers.
55 | * IETF.
56 | * [PKCS-7]PKCS #7:
57 | * Cryptographic Message Syntax Standard - An RSA Laboratories Technical Note.
58 | * RSA Security.
59 | *
60 | * @version $Revision: 1.4 $
61 | **/
62 | public final class PKCS7 extends BasePad {
63 |
64 | PKCS7() {
65 | super(Registry.PKCS7_PAD);
66 | }
67 |
68 | public void setup() {
69 | if (blockSize < 2 || blockSize > 256) {
70 | throw new IllegalArgumentException();
71 | }
72 | }
73 |
74 | public byte[] pad(byte[] in, int offset, int length) {
75 | int padLength = blockSize;
76 | if (length % blockSize != 0) {
77 | padLength = blockSize - length % blockSize;
78 | }
79 | byte[] result = new byte[padLength];
80 | for (int i = 0; i < padLength; ) {
81 | result[i++] = (byte) padLength;
82 | }
83 |
84 | return result;
85 | }
86 |
87 | public int unpad(byte[] in, int offset, int length) throws Exception {
88 | int limit = offset + length;
89 | int result = in[limit-1] & 0xFF;
90 | for (int i = 0; i < result; i++) {
91 | if (result != (in[--limit] & 0xFF)) {
92 | throw new Exception();
93 | }
94 | }
95 |
96 | return result;
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/gnu/crypto/pad/PadFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
3 | *
4 | * This file is part of GNU Crypto.
5 | *
6 | * GNU Crypto is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 2, or (at your option)
9 | * any later version.
10 | *
11 | * GNU Crypto is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program; see the file COPYING. If not, write to the
18 | *
19 | * Free Software Foundation Inc.,
20 | * 59 Temple Place - Suite 330,
21 | * Boston, MA 02111-1307
22 | * USA
23 | *
24 | * Linking this library statically or dynamically with other modules is
25 | * making a combined work based on this library. Thus, the terms and
26 | * conditions of the GNU General Public License cover the whole
27 | * combination.
28 | *
29 | * As a special exception, the copyright holders of this library give
30 | * you permission to link this library with independent modules to
31 | * produce an executable, regardless of the license terms of these
32 | * independent modules, and to copy and distribute the resulting
33 | * executable under terms of your choice, provided that you also meet,
34 | * for each linked independent module, the terms and conditions of the
35 | * license of that module. An independent module is a module which is
36 | * not derived from or based on this library. If you modify this
37 | * library, you may extend this exception to your version of the
38 | * library, but you are not obligated to do so. If you do not wish to
39 | * do so, delete this exception statement from your version.
40 | **/
41 | package gnu.crypto.pad;
42 |
43 | import gnu.crypto.Registry;
44 |
45 | import java.util.Collections;
46 | import java.util.HashSet;
47 | import java.util.Set;
48 |
49 | /*
50 | *
A Factory to instantiate padding schemes.
51 | *
52 | * @version $Revision: 1.6 $
53 | **/
54 | public class PadFactory implements Registry {
55 |
56 | private PadFactory() {
57 | super();
58 | }
59 |
60 | /**
61 | * Returns an instance of a padding algorithm given its name.
62 | *
63 | * @param pad the case-insensitive name of the padding algorithm.
64 | * @return an instance of the padding algorithm, operating with a given
65 | * block size, or null
if none found.
66 | * @throws InternalError if the implementation does not pass its self-test.
67 | */
68 | public static final IPad getInstance(String pad) {
69 | if (pad == null) {
70 | return null;
71 | }
72 |
73 | pad = pad.trim();
74 | IPad result = null;
75 | if (pad.equalsIgnoreCase(PKCS7_PAD)) {
76 | result = new PKCS7();
77 | } else if (pad.equalsIgnoreCase(TBC_PAD)) {
78 | result = new TBC();
79 | }
80 |
81 | if (result != null && !result.selfTest()) {
82 | throw new InternalError(result.name());
83 | }
84 |
85 | return result;
86 | }
87 |
88 | /**
89 | * Returns a {@link Set} of names of padding algorithms
90 | * supported by this Factory.
91 | *
92 | * @return a {@link Set} of padding algorithm names (Strings).
93 | */
94 | public static final Set getNames() {
95 | HashSet hs = new HashSet<>();
96 | hs.add(PKCS7_PAD);
97 | hs.add(TBC_PAD);
98 |
99 | return Collections.unmodifiableSet(hs);
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/gnu/crypto/pad/TBC.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2001, 2002 Free Software Foundation, Inc.
3 | *
4 | * This file is part of GNU Crypto.
5 | *
6 | * GNU Crypto is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 2, or (at your option)
9 | * any later version.
10 | *
11 | * GNU Crypto is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program; see the file COPYING. If not, write to the
18 | *
19 | * Free Software Foundation Inc.,
20 | * 59 Temple Place - Suite 330,
21 | * Boston, MA 02111-1307
22 | * USA
23 | *
24 | * Linking this library statically or dynamically with other modules is
25 | * making a combined work based on this library. Thus, the terms and
26 | * conditions of the GNU General Public License cover the whole
27 | * combination.
28 | *
29 | * As a special exception, the copyright holders of this library give
30 | * you permission to link this library with independent modules to
31 | * produce an executable, regardless of the license terms of these
32 | * independent modules, and to copy and distribute the resulting
33 | * executable under terms of your choice, provided that you also meet,
34 | * for each linked independent module, the terms and conditions of the
35 | * license of that module. An independent module is a module which is
36 | * not derived from or based on this library. If you modify this
37 | * library, you may extend this exception to your version of the
38 | * library, but you are not obligated to do so. If you do not wish to
39 | * do so, delete this exception statement from your version.
40 | **/
41 | package gnu.crypto.pad;
42 |
43 | import gnu.crypto.Registry;
44 |
45 | /*
46 | * The implementation of the Trailing Bit Complement (TBC) padding algorithm.
47 | *
48 | * In this mode, "...the data string is padded at the trailing end with the
49 | * complement of the trailing bit of the unpadded message: if the trailing bit
50 | * is 1, then 0 bits are appended, and if the trailing bit is
51 | * 0, then 1 bits are appended. As few bits are added as are
52 | * necessary to meet the formatting size requirement."
53 | *
54 | * References:
55 | *
56 | * Recommendation for Block Cipher Modes of Operation Methods and Techniques,
57 | * Morris Dworkin.
58 | *
59 | * @version $Revision: 1.4 $
60 | **/
61 | public final class TBC extends BasePad {
62 |
63 | TBC() {
64 | super(Registry.TBC_PAD);
65 | }
66 |
67 | public void setup() {
68 | if (blockSize < 1 || blockSize > 256) {
69 | throw new IllegalArgumentException();
70 | }
71 | }
72 |
73 | public byte[] pad(byte[] in, int offset, int length) {
74 | int padLength = blockSize;
75 | if (length % blockSize != 0) {
76 | padLength = blockSize - length % blockSize;
77 | }
78 | byte[] result = new byte[padLength];
79 | int lastBit = in[offset+length-1] & 0x01;
80 | if (lastBit == 0) {
81 | for (int i = 0; i < padLength; ) {
82 | result[i++] = 0x01;
83 | }
84 | } // else it's already set to zeroes by virtue of initialisation
85 |
86 | return result;
87 | }
88 |
89 | public int unpad(byte[] in, int offset, int length) throws Exception {
90 | int limit = offset + length - 1;
91 | int lastBit = in[limit] & 0xFF;
92 | int result = 0;
93 | while (lastBit == (in[limit] & 0xFF)) {
94 | result++;
95 | limit--;
96 | }
97 |
98 | if (result > length) {
99 | throw new Exception();
100 | }
101 |
102 | return result;
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/gnu/crypto/util/Util.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
3 | *
4 | * This file is part of GNU Crypto.
5 | *
6 | * GNU Crypto is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 2, or (at your option)
9 | * any later version.
10 | *
11 | * GNU Crypto is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program; see the file COPYING. If not, write to the
18 | *
19 | * Free Software Foundation Inc.,
20 | * 59 Temple Place - Suite 330,
21 | * Boston, MA 02111-1307
22 | * USA
23 | *
24 | * Linking this library statically or dynamically with other modules is
25 | * making a combined work based on this library. Thus, the terms and
26 | * conditions of the GNU General Public License cover the whole
27 | * combination.
28 | *
29 | * As a special exception, the copyright holders of this library give
30 | * you permission to link this library with independent modules to
31 | * produce an executable, regardless of the license terms of these
32 | * independent modules, and to copy and distribute the resulting
33 | * executable under terms of your choice, provided that you also meet,
34 | * for each linked independent module, the terms and conditions of the
35 | * license of that module. An independent module is a module which is
36 | * not derived from or based on this library. If you modify this
37 | * library, you may extend this exception to your version of the
38 | * library, but you are not obligated to do so. If you do not wish to
39 | * do so, delete this exception statement from your version.
40 | **/
41 | package gnu.crypto.util;
42 |
43 | /*
44 | *
A collection of utility methods used throughout this project.
45 | *
46 | * @version $Revision: 1.10 $
47 | **/
48 | public class Util {
49 |
50 | private Util() {
51 | super();
52 | }
53 |
54 | /**
55 | * Returns a byte array from a string of hexadecimal digits.
56 | *
57 | * @param s a string of hexadecimal ASCII characters
58 | * @return the decoded byte array from the input hexadecimal string.
59 | */
60 | public static byte[] toBytesFromString(String s) {
61 | int limit = s.length();
62 | byte[] result = new byte[((limit + 1) / 2)];
63 | int i = 0, j = 0;
64 | if ((limit % 2) == 1) {
65 | result[j++] = (byte) fromDigit(s.charAt(i++));
66 | }
67 | while (i < limit) {
68 | result[j ] = (byte) (fromDigit(s.charAt(i++)) << 4);
69 | result[j++] |= (byte) fromDigit(s.charAt(i++));
70 | }
71 | return result;
72 | }
73 |
74 | /**
75 | * Returns a number from 0
to 15
corresponding
76 | * to the designated hexadecimal digit.
77 | *
78 | * @param c a hexadecimal ASCII symbol.
79 | */
80 | public static int fromDigit(char c) {
81 | if (c >= '0' && c <= '9') {
82 | return c - '0';
83 | } else if (c >= 'A' && c <= 'F') {
84 | return c - 'A' + 10;
85 | } else if (c >= 'a' && c <= 'f') {
86 | return c - 'a' + 10;
87 | } else throw new IllegalArgumentException("Invalid hexadecimal digit: " + c);
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/net/inbox/InboxList.java:
--------------------------------------------------------------------------------
1 | /*
2 | * InboxPager, an android email client.
3 | * Copyright (C) 2016-2024 ITPROJECTS
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | **/
17 | package net.inbox;
18 |
19 | import android.content.Context;
20 | import android.view.LayoutInflater;
21 | import android.view.View;
22 | import android.view.ViewGroup;
23 | import android.widget.BaseAdapter;
24 | import android.widget.TextView;
25 |
26 | import net.inbox.pager.R;
27 |
28 | import java.util.ArrayList;
29 |
30 | public class InboxList extends BaseAdapter {
31 |
32 | private Context ctx;
33 | private ArrayList inboxes;
34 |
35 | InboxList(Context ctx, ArrayList inboxes) {
36 | this.ctx = ctx;
37 | this.inboxes = inboxes;
38 | }
39 |
40 | @Override
41 | public int getCount() {
42 | return inboxes.size();
43 | }
44 |
45 | @Override
46 | public Object getItem(int position) {
47 | return inboxes.get(position);
48 | }
49 |
50 | @Override
51 | public long getItemId(int position) {
52 | return position;
53 | }
54 |
55 | @Override
56 | public View getView(int position, View v, ViewGroup parent) {
57 | if (v == null) {
58 | v = (LayoutInflater.from(this.ctx)).inflate(R.layout.inbox_list_row, parent, false);
59 | }
60 |
61 | InboxListItem itm = (InboxListItem) getItem(position);
62 | TextView tv_title = v.findViewById(R.id.inbox_list_title);
63 | tv_title.setText(itm.get_inbox());
64 | TextView tv_count = v.findViewById(R.id.inbox_list_count);
65 | if (Integer.parseInt(itm.get_count()) < 1) {
66 | tv_count.setVisibility(View.GONE);
67 | } else {
68 | tv_count.setVisibility(View.VISIBLE);
69 | }
70 |
71 | tv_count.setText(itm.get_count());
72 |
73 | return v;
74 | }
75 | }
76 |
77 | class InboxListItem {
78 |
79 | private int id;
80 | private String inbox_name;
81 | private String count;
82 |
83 | InboxListItem(int i, String si, int ic) {
84 | this.id = i;
85 | this.inbox_name = si;
86 | set_count(ic);
87 | }
88 |
89 | public int get_id() {
90 | return id;
91 | }
92 |
93 | String get_inbox() {
94 | return inbox_name;
95 | }
96 |
97 | String get_count() {
98 | return count;
99 | }
100 |
101 | void set_count(int i) {
102 | if (i < 1) {
103 | count = "000";
104 | } else {
105 | if (i < 10) {
106 | count = "00" + i;
107 | } if (i > 9 && i < 100) {
108 | count = "0" + i;
109 | } else if (i > 999) {
110 | count = "+" + i;
111 | }
112 | }
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/net/inbox/Settings.java:
--------------------------------------------------------------------------------
1 | /*
2 | * InboxPager, an android email client.
3 | * Copyright (C) 2016-2024 ITPROJECTS
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | **/
17 | package net.inbox;
18 |
19 | import android.os.Bundle;
20 | import androidx.fragment.app.FragmentActivity;
21 | import android.view.WindowManager;
22 |
23 | import net.inbox.pager.R;
24 |
25 | public class Settings extends FragmentActivity {
26 |
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 |
31 | // Prevent Android Switcher leaking data via screenshots
32 | getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
33 | WindowManager.LayoutParams.FLAG_SECURE);
34 |
35 | getSupportFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
36 | }
37 |
38 | @Override
39 | public void finish() {
40 | super.finish();
41 | overridePendingTransition(R.anim.left_in, R.anim.left_out);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/net/inbox/db/Attachment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * InboxPager, an android email client.
3 | * Copyright (C) 2016-2024 ITPROJECTS
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | **/
17 | package net.inbox.db;
18 |
19 | import android.os.Parcel;
20 | import android.os.Parcelable;
21 |
22 | public class Attachment implements Parcelable {
23 |
24 | private int id = -2;
25 | private int account = -2;
26 | private int message = -2;
27 | private String imap_uid;
28 | private String pop_indx;
29 | private String mime_type;
30 | private String boundary;
31 | private String name;
32 | private String transfer_encoding;
33 | private int size;// octet = 8 bits
34 |
35 | public Attachment() {}
36 |
37 | public int get_id() {
38 | return id;
39 | }
40 |
41 | public int get_account() {
42 | return account;
43 | }
44 |
45 | public int get_message() {
46 | return message;
47 | }
48 |
49 | public String get_imap_uid() {
50 | return imap_uid;
51 | }
52 |
53 | public String get_pop_indx() {
54 | return pop_indx;
55 | }
56 |
57 | public String get_mime_type() {
58 | return mime_type;
59 | }
60 |
61 | public String get_boundary() {
62 | return boundary;
63 | }
64 |
65 | public String get_name() {
66 | return name;
67 | }
68 |
69 | public String get_transfer_encoding() {
70 | return transfer_encoding;
71 | }
72 |
73 | public int get_size() {
74 | return size;
75 | }
76 |
77 | public void set_id(int i) {
78 | id = i;
79 | }
80 |
81 | public void set_account(int i) {
82 | account = i;
83 | }
84 |
85 | public void set_message(int i) {
86 | message = i;
87 | }
88 |
89 | public void set_imap_uid(String s) {
90 | imap_uid = s;
91 | }
92 |
93 | public void set_pop_indx(String s) {
94 | pop_indx = s;
95 | }
96 |
97 | public void set_mime_type(String s) {
98 | mime_type = s;
99 | }
100 |
101 | public void set_boundary(String s) {
102 | boundary = s;
103 | }
104 |
105 | public void set_name(String s) {
106 | name = s;
107 | }
108 |
109 | public void set_transfer_encoding(String s) {
110 | transfer_encoding = s;
111 | }
112 |
113 | public void set_size(int i) {
114 | size = i;
115 | }
116 |
117 | protected Attachment(Parcel in) {
118 | id = in.readInt();
119 | account = in.readInt();
120 | message = in.readInt();
121 | imap_uid = in.readString();
122 | pop_indx = in.readString();
123 | mime_type = in.readString();
124 | boundary = in.readString();
125 | name = in.readString();
126 | transfer_encoding = in.readString();
127 | size = in.readInt();
128 | }
129 |
130 | @Override
131 | public int describeContents() {
132 | return 0;
133 | }
134 |
135 | @Override
136 | public void writeToParcel(Parcel dest, int flags) {
137 | dest.writeInt(id);
138 | dest.writeInt(account);
139 | dest.writeInt(message);
140 | dest.writeString(imap_uid);
141 | dest.writeString(pop_indx);
142 | dest.writeString(mime_type);
143 | dest.writeString(boundary);
144 | dest.writeString(name);
145 | dest.writeString(transfer_encoding);
146 | dest.writeInt(size);
147 | }
148 |
149 | @SuppressWarnings("unused")
150 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
151 | @Override
152 | public Attachment createFromParcel(Parcel in) {
153 | return new Attachment(in);
154 | }
155 |
156 | @Override
157 | public Attachment[] newArray(int size) {
158 | return new Attachment[size];
159 | }
160 | };
161 | }
162 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/net/inbox/visuals/AttachmentsList.java:
--------------------------------------------------------------------------------
1 | /*
2 | * InboxPager, an android email client.
3 | * Copyright (C) 2018-2024 ITPROJECTS
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | **/
17 | package net.inbox.visuals;
18 |
19 | import android.content.Context;
20 | import android.view.LayoutInflater;
21 | import android.view.View;
22 | import android.view.ViewGroup;
23 | import android.widget.BaseAdapter;
24 | import android.widget.RadioButton;
25 | import android.widget.TextView;
26 |
27 | import net.inbox.pager.R;
28 |
29 | import java.util.ArrayList;
30 |
31 | public class AttachmentsList extends BaseAdapter {
32 |
33 | private Context ctx;
34 | private ArrayList attachment_items;
35 |
36 | AttachmentsList(Context ctx, ArrayList attachment_items) {
37 | this.ctx = ctx;
38 | this.attachment_items = attachment_items;
39 | }
40 |
41 | @Override
42 | public int getCount() {
43 | return attachment_items.size();
44 | }
45 |
46 | @Override
47 | public Object getItem(int position) {
48 | return attachment_items.get(position);
49 | }
50 |
51 | @Override
52 | public long getItemId(int position) {
53 | return position;
54 | }
55 |
56 | @Override
57 | public View getView(int position, View v, ViewGroup parent) {
58 | if (v == null) {
59 | v = (LayoutInflater.from(this.ctx)).inflate(R.layout.folder_picker_attachment_list_row, parent, false);
60 | }
61 | final AttachmentItem itm = (AttachmentItem) getItem(position);
62 | RadioButton rb_attachments = v.findViewById(R.id.rb_attachments);
63 | rb_attachments.setChecked(itm.get_picked());
64 | TextView tv_pick_file_name = v.findViewById(R.id.attachments_name);
65 | tv_pick_file_name.setText(itm.get_file_name());
66 | TextView tv_pick_file_type = v.findViewById(R.id.attachment_type);
67 | tv_pick_file_type.setText(itm.get_file_type());
68 | if (itm.get_file_type() == null) {
69 | tv_pick_file_type.setVisibility(View.GONE);
70 | } else {
71 | tv_pick_file_type.setVisibility(View.VISIBLE);
72 | }
73 | TextView tv_pick_size = v.findViewById(R.id.attachment_size);
74 | tv_pick_size.setText(itm.get_s_file_size());
75 |
76 | return v;
77 | }
78 | }
79 |
80 | class AttachmentItem {
81 |
82 | private boolean picked = false;
83 | private int i_file_size;
84 | private String s_file_size;
85 | private String file_name;
86 | private String file_type;
87 | private String file_uuid;
88 |
89 | AttachmentItem(int i_file_size, String s_file_size, String file_name, String file_type,
90 | String file_uuid) {
91 | this.i_file_size = i_file_size;
92 | this.s_file_size = s_file_size;
93 | this.file_name = file_name;
94 | this.file_type = file_type;
95 | this.file_uuid = file_uuid;
96 | }
97 |
98 | int get_i_file_size() {
99 | return i_file_size;
100 | }
101 |
102 | String get_s_file_size() {
103 | return s_file_size;
104 | }
105 |
106 | String get_file_name() {
107 | return file_name;
108 | }
109 |
110 | String get_file_type() {
111 | return file_type;
112 | }
113 |
114 | String get_file_uuid() {
115 | return file_uuid;
116 | }
117 |
118 | boolean get_picked() {
119 | return picked;
120 | }
121 |
122 | void set_picked(boolean p) {
123 | this.picked = p;
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/org/apache/commons/codec/BinaryDecoder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.apache.commons.codec;
19 |
20 | /**
21 | * Defines common decoding methods for byte array decoders.
22 | *
23 | */
24 | public interface BinaryDecoder extends Decoder {
25 |
26 | /**
27 | * Decodes a byte array and returns the results as a byte array.
28 | *
29 | * @param source
30 | * A byte array which has been encoded with the appropriate encoder
31 | * @return a byte array that contains decoded content
32 | * @throws DecoderException
33 | * A decoder exception is thrown if a Decoder encounters a failure condition during the decode process.
34 | */
35 | byte[] decode(byte[] source) throws DecoderException;
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/org/apache/commons/codec/BinaryEncoder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.apache.commons.codec;
19 |
20 | /**
21 | * Defines common encoding methods for byte array encoders.
22 | *
23 | */
24 | public interface BinaryEncoder extends Encoder {
25 |
26 | /**
27 | * Encodes a byte array and return the encoded data as a byte array.
28 | *
29 | * @param source
30 | * Data to be encoded
31 | * @return A byte array containing the encoded data
32 | * @throws EncoderException
33 | * thrown if the Encoder encounters a failure condition during the encoding process.
34 | */
35 | byte[] encode(byte[] source) throws EncoderException;
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/org/apache/commons/codec/CharSequenceUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.apache.commons.codec;
18 |
19 | /**
20 | *
21 | * Operations on {@link CharSequence} that are {@code null} safe.
22 | *
23 | *
24 | * Copied from Apache Commons Lang r1586295 on April 10, 2014 (day of 3.3.2 release).
25 | *
26 | *
27 | * @see CharSequence
28 | * @since 1.10
29 | */
30 | public class CharSequenceUtils {
31 |
32 | /**
33 | * Green implementation of regionMatches.
34 | *
35 | * @param cs
36 | * the {@code CharSequence} to be processed
37 | * @param ignoreCase
38 | * whether or not to be case insensitive
39 | * @param thisStart
40 | * the index to start on the {@code cs} CharSequence
41 | * @param substring
42 | * the {@code CharSequence} to be looked for
43 | * @param start
44 | * the index to start on the {@code substring} CharSequence
45 | * @param length
46 | * character length of the region
47 | * @return whether the region matched
48 | */
49 | public static boolean regionMatches(final CharSequence cs, final boolean ignoreCase, final int thisStart,
50 | final CharSequence substring, final int start, final int length) {
51 | if (cs instanceof String && substring instanceof String) {
52 | return ((String) cs).regionMatches(ignoreCase, thisStart, (String) substring, start, length);
53 | }
54 | int index1 = thisStart;
55 | int index2 = start;
56 | int tmpLen = length;
57 |
58 | while (tmpLen-- > 0) {
59 | final char c1 = cs.charAt(index1++);
60 | final char c2 = substring.charAt(index2++);
61 |
62 | if (c1 == c2) {
63 | continue;
64 | }
65 |
66 | if (!ignoreCase) {
67 | return false;
68 | }
69 |
70 | // The same check as in String.regionMatches():
71 | if (Character.toUpperCase(c1) != Character.toUpperCase(c2) &&
72 | Character.toLowerCase(c1) != Character.toLowerCase(c2)) {
73 | return false;
74 | }
75 | }
76 |
77 | return true;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/org/apache/commons/codec/Decoder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.apache.commons.codec;
19 |
20 | /**
21 | * Provides the highest level of abstraction for Decoders.
22 | *
23 | * This is the sister interface of {@link Encoder}. All Decoders implement this common generic interface.
24 | * Allows a user to pass a generic Object to any Decoder implementation in the codec package.
25 | *
26 | * One of the two interfaces at the center of the codec package.
27 | *
28 | */
29 | public interface Decoder {
30 |
31 | /**
32 | * Decodes an "encoded" Object and returns a "decoded" Object. Note that the implementation of this interface will
33 | * try to cast the Object parameter to the specific type expected by a particular Decoder implementation. If a
34 | * {@link ClassCastException} occurs this decode method will throw a DecoderException.
35 | *
36 | * @param source
37 | * the object to decode
38 | * @return a 'decoded" object
39 | * @throws DecoderException
40 | * a decoder exception can be thrown for any number of reasons. Some good candidates are that the
41 | * parameter passed to this method is null, a param cannot be cast to the appropriate type for a
42 | * specific encoder.
43 | */
44 | Object decode(Object source) throws DecoderException;
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/org/apache/commons/codec/DecoderException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.apache.commons.codec;
19 |
20 | /**
21 | * Thrown when there is a failure condition during the decoding process. This exception is thrown when a {@link Decoder}
22 | * encounters a decoding specific exception such as invalid data, or characters outside of the expected range.
23 | *
24 | */
25 | public class DecoderException extends Exception {
26 |
27 | /**
28 | * Declares the Serial Version Uid.
29 | *
30 | * @see Always Declare Serial Version Uid
31 | */
32 | private static final long serialVersionUID = 1L;
33 |
34 | /**
35 | * Constructs a new exception with {@code null} as its detail message. The cause is not initialized, and may
36 | * subsequently be initialized by a call to {@link #initCause}.
37 | *
38 | * @since 1.4
39 | */
40 | public DecoderException() {
41 | super();
42 | }
43 |
44 | /**
45 | * Constructs a new exception with the specified detail message. The cause is not initialized, and may subsequently
46 | * be initialized by a call to {@link #initCause}.
47 | *
48 | * @param message
49 | * The detail message which is saved for later retrieval by the {@link #getMessage()} method.
50 | */
51 | public DecoderException(final String message) {
52 | super(message);
53 | }
54 |
55 | /**
56 | * Constructs a new exception with the specified detail message and cause.
57 | *
58 | * Note that the detail message associated with {@code cause} is not automatically incorporated into this
59 | * exception's detail message.
60 | *
61 | * @param message
62 | * The detail message which is saved for later retrieval by the {@link #getMessage()} method.
63 | * @param cause
64 | * The cause which is saved for later retrieval by the {@link #getCause()} method. A {@code null}
65 | * value is permitted, and indicates that the cause is nonexistent or unknown.
66 | * @since 1.4
67 | */
68 | public DecoderException(final String message, final Throwable cause) {
69 | super(message, cause);
70 | }
71 |
72 | /**
73 | * Constructs a new exception with the specified cause and a detail message of (cause==null ?
74 | * null : cause.toString())
(which typically contains the class and detail message of {@code cause}).
75 | * This constructor is useful for exceptions that are little more than wrappers for other throwables.
76 | *
77 | * @param cause
78 | * The cause which is saved for later retrieval by the {@link #getCause()} method. A {@code null}
79 | * value is permitted, and indicates that the cause is nonexistent or unknown.
80 | * @since 1.4
81 | */
82 | public DecoderException(final Throwable cause) {
83 | super(cause);
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/org/apache/commons/codec/Encoder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.apache.commons.codec;
19 |
20 | /**
21 | * Provides the highest level of abstraction for Encoders.
22 | *
23 | * This is the sister interface of {@link Decoder}. Every implementation of Encoder provides this
24 | * common generic interface which allows a user to pass a generic Object to any Encoder implementation
25 | * in the codec package.
26 | *
27 | */
28 | public interface Encoder {
29 |
30 | /**
31 | * Encodes an "Object" and returns the encoded content as an Object. The Objects here may just be
32 | * {@code byte[]} or {@code String}s depending on the implementation used.
33 | *
34 | * @param source
35 | * An object to encode
36 | * @return An "encoded" Object
37 | * @throws EncoderException
38 | * An encoder exception is thrown if the encoder experiences a failure condition during the encoding
39 | * process.
40 | */
41 | Object encode(Object source) throws EncoderException;
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/org/apache/commons/codec/EncoderException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.apache.commons.codec;
19 |
20 | /**
21 | * Thrown when there is a failure condition during the encoding process. This exception is thrown when an
22 | * {@link Encoder} encounters a encoding specific exception such as invalid data, inability to calculate a checksum,
23 | * characters outside of the expected range.
24 | *
25 | */
26 | public class EncoderException extends Exception {
27 |
28 | /**
29 | * Declares the Serial Version Uid.
30 | *
31 | * @see Always Declare Serial Version Uid
32 | */
33 | private static final long serialVersionUID = 1L;
34 |
35 | /**
36 | * Constructs a new exception with {@code null} as its detail message. The cause is not initialized, and may
37 | * subsequently be initialized by a call to {@link #initCause}.
38 | *
39 | * @since 1.4
40 | */
41 | public EncoderException() {
42 | super();
43 | }
44 |
45 | /**
46 | * Constructs a new exception with the specified detail message. The cause is not initialized, and may subsequently
47 | * be initialized by a call to {@link #initCause}.
48 | *
49 | * @param message
50 | * a useful message relating to the encoder specific error.
51 | */
52 | public EncoderException(final String message) {
53 | super(message);
54 | }
55 |
56 | /**
57 | * Constructs a new exception with the specified detail message and cause.
58 | *
59 | *
60 | * Note that the detail message associated with {@code cause} is not automatically incorporated into this
61 | * exception's detail message.
62 | *
63 | *
64 | * @param message
65 | * The detail message which is saved for later retrieval by the {@link #getMessage()} method.
66 | * @param cause
67 | * The cause which is saved for later retrieval by the {@link #getCause()} method. A {@code null}
68 | * value is permitted, and indicates that the cause is nonexistent or unknown.
69 | * @since 1.4
70 | */
71 | public EncoderException(final String message, final Throwable cause) {
72 | super(message, cause);
73 | }
74 |
75 | /**
76 | * Constructs a new exception with the specified cause and a detail message of (cause==null ?
77 | * null : cause.toString())
(which typically contains the class and detail message of {@code cause}).
78 | * This constructor is useful for exceptions that are little more than wrappers for other throwables.
79 | *
80 | * @param cause
81 | * The cause which is saved for later retrieval by the {@link #getCause()} method. A {@code null}
82 | * value is permitted, and indicates that the cause is nonexistent or unknown.
83 | * @since 1.4
84 | */
85 | public EncoderException(final Throwable cause) {
86 | super(cause);
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/org/apache/commons/codec/StringDecoder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.apache.commons.codec;
19 |
20 | /**
21 | * Defines common decoding methods for String decoders.
22 | *
23 | */
24 | public interface StringDecoder extends Decoder {
25 |
26 | /**
27 | * Decodes a String and returns a String.
28 | *
29 | * @param source
30 | * the String to decode
31 | * @return the encoded String
32 | * @throws DecoderException
33 | * thrown if there is an error condition during the Encoding process.
34 | */
35 | String decode(String source) throws DecoderException;
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/org/apache/commons/codec/StringEncoder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.apache.commons.codec;
19 |
20 | /**
21 | * Defines common encoding methods for String encoders.
22 | *
23 | */
24 | public interface StringEncoder extends Encoder {
25 |
26 | /**
27 | * Encodes a String and returns a String.
28 | *
29 | * @param source
30 | * the String to encode
31 | * @return the encoded String
32 | * @throws EncoderException
33 | * thrown if there is an error condition during the encoding process.
34 | */
35 | String encode(String source) throws EncoderException;
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/org/apache/commons/codec/Utils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.apache.commons.codec;
19 |
20 | import org.apache.commons.codec.DecoderException;
21 |
22 | /**
23 | * Utility methods for this package.
24 | *
25 | * This class is immutable and thread-safe.
26 | *
27 | * @since 1.4
28 | */
29 | class Utils {
30 |
31 | /**
32 | * Radix used in encoding and decoding.
33 | */
34 | private static final int RADIX = 16;
35 |
36 | /**
37 | * Returns the numeric value of the character {@code b} in radix 16.
38 | *
39 | * @param b
40 | * The byte to be converted.
41 | * @return The numeric value represented by the character in radix 16.
42 | *
43 | * @throws DecoderException
44 | * Thrown when the byte is not valid per {@link Character#digit(char,int)}
45 | */
46 | static int digit16(final byte b) throws DecoderException {
47 | final int i = Character.digit((char) b, RADIX);
48 | if (i == -1) {
49 | throw new DecoderException("Invalid URL encoding: not a valid digit (radix " + RADIX + "): " + b);
50 | }
51 | return i;
52 | }
53 |
54 | /**
55 | * Returns the upper case hex digit of the lower 4 bits of the int.
56 | *
57 | * @param b the input int
58 | * @return the upper case hex digit of the lower 4 bits of the int.
59 | */
60 | static char hexDigit(final int b) {
61 | return Character.toUpperCase(Character.forDigit(b & 0xF, RADIX));
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/org/apache/commons/fileupload/util/mime/ParseException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.apache.commons.fileupload.util.mime;
18 |
19 | /**
20 | * @since 1.3
21 | */
22 | final class ParseException extends Exception {
23 |
24 | /**
25 | * The UID to use when serializing this instance.
26 | */
27 | private static final long serialVersionUID = 5355281266579392077L;
28 |
29 | /**
30 | * Constructs a new exception with the specified detail message.
31 | *
32 | * @param message the detail message.
33 | */
34 | public ParseException(String message) {
35 | super(message);
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.apache.commons.fileupload.util.mime;
18 |
19 | import java.io.IOException;
20 | import java.io.OutputStream;
21 |
22 | /**
23 | * @since 1.3
24 | */
25 | final class QuotedPrintableDecoder {
26 |
27 | /**
28 | * The shift value required to create the upper nibble
29 | * from the first of 2 byte values converted from ascii hex.
30 | */
31 | private static final int UPPER_NIBBLE_SHIFT = Byte.SIZE / 2;
32 |
33 | /**
34 | * Hidden constructor, this class must not be instantiated.
35 | */
36 | private QuotedPrintableDecoder() {
37 | // do nothing
38 | }
39 |
40 | /**
41 | * Decode the encoded byte data writing it to the given output stream.
42 | *
43 | * @param data The array of byte data to decode.
44 | * @param out The output stream used to return the decoded data.
45 | *
46 | * @return the number of bytes produced.
47 | * @throws IOException
48 | */
49 | public static int decode(byte[] data, OutputStream out) throws IOException {
50 | int off = 0;
51 | int length = data.length;
52 | int endOffset = off + length;
53 | int bytesWritten = 0;
54 |
55 | while (off < endOffset) {
56 | byte ch = data[off++];
57 |
58 | // space characters were translated to '_' on encode, so we need to translate them back.
59 | if (ch == '_') {
60 | out.write(' ');
61 | } else if (ch == '=') {
62 | // we found an encoded character. Reduce the 3 char sequence to one.
63 | // but first, make sure we have two characters to work with.
64 | if (off + 1 >= endOffset) {
65 | throw new IOException("Invalid quoted printable encoding; truncated escape sequence");
66 | }
67 |
68 | byte b1 = data[off++];
69 | byte b2 = data[off++];
70 |
71 | // we've found an encoded carriage return. The next char needs to be a newline
72 | if (b1 == '\r') {
73 | if (b2 != '\n') {
74 | throw new IOException("Invalid quoted printable encoding; CR must be followed by LF");
75 | }
76 | // this was a soft linebreak inserted by the encoding. We just toss this away
77 | // on decode.
78 | } else {
79 | // this is a hex pair we need to convert back to a single byte.
80 | int c1 = hexToBinary(b1);
81 | int c2 = hexToBinary(b2);
82 | out.write((c1 << UPPER_NIBBLE_SHIFT) | c2);
83 | // 3 bytes in, one byte out
84 | bytesWritten++;
85 | }
86 | } else {
87 | // simple character, just write it out.
88 | out.write(ch);
89 | bytesWritten++;
90 | }
91 | }
92 |
93 | return bytesWritten;
94 | }
95 |
96 | /**
97 | * Convert a hex digit to the binary value it represents.
98 | *
99 | * @param b the ascii hex byte to convert (0-0, A-F, a-f)
100 | * @return the int value of the hex byte, 0-15
101 | * @throws IOException if the byte is not a valid hex digit.
102 | */
103 | private static int hexToBinary(final byte b) throws IOException {
104 | // CHECKSTYLE IGNORE MagicNumber FOR NEXT 1 LINE
105 | final int i = Character.digit((char) b, 16);
106 | if (i == -1) {
107 | throw new IOException("Invalid quoted printable encoding: not a valid hex digit: " + b);
108 | }
109 | return i;
110 | }
111 |
112 | }
113 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/org/openintents/openpgp/OpenPgpError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014-2015 Dominik Schürmann
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.openintents.openpgp;
18 |
19 | import android.os.Parcel;
20 | import android.os.Parcelable;
21 |
22 | public class OpenPgpError implements Parcelable {
23 | /**
24 | * Since there might be a case where new versions of the client using the library getting
25 | * old versions of the protocol (and thus old versions of this class), we need a versioning
26 | * system for the parcels sent between the clients and the providers.
27 | */
28 | public static final int PARCELABLE_VERSION = 1;
29 |
30 | // possible values for errorId
31 | public static final int CLIENT_SIDE_ERROR = -1;
32 | public static final int GENERIC_ERROR = 0;
33 | public static final int INCOMPATIBLE_API_VERSIONS = 1;
34 | public static final int NO_OR_WRONG_PASSPHRASE = 2;
35 | public static final int NO_USER_IDS = 3;
36 | public static final int OPPORTUNISTIC_MISSING_KEYS = 4;
37 |
38 |
39 | int errorId;
40 | String message;
41 |
42 | public OpenPgpError() {
43 | }
44 |
45 | public OpenPgpError(int errorId, String message) {
46 | this.errorId = errorId;
47 | this.message = message;
48 | }
49 |
50 | public OpenPgpError(OpenPgpError b) {
51 | this.errorId = b.errorId;
52 | this.message = b.message;
53 | }
54 |
55 | public int getErrorId() {
56 | return errorId;
57 | }
58 |
59 | public void setErrorId(int errorId) {
60 | this.errorId = errorId;
61 | }
62 |
63 | public String getMessage() {
64 | return message;
65 | }
66 |
67 | public void setMessage(String message) {
68 | this.message = message;
69 | }
70 |
71 | public int describeContents() {
72 | return 0;
73 | }
74 |
75 | public void writeToParcel(Parcel dest, int flags) {
76 | /**
77 | * NOTE: When adding fields in the process of updating this API, make sure to bump
78 | * {@link #PARCELABLE_VERSION}.
79 | */
80 | dest.writeInt(PARCELABLE_VERSION);
81 | // Inject a placeholder that will store the parcel size from this point on
82 | // (not including the size itself).
83 | int sizePosition = dest.dataPosition();
84 | dest.writeInt(0);
85 | int startPosition = dest.dataPosition();
86 | // version 1
87 | dest.writeInt(errorId);
88 | dest.writeString(message);
89 | // Go back and write the size
90 | int parcelableSize = dest.dataPosition() - startPosition;
91 | dest.setDataPosition(sizePosition);
92 | dest.writeInt(parcelableSize);
93 | dest.setDataPosition(startPosition + parcelableSize);
94 | }
95 |
96 | public static final Creator CREATOR = new Creator() {
97 | public OpenPgpError createFromParcel(final Parcel source) {
98 | source.readInt(); // parcelableVersion
99 | int parcelableSize = source.readInt();
100 | int startPosition = source.dataPosition();
101 |
102 | OpenPgpError error = new OpenPgpError();
103 | error.errorId = source.readInt();
104 | error.message = source.readString();
105 |
106 | // skip over all fields added in future versions of this parcel
107 | source.setDataPosition(startPosition + parcelableSize);
108 |
109 | return error;
110 | }
111 |
112 | public OpenPgpError[] newArray(final int size) {
113 | return new OpenPgpError[size];
114 | }
115 | };
116 | }
117 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/org/openintents/openpgp/util/OpenPgpServiceConnection.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014-2015 Dominik Schürmann
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.openintents.openpgp.util;
18 |
19 | import android.content.ComponentName;
20 | import android.content.Context;
21 | import android.content.Intent;
22 | import android.content.ServiceConnection;
23 | import android.os.IBinder;
24 |
25 | import org.openintents.openpgp.IOpenPgpService2;
26 |
27 | public class OpenPgpServiceConnection {
28 |
29 | // callback interface
30 | public interface OnBound {
31 | void onBound(IOpenPgpService2 service);
32 |
33 | void onError(Exception e);
34 | }
35 |
36 | private Context mApplicationContext;
37 |
38 | private IOpenPgpService2 mService;
39 | private String mProviderPackageName;
40 |
41 | private OnBound mOnBoundListener;
42 |
43 | /**
44 | * Create new connection
45 | *
46 | * @param context
47 | * @param providerPackageName specify package name of OpenPGP provider,
48 | * e.g., "org.sufficientlysecure.keychain"
49 | */
50 | public OpenPgpServiceConnection(Context context, String providerPackageName) {
51 | this.mApplicationContext = context.getApplicationContext();
52 | this.mProviderPackageName = providerPackageName;
53 | }
54 |
55 | /**
56 | * Create new connection with callback
57 | *
58 | * @param context
59 | * @param providerPackageName specify package name of OpenPGP provider,
60 | * e.g., "org.sufficientlysecure.keychain"
61 | * @param onBoundListener callback, executed when connection to service has been established
62 | */
63 | public OpenPgpServiceConnection(Context context, String providerPackageName,
64 | OnBound onBoundListener) {
65 | this(context, providerPackageName);
66 | this.mOnBoundListener = onBoundListener;
67 | }
68 |
69 | public IOpenPgpService2 getService() {
70 | return mService;
71 | }
72 |
73 | public boolean isBound() {
74 | return (mService != null);
75 | }
76 |
77 | private ServiceConnection mServiceConnection = new ServiceConnection() {
78 | public void onServiceConnected(ComponentName name, IBinder service) {
79 | mService = IOpenPgpService2.Stub.asInterface(service);
80 | if (mOnBoundListener != null) {
81 | mOnBoundListener.onBound(mService);
82 | }
83 | }
84 |
85 | public void onServiceDisconnected(ComponentName name) {
86 | mService = null;
87 | }
88 | };
89 |
90 | /**
91 | * If not already bound, bind to service!
92 | *
93 | * @return
94 | */
95 | public void bindToService() {
96 | // if not already bound...
97 | if (mService == null) {
98 | try {
99 | Intent serviceIntent = new Intent(OpenPgpApi.SERVICE_INTENT_2);
100 | // NOTE: setPackage is very important to restrict the intent to this provider only!
101 | serviceIntent.setPackage(mProviderPackageName);
102 | boolean connect = mApplicationContext.bindService(serviceIntent, mServiceConnection,
103 | Context.BIND_AUTO_CREATE);
104 | if (!connect) {
105 | throw new Exception("bindService() returned false!");
106 | }
107 | } catch (Exception e) {
108 | if (mOnBoundListener != null) {
109 | mOnBoundListener.onError(e);
110 | }
111 | }
112 | } else {
113 | // already bound, but also inform client about it with callback
114 | if (mOnBoundListener != null) {
115 | mOnBoundListener.onBound(mService);
116 | }
117 | }
118 | }
119 |
120 | public void unbindFromService() {
121 | mApplicationContext.unbindService(mServiceConnection);
122 | }
123 |
124 | }
125 |
--------------------------------------------------------------------------------
/InboxPager/src/main/java/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014-2015 Dominik Schürmann
3 | * 2013 Florian Schmaus
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.openintents.openpgp.util;
19 |
20 | import android.os.ParcelFileDescriptor;
21 | import android.util.Log;
22 |
23 | import java.io.IOException;
24 | import java.io.InputStream;
25 | import java.io.OutputStream;
26 |
27 | public class ParcelFileDescriptorUtil {
28 |
29 | public static ParcelFileDescriptor pipeFrom(InputStream inputStream)
30 | throws IOException {
31 | ParcelFileDescriptor[] pipe = ParcelFileDescriptor.createPipe();
32 | ParcelFileDescriptor readSide = pipe[0];
33 | ParcelFileDescriptor writeSide = pipe[1];
34 |
35 | new TransferThread(inputStream, new ParcelFileDescriptor.AutoCloseOutputStream(writeSide))
36 | .start();
37 |
38 | return readSide;
39 | }
40 |
41 |
42 | public static TransferThread pipeTo(OutputStream outputStream, ParcelFileDescriptor output)
43 | throws IOException {
44 |
45 | TransferThread t = new TransferThread(new ParcelFileDescriptor.AutoCloseInputStream(output), outputStream);
46 |
47 | t.start();
48 | return t;
49 | }
50 |
51 |
52 | static class TransferThread extends Thread {
53 | final InputStream mIn;
54 | final OutputStream mOut;
55 |
56 | TransferThread(InputStream in, OutputStream out) {
57 | super("IPC Transfer Thread");
58 | mIn = in;
59 | mOut = out;
60 | setDaemon(true);
61 | }
62 |
63 | @Override
64 | public void run() {
65 | byte[] buf = new byte[4096];
66 | int len;
67 |
68 | try {
69 | while ((len = mIn.read(buf)) > 0) {
70 | mOut.write(buf, 0, len);
71 | }
72 | } catch (IOException e) {
73 | Log.e(OpenPgpApi.TAG, "IOException when writing to out", e);
74 | } finally {
75 | try {
76 | mIn.close();
77 | } catch (IOException ignored) {
78 | }
79 | try {
80 | mOut.close();
81 | } catch (IOException ignored) {
82 | }
83 | }
84 | }
85 | }
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/anim/fade_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/anim/left_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/anim/left_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/anim/right_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/anim/right_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/attachment.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/attachments_unaffected.xml:
--------------------------------------------------------------------------------
1 |
6 |
10 |
16 |
23 |
24 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/btn_green.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
14 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/btn_green_normal.xml:
--------------------------------------------------------------------------------
1 |
2 | -
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/btn_green_pressed.xml:
--------------------------------------------------------------------------------
1 |
2 | -
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/btn_orange.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
14 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/btn_orange_normal.xml:
--------------------------------------------------------------------------------
1 |
2 | -
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/btn_orange_pressed.xml:
--------------------------------------------------------------------------------
1 |
2 | -
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/btn_refresh.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
14 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/btn_refresh_normal.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
16 |
24 |
25 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/btn_refresh_pressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
16 |
24 |
25 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/btn_send_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
14 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/counter_rounded.xml:
--------------------------------------------------------------------------------
1 |
2 | -
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/datetime.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/drawer.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/focus_mode_allmsg.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
34 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/focus_mode_unread.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
34 |
40 |
46 |
52 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/inbox_list_view_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/location.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/network.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/padlock_aes.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/padlock_error.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/padlock_normal.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/padlock_pgp_closed.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
13 |
17 |
21 |
22 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/padlock_pgp_closed_inverted.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
13 |
17 |
21 |
22 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/padlock_pgp_open.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
16 |
20 |
24 |
25 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/padlock_pgp_open_inverted.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
16 |
20 |
24 |
25 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/padlock_txt.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
14 |
19 |
24 |
25 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/pick_file.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/pick_folder.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/popup_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/remove_item.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/reply_arrow.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
14 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/sent_to_specific.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
8 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/settings.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/signature.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/spinner_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/unseen_floating_normal.xml:
--------------------------------------------------------------------------------
1 |
6 |
15 |
23 |
24 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/unseen_floating_pressed.xml:
--------------------------------------------------------------------------------
1 |
6 |
15 |
23 |
24 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/unseen_in_group.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/drawable/unseen_in_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/font/dottz.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/InboxPager/src/main/res/font/dottz.ttf
--------------------------------------------------------------------------------
/InboxPager/src/main/res/font/dottz_type.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
12 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/layout/file_picker.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
19 |
20 |
31 |
32 |
42 |
43 |
62 |
63 |
64 |
65 |
75 |
76 |
82 |
83 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/layout/file_picker_list_row.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
15 |
16 |
28 |
29 |
43 |
44 |
55 |
56 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/layout/folder_picker.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
19 |
20 |
31 |
32 |
42 |
43 |
62 |
63 |
64 |
65 |
74 |
75 |
82 |
83 |
88 |
89 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/layout/folder_picker_attachment_list_row.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
17 |
18 |
28 |
29 |
43 |
44 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/layout/inbox_list_row.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
21 |
22 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/layout/message_list_group.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
20 |
21 |
32 |
33 |
44 |
45 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/layout/message_list_row.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
13 |
14 |
22 |
23 |
32 |
33 |
34 |
35 |
45 |
46 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/layout/pager.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
38 |
39 |
40 |
41 |
47 |
48 |
52 |
53 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/layout/popup.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/layout/pw_app.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
20 |
21 |
31 |
32 |
37 |
38 |
48 |
49 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/layout/pw_txt.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
27 |
28 |
39 |
40 |
50 |
51 |
52 |
53 |
61 |
62 |
73 |
74 |
79 |
80 |
90 |
91 |
102 |
103 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/layout/spinner_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/menu/crypto_action_btns.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/menu/message_action_btns.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/menu/pager_action_btns.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | -
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/menu/send_action_btns.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | -
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/mipmap-hdpi/application.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/InboxPager/src/main/res/mipmap-hdpi/application.png
--------------------------------------------------------------------------------
/InboxPager/src/main/res/mipmap-mdpi/application.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/InboxPager/src/main/res/mipmap-mdpi/application.png
--------------------------------------------------------------------------------
/InboxPager/src/main/res/mipmap-xhdpi/application.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/InboxPager/src/main/res/mipmap-xhdpi/application.png
--------------------------------------------------------------------------------
/InboxPager/src/main/res/mipmap-xxhdpi/application.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/InboxPager/src/main/res/mipmap-xxhdpi/application.png
--------------------------------------------------------------------------------
/InboxPager/src/main/res/mipmap-xxxhdpi/application.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/InboxPager/src/main/res/mipmap-xxxhdpi/application.png
--------------------------------------------------------------------------------
/InboxPager/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #F6F38C
4 | #1D2412
5 | #FFFFFF
6 | #499c4a
7 | #0ab12f
8 | #0fd63b
9 | #F60
10 | #ffa366
11 | #f50c08
12 | #E91E63
13 |
14 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 22sp
4 | 22sp
5 | 22sp
6 | 18sp
7 |
8 |
9 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
19 |
20 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
19 |
20 |
--------------------------------------------------------------------------------
/InboxPager/src/main/res/xml/settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
11 |
15 |
16 |
17 |
21 |
22 |
23 |
28 |
29 |
30 |
34 |
35 |
36 |
42 |
43 |
44 |
50 |
51 |
52 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/OPENKEYCHAIN_LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2013-2015 Dominik Schürmann
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/SQLCIPHER:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010 Zetetic LLC All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without modification,
4 | are permitted provided that the following conditions are met:
5 |
6 | * Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice,
9 | this list of conditions and the following disclaimer in the documentation and/or
10 | other materials provided with the distribution.
11 | * Neither the name of the ZETETIC LLC nor the names of its contributors may be used
12 | to endorse or promote products derived from this software without specific prior
13 | written permission.
14 |
15 | THIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
16 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY DIRECT,
18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
20 | OR PROFITS; OR BUSINESS INTERRUPTION)
21 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 |
--------------------------------------------------------------------------------
/SQLCIPHER_ANDROID_LIBS:
--------------------------------------------------------------------------------
1 | Copyright (c) 2006 The Android Open Source Project
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at:
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing,
10 | software distributed under the License is distributed on an
11 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
12 | either express or implied. See the License for the specific
13 | language governing permissions and limitations under the License.
14 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | plugins {
3 | alias(libs.plugins.android.application) apply false
4 | }
5 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/bg/short_description.txt:
--------------------------------------------------------------------------------
1 | Четете и пишете и-мейли
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/de/short_description.txt:
--------------------------------------------------------------------------------
1 | E-Mails lesen und schreiben
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/10.txt:
--------------------------------------------------------------------------------
1 | Sort messages by sender.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/11.txt:
--------------------------------------------------------------------------------
1 | Fixed encodings. Only text/plain /html now.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/12.txt:
--------------------------------------------------------------------------------
1 | Spinning progress deletion fixes.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/13.txt:
--------------------------------------------------------------------------------
1 | Patch for cert info crash.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/14.txt:
--------------------------------------------------------------------------------
1 | Cert info with SHA-256.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/15.txt:
--------------------------------------------------------------------------------
1 | Many new features and fixes.
2 |
3 | Migrated to the AndroidX extra library.
4 |
5 | Quoted-printable email and Encoded-word (RFC 2047) decoding with Apache Commons.
6 |
7 | A WebView that displays emails in html, in offline mode.
8 |
9 | Updated the internal SQLCipher database to v4.4.0.
10 |
11 | Remowrked password dialog.
12 |
13 | Mitigated Context leakages.
14 |
15 | Open account drawer by pressing on background of app.
16 |
17 | Added translations - French, German, Spanish.
18 |
19 | Updated animations.
20 |
21 | Beeping sound uses system message default.
22 |
23 | Long-press on message thread offers the option for direct reply.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/16.txt:
--------------------------------------------------------------------------------
1 | More Cryptography, Android Content API for Files
2 |
3 | AES/Twofish end-to-end cryptogram (encrypted text message, unencrypted attachments).
4 | Single word or whole block.
5 |
6 | Attachment/message saving with Android content API.
7 |
8 | Auto vacuum database to reduce size.
9 |
10 | Checks for common network errors.
11 |
12 | Improved message parsing.
13 |
14 | Message datetime conversion to local device time, original is preserved.
15 |
16 | Option to delete all messages, keeping account settings.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/17.txt:
--------------------------------------------------------------------------------
1 | Fixed QP processing and display.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/18.txt:
--------------------------------------------------------------------------------
1 | Version 6.2 Focus Mode for unread messages.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/19.txt:
--------------------------------------------------------------------------------
1 | Version 6.3 Focus Mode update.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/20.txt:
--------------------------------------------------------------------------------
1 | Version 6.4 Updated build.gradle.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/4.txt:
--------------------------------------------------------------------------------
1 | PGP/MIME, hostname checks.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/5.txt:
--------------------------------------------------------------------------------
1 | PGP/MIME enhanced sign-check. Updated license text button.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/6.txt:
--------------------------------------------------------------------------------
1 | Encoding and debugging updates. Updated SQLCipher to 3.5.9.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/7.txt:
--------------------------------------------------------------------------------
1 | Changes in application Activity are now saved and restored correctly.
2 | Affects rotating screen portrait/landscape.
3 |
4 | Security Alteration dialog updated.
5 |
6 | Mailbox status and statistics dialog is now a menu item.
7 |
8 | Server diagnostic tools fixed.
9 |
10 | Server settings made easier.
11 |
12 | Small UI fixes.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/8.txt:
--------------------------------------------------------------------------------
1 | Portuguese translation, UI tweaks for data leak prevention.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/9.txt:
--------------------------------------------------------------------------------
1 | UI Update. Internal File Manager.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/full_description.txt:
--------------------------------------------------------------------------------
1 | E-mail client for the Android platform.
2 | IMAP, POP, and SMTP via SSL/TLS, with AES/PGP support.
3 |
4 | Features:
5 |
6 |
7 | - * Animate a smooth transition between visual contexts.
8 | - * Automatically convert texts from their declared character encoding to UTF-8.
9 | - * Download your full email messages (with attachments inside).
10 | - * Download an individual attachment.
11 | - * Display server certificates used in the last connection.
12 | - * Keep track of your unread messages.
13 | - * Notify with sound of new messages, per user choice.
14 | - * Notify with device vibration of new messages, per user choice.
15 | - * Work with OpenPGP messages.
16 | - * Verify hostnames, if not self-signed certificates.
17 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/10.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/11.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/12.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/13.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/14.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/15.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/6.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/7.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/8.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/9.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/block_text_encryption.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/block_text_encryption.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/cleartext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/cleartext.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/encryption.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/encryption.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/verification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/fastlane/metadata/android/en-US/images/phoneScreenshots/verification.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/short_description.txt:
--------------------------------------------------------------------------------
1 | Read and write e-mails
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/title.txt:
--------------------------------------------------------------------------------
1 | Inbox Pager
--------------------------------------------------------------------------------
/fastlane/metadata/android/fr/short_description.txt:
--------------------------------------------------------------------------------
1 | Lire et écrire des courriels
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/pl/short_description.txt:
--------------------------------------------------------------------------------
1 | Odczytywanie i pisanie wiadomości e-mail
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/pt-PT/short_description.txt:
--------------------------------------------------------------------------------
1 | Ler e escrever e-mails
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/pt/short_description.txt:
--------------------------------------------------------------------------------
1 | Ler e escrever e-mails
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/sq/short_description.txt:
--------------------------------------------------------------------------------
1 | Lexoni dhe shkruani email-e
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/tr/short_description.txt:
--------------------------------------------------------------------------------
1 | E-postaları oku ve oluştur
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-CN/short_description.txt:
--------------------------------------------------------------------------------
1 | 读写电子邮件
2 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. For more details, visit
12 | # https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Enables namespacing of each library's R class so that its R class includes only the
19 | # resources declared in the library itself and none from the library's dependencies,
20 | # thereby reducing the size of the R class for that library
21 | android.nonTransitiveRClass=true
22 | android.suppressUnsupportedCompileSdk=35
23 |
--------------------------------------------------------------------------------
/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | [versions]
2 | agp = "8.5.0"
3 | androidDatabaseSqlcipher = "4.4.0"
4 | appcompat = "1.7.0"
5 | material = "1.12.0"
6 | constraintlayout = "2.1.4"
7 | preference = "1.2.1"
8 | sqlite = "2.4.0"
9 |
10 | [libraries]
11 | android-database-sqlcipher = { module = "net.zetetic:android-database-sqlcipher", version.ref = "androidDatabaseSqlcipher" }
12 | documentfile = { module = "androidx.documentfile:documentfile" }
13 | appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
14 | material = { group = "com.google.android.material", name = "material", version.ref = "material" }
15 | constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
16 | preference = { module = "androidx.preference:preference", version.ref = "preference" }
17 | sqlite = { module = "androidx.sqlite:sqlite", version.ref = "sqlite" }
18 |
19 | [plugins]
20 | android-application = { id = "com.android.application", version.ref = "agp" }
21 |
22 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itprojects/InboxPager/bea1cf543dde6a40be1c00ebc5cef0f562c46116/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Jun 29 17:42:46 EEST 2024
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | google {
4 | content {
5 | includeGroupByRegex("com\\.android.*")
6 | includeGroupByRegex("com\\.google.*")
7 | includeGroupByRegex("androidx.*")
8 | }
9 | }
10 | mavenCentral()
11 | gradlePluginPortal()
12 | }
13 | }
14 | dependencyResolutionManagement {
15 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
16 | repositories {
17 | google()
18 | mavenCentral()
19 | }
20 | }
21 |
22 | rootProject.name = "Inbox Pager"
23 | include ':InboxPager'
24 |
--------------------------------------------------------------------------------