use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.SIGNATURE in project zilla by aklivity.
the class ProxyFunctionsTest method shouldNotMatchInetBeginExtensionSecureSignature.
@Test(expected = Exception.class)
public void shouldNotMatchInetBeginExtensionSecureSignature() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).info().secure().signature("SHA257").build().build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.inet(i -> i.protocol(p -> p.set(STREAM)).source("*").destination("example.com").sourcePort(32768).destinationPort(443))).infosItem(i -> i.secure(s -> s.signature("SHA256"))).build();
assertNull(matcher.match(byteBuf));
}
use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.SIGNATURE in project zilla by aklivity.
the class ProxyFunctionsTest method shouldNotMatchInet4BeginExtensionSecureSignature.
@Test(expected = Exception.class)
public void shouldNotMatchInet4BeginExtensionSecureSignature() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).info().secure().signature("SHA257").build().build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.inet4(i -> i.protocol(p -> p.set(STREAM)).source(new UnsafeBuffer(fromHex("c0a80001")), 0, 4).destination(new UnsafeBuffer(fromHex("c0a800fe")), 0, 4).sourcePort(32768).destinationPort(443))).infosItem(i -> i.secure(s -> s.signature("SHA256"))).build();
assertNull(matcher.match(byteBuf));
}
use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.SIGNATURE in project zilla by aklivity.
the class ProxyFunctionsTest method shouldMatchInetBeginExtension.
@Test
public void shouldMatchInetBeginExtension() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressInet().source("*").destination("example.com").sourcePort(32768).destinationPort(443).build().info().alpn("echo").authority("example.com").identity(fromHex("12345678")).namespace("example").secure().version("TLSv1.3").cipher("ECDHE-RSA-AES128-GCM-SHA256").signature("SHA256").name("name@domain").key("RSA2048").build().build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.inet(i -> i.protocol(p -> p.set(STREAM)).source("*").destination("example.com").sourcePort(32768).destinationPort(443))).infosItem(i -> i.alpn("echo")).infosItem(i -> i.authority("example.com")).infosItem(i -> i.identity(id -> id.value(v -> v.set(fromHex("12345678"))))).infosItem(i -> i.namespace("example")).infosItem(i -> i.secure(s -> s.version("TLSv1.3"))).infosItem(i -> i.secure(s -> s.cipher("ECDHE-RSA-AES128-GCM-SHA256"))).infosItem(i -> i.secure(s -> s.signature("SHA256"))).infosItem(i -> i.secure(s -> s.name("name@domain"))).infosItem(i -> i.secure(s -> s.key("RSA2048"))).build();
assertNotNull(matcher.match(byteBuf));
}
use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.SIGNATURE in project zilla by aklivity.
the class ProxyFunctionsTest method shouldMatchInet4BeginExtension.
@Test
public void shouldMatchInet4BeginExtension() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressInet4().source("192.168.0.1").destination("192.168.0.254").sourcePort(32768).destinationPort(443).build().info().alpn("echo").authority("example.com").identity(fromHex("12345678")).namespace("example").secure().version("TLSv1.3").cipher("ECDHE-RSA-AES128-GCM-SHA256").signature("SHA256").name("name@domain").key("RSA2048").build().build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.inet4(i -> i.protocol(p -> p.set(STREAM)).source(new UnsafeBuffer(fromHex("c0a80001")), 0, 4).destination(new UnsafeBuffer(fromHex("c0a800fe")), 0, 4).sourcePort(32768).destinationPort(443))).infosItem(i -> i.alpn("echo")).infosItem(i -> i.authority("example.com")).infosItem(i -> i.identity(id -> id.value(v -> v.set(fromHex("12345678"))))).infosItem(i -> i.namespace("example")).infosItem(i -> i.secure(s -> s.version("TLSv1.3"))).infosItem(i -> i.secure(s -> s.cipher("ECDHE-RSA-AES128-GCM-SHA256"))).infosItem(i -> i.secure(s -> s.signature("SHA256"))).infosItem(i -> i.secure(s -> s.name("name@domain"))).infosItem(i -> i.secure(s -> s.key("RSA2048"))).build();
assertNotNull(matcher.match(byteBuf));
}
use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.SIGNATURE in project zilla by aklivity.
the class ProxyFunctionsTest method shouldMatchNoneBeginExtension.
@Test
public void shouldMatchNoneBeginExtension() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressNone().build().info().alpn("echo").authority("example.com").identity(fromHex("12345678")).namespace("example").secure().version("TLSv1.3").cipher("ECDHE-RSA-AES128-GCM-SHA256").signature("SHA256").name("name@domain").key("RSA2048").build().build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.none(n -> {
})).infosItem(i -> i.alpn("echo")).infosItem(i -> i.authority("example.com")).infosItem(i -> i.identity(id -> id.value(v -> v.set(fromHex("12345678"))))).infosItem(i -> i.namespace("example")).infosItem(i -> i.secure(s -> s.version("TLSv1.3"))).infosItem(i -> i.secure(s -> s.cipher("ECDHE-RSA-AES128-GCM-SHA256"))).infosItem(i -> i.secure(s -> s.signature("SHA256"))).infosItem(i -> i.secure(s -> s.name("name@domain"))).infosItem(i -> i.secure(s -> s.key("RSA2048"))).build();
assertNotNull(matcher.match(byteBuf));
}
Aggregations