mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 02:39:05 +01:00
Message parser and encoder.
This commit is contained in:
9
api/net/sf/briar/api/crypto/KeyParser.java
Normal file
9
api/net/sf/briar/api/crypto/KeyParser.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package net.sf.briar.api.crypto;
|
||||
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.PublicKey;
|
||||
|
||||
public interface KeyParser {
|
||||
|
||||
PublicKey parsePublicKey(byte[] encodedKey) throws GeneralSecurityException;
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import net.sf.briar.api.serial.Raw;
|
||||
|
||||
public interface Message extends Raw {
|
||||
|
||||
static final int MAX_SIZE = 1024 * 1023; // Not a typo
|
||||
|
||||
/** Returns the message's unique identifier. */
|
||||
MessageId getId();
|
||||
|
||||
|
||||
12
api/net/sf/briar/api/protocol/MessageEncoder.java
Normal file
12
api/net/sf/briar/api/protocol/MessageEncoder.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package net.sf.briar.api.protocol;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.KeyPair;
|
||||
|
||||
public interface MessageEncoder {
|
||||
|
||||
Message encodeMessage(MessageId parent, GroupId group, String nick,
|
||||
KeyPair keyPair, byte[] body) throws IOException,
|
||||
GeneralSecurityException;
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
package net.sf.briar.api.protocol;
|
||||
|
||||
import java.security.SignatureException;
|
||||
|
||||
import net.sf.briar.api.serial.FormatException;
|
||||
import java.io.IOException;
|
||||
import java.security.GeneralSecurityException;
|
||||
|
||||
public interface MessageParser {
|
||||
|
||||
Message parseMessage(byte[] body) throws FormatException, SignatureException;
|
||||
Message parseMessage(byte[] raw) throws IOException, GeneralSecurityException;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user