diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpInitializer.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpInitializer.java index 47ad314ff..33b64bab8 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpInitializer.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpInitializer.java @@ -18,6 +18,9 @@ package org.jivesoftware.smackx.ox; import org.jivesoftware.smack.initializer.UrlInitializer; +/** + * Initializer class which registers ExtensionElementProviders on startup. + */ public class OpenPgpInitializer extends UrlInitializer { @Override diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/EncryptedOpenPgpContentElement.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/EncryptedOpenPgpContentElement.java index 483fc6e82..2706e3bc5 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/EncryptedOpenPgpContentElement.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/EncryptedOpenPgpContentElement.java @@ -43,10 +43,6 @@ public abstract class EncryptedOpenPgpContentElement extends OpenPgpContentEleme this.rpad = createRandomPadding(); } - public String getRandomPadding() { - return rpad; - } - private static String createRandomPadding() { SecureRandom secRan = new SecureRandom(); int len = secRan.nextInt(256); // TODO: Find suitable value. diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpContentElement.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpContentElement.java index 49b3ea14b..0a560e2f4 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpContentElement.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpContentElement.java @@ -50,14 +50,26 @@ public abstract class OpenPgpContentElement implements ExtensionElement { this.payload = payload; } + /** + * Return the set of recipients. + * @return recipients. + */ public final Set getTo() { return to; } + /** + * Return the timestamp on which the encrypted element has been created. + * @return timestamp. + */ public final Date getTimestamp() { return timestamp; } + /** + * Return the payload of the message. + * @return payload. + */ public final List getPayload() { return payload; } diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpElement.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpElement.java index 4f21db051..d3ce1d711 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpElement.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpElement.java @@ -33,10 +33,12 @@ public class OpenPgpElement implements ExtensionElement { public static final String ELEMENT = "openpgp"; public static final String NAMESPACE = "urn:xmpp:openpgp:0"; + // Represents the OpenPGP message, but encoded using base64. private final String base64EncodedOpenPgpMessage; private OpenPgpMessage openPgpMessage; + // Represents the OpenPGP message, but base64 decoded. private byte[] openPgpMessageBytes; private OpenPgpContentElement openPgpContentElement; diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpElementTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpElementTest.java index cf2ea6c0c..59cf3dea4 100644 --- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpElementTest.java +++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpElementTest.java @@ -82,7 +82,6 @@ public class OpenPgpElementTest extends SmackTestSuite { payload.add(new Message.Body("de", "Hallo Welt!")); CryptElement element = new CryptElement(recipients, payload); - assertNotNull(element.getRandomPadding()); assertNotNull(element.getTimestamp()); } @@ -140,7 +139,6 @@ public class OpenPgpElementTest extends SmackTestSuite { assertEquals(element.getTimestamp(), parsed.getTimestamp()); assertEquals(element.getTo(), parsed.getTo()); assertEquals(element.getPayload(), parsed.getPayload()); - assertEquals(element.getRandomPadding(), parsed.getRandomPadding()); } @Test @@ -171,7 +169,6 @@ public class OpenPgpElementTest extends SmackTestSuite { assertEquals(element.getTimestamp(), parsed.getTimestamp()); assertEquals(element.getTo(), parsed.getTo()); assertEquals(element.getPayload(), parsed.getPayload()); - assertEquals(element.getRandomPadding(), parsed.getRandomPadding()); }