Added a factory method for unrestricted groups.

This commit is contained in:
akwizgran
2013-03-12 14:42:28 +00:00
parent be3b0bf4d6
commit 211950ce66
3 changed files with 9 additions and 1 deletions

View File

@@ -4,5 +4,9 @@ import java.io.IOException;
public interface GroupFactory {
/** Creates an unrestricted group. */
Group createGroup(String name) throws IOException;
/** Creates a restricted group. */
Group createGroup(String name, byte[] publicKey) throws IOException;
}

View File

@@ -26,6 +26,10 @@ class GroupFactoryImpl implements GroupFactory {
this.writerFactory = writerFactory;
}
public Group createGroup(String name) throws IOException {
return createGroup(name, null);
}
public Group createGroup(String name, byte[] publicKey) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
Writer w = writerFactory.createWriter(out);

View File

@@ -94,7 +94,7 @@ public class ProtocolIntegrationTest extends BriarTestCase {
new Random().nextBytes(secret);
// Create two groups: one restricted, one unrestricted
GroupFactory groupFactory = i.getInstance(GroupFactory.class);
group = groupFactory.createGroup("Unrestricted group", null);
group = groupFactory.createGroup("Unrestricted group");
CryptoComponent crypto = i.getInstance(CryptoComponent.class);
KeyPair groupKeyPair = crypto.generateSignatureKeyPair();
group1 = groupFactory.createGroup("Restricted group",