1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-25 03:57:58 +01:00

Comments and remove getter for rpad

This commit is contained in:
Paul Schaub 2018-05-08 15:35:11 +02:00
parent 0900d0a27d
commit de2cac03bd
5 changed files with 17 additions and 7 deletions

View file

@ -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

View file

@ -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.

View file

@ -50,14 +50,26 @@ public abstract class OpenPgpContentElement implements ExtensionElement {
this.payload = payload;
}
/**
* Return the set of recipients.
* @return recipients.
*/
public final Set<Jid> 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<ExtensionElement> getPayload() {
return payload;
}

View file

@ -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;

View file

@ -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());
}