Merge changes I3babc72d,I79d231e2
* changes: Fix IPsec CTS tests for interface address checking Convert IPsec tests to JUnit4
This commit is contained in:
@@ -26,10 +26,10 @@ import android.net.IpSecTransform;
|
|||||||
import android.platform.test.annotations.AppModeFull;
|
import android.platform.test.annotations.AppModeFull;
|
||||||
import android.system.Os;
|
import android.system.Os;
|
||||||
import android.system.OsConstants;
|
import android.system.OsConstants;
|
||||||
import android.test.AndroidTestCase;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.test.InstrumentationRegistry;
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -44,7 +44,12 @@ import java.net.SocketException;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
public class IpSecBaseTest extends AndroidTestCase {
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class IpSecBaseTest {
|
||||||
|
|
||||||
private static final String TAG = IpSecBaseTest.class.getSimpleName();
|
private static final String TAG = IpSecBaseTest.class.getSimpleName();
|
||||||
|
|
||||||
@@ -71,9 +76,11 @@ public class IpSecBaseTest extends AndroidTestCase {
|
|||||||
|
|
||||||
protected ConnectivityManager mCM;
|
protected ConnectivityManager mCM;
|
||||||
protected IpSecManager mISM;
|
protected IpSecManager mISM;
|
||||||
|
protected Context mContext;
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
@Before
|
||||||
super.setUp();
|
public void setUp() throws Exception {
|
||||||
|
mContext = InstrumentationRegistry.getContext();
|
||||||
mISM =
|
mISM =
|
||||||
(IpSecManager)
|
(IpSecManager)
|
||||||
InstrumentationRegistry.getContext()
|
InstrumentationRegistry.getContext()
|
||||||
@@ -472,6 +479,7 @@ public class IpSecBaseTest extends AndroidTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@AppModeFull(reason = "Socket cannot bind in instant app mode")
|
@AppModeFull(reason = "Socket cannot bind in instant app mode")
|
||||||
public void testJavaTcpSocketPair() throws Exception {
|
public void testJavaTcpSocketPair() throws Exception {
|
||||||
for (String addr : LOOPBACK_ADDRS) {
|
for (String addr : LOOPBACK_ADDRS) {
|
||||||
@@ -483,6 +491,7 @@ public class IpSecBaseTest extends AndroidTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@AppModeFull(reason = "Socket cannot bind in instant app mode")
|
@AppModeFull(reason = "Socket cannot bind in instant app mode")
|
||||||
public void testJavaUdpSocketPair() throws Exception {
|
public void testJavaUdpSocketPair() throws Exception {
|
||||||
for (String addr : LOOPBACK_ADDRS) {
|
for (String addr : LOOPBACK_ADDRS) {
|
||||||
@@ -495,6 +504,7 @@ public class IpSecBaseTest extends AndroidTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@AppModeFull(reason = "Socket cannot bind in instant app mode")
|
@AppModeFull(reason = "Socket cannot bind in instant app mode")
|
||||||
public void testJavaUdpSocketPairUnconnected() throws Exception {
|
public void testJavaUdpSocketPairUnconnected() throws Exception {
|
||||||
for (String addr : LOOPBACK_ADDRS) {
|
for (String addr : LOOPBACK_ADDRS) {
|
||||||
@@ -507,6 +517,7 @@ public class IpSecBaseTest extends AndroidTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@AppModeFull(reason = "Socket cannot bind in instant app mode")
|
@AppModeFull(reason = "Socket cannot bind in instant app mode")
|
||||||
public void testNativeTcpSocketPair() throws Exception {
|
public void testNativeTcpSocketPair() throws Exception {
|
||||||
for (String addr : LOOPBACK_ADDRS) {
|
for (String addr : LOOPBACK_ADDRS) {
|
||||||
@@ -519,6 +530,7 @@ public class IpSecBaseTest extends AndroidTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@AppModeFull(reason = "Socket cannot bind in instant app mode")
|
@AppModeFull(reason = "Socket cannot bind in instant app mode")
|
||||||
public void testNativeUdpSocketPair() throws Exception {
|
public void testNativeUdpSocketPair() throws Exception {
|
||||||
for (String addr : LOOPBACK_ADDRS) {
|
for (String addr : LOOPBACK_ADDRS) {
|
||||||
@@ -531,6 +543,7 @@ public class IpSecBaseTest extends AndroidTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@AppModeFull(reason = "Socket cannot bind in instant app mode")
|
@AppModeFull(reason = "Socket cannot bind in instant app mode")
|
||||||
public void testNativeUdpSocketPairUnconnected() throws Exception {
|
public void testNativeUdpSocketPairUnconnected() throws Exception {
|
||||||
for (String addr : LOOPBACK_ADDRS) {
|
for (String addr : LOOPBACK_ADDRS) {
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ import static android.system.OsConstants.IPPROTO_TCP;
|
|||||||
import static android.system.OsConstants.IPPROTO_UDP;
|
import static android.system.OsConstants.IPPROTO_UDP;
|
||||||
|
|
||||||
import static org.junit.Assert.assertArrayEquals;
|
import static org.junit.Assert.assertArrayEquals;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import android.net.IpSecAlgorithm;
|
import android.net.IpSecAlgorithm;
|
||||||
import android.net.IpSecManager;
|
import android.net.IpSecManager;
|
||||||
@@ -39,6 +41,8 @@ import android.system.ErrnoException;
|
|||||||
import android.system.Os;
|
import android.system.Os;
|
||||||
import android.system.OsConstants;
|
import android.system.OsConstants;
|
||||||
|
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.DatagramPacket;
|
import java.net.DatagramPacket;
|
||||||
@@ -47,6 +51,11 @@ import java.net.Inet6Address;
|
|||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
@AppModeFull(reason = "Socket cannot bind in instant app mode")
|
@AppModeFull(reason = "Socket cannot bind in instant app mode")
|
||||||
public class IpSecManagerTest extends IpSecBaseTest {
|
public class IpSecManagerTest extends IpSecBaseTest {
|
||||||
|
|
||||||
@@ -64,7 +73,9 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
|
|
||||||
private static final byte[] AEAD_KEY = getKey(288);
|
private static final byte[] AEAD_KEY = getKey(288);
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
@Before
|
||||||
|
@Override
|
||||||
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,6 +85,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
* Realloc the same SPI that was specifically created (expect SpiUnavailable)
|
* Realloc the same SPI that was specifically created (expect SpiUnavailable)
|
||||||
* Close SPIs
|
* Close SPIs
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testAllocSpi() throws Exception {
|
public void testAllocSpi() throws Exception {
|
||||||
for (InetAddress addr : GOOGLE_DNS_LIST) {
|
for (InetAddress addr : GOOGLE_DNS_LIST) {
|
||||||
IpSecManager.SecurityParameterIndex randomSpi = null, droidSpi = null;
|
IpSecManager.SecurityParameterIndex randomSpi = null, droidSpi = null;
|
||||||
@@ -225,6 +237,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
* release transform
|
* release transform
|
||||||
* send data (expect exception)
|
* send data (expect exception)
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testCreateTransform() throws Exception {
|
public void testCreateTransform() throws Exception {
|
||||||
InetAddress localAddr = InetAddress.getByName(IPV4_LOOPBACK);
|
InetAddress localAddr = InetAddress.getByName(IPV4_LOOPBACK);
|
||||||
IpSecManager.SecurityParameterIndex spi =
|
IpSecManager.SecurityParameterIndex spi =
|
||||||
@@ -594,6 +607,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testIkeOverUdpEncapSocket() throws Exception {
|
public void testIkeOverUdpEncapSocket() throws Exception {
|
||||||
// IPv6 not supported for UDP-encap-ESP
|
// IPv6 not supported for UDP-encap-ESP
|
||||||
InetAddress local = InetAddress.getByName(IPV4_LOOPBACK);
|
InetAddress local = InetAddress.getByName(IPV4_LOOPBACK);
|
||||||
@@ -652,24 +666,28 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
// checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, true, 1000);
|
// checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, true, 1000);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testInterfaceCountersUdp4() throws Exception {
|
public void testInterfaceCountersUdp4() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1000, false);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1000, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testInterfaceCountersUdp6() throws Exception {
|
public void testInterfaceCountersUdp6() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
||||||
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1000, false);
|
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1000, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testInterfaceCountersUdp4UdpEncap() throws Exception {
|
public void testInterfaceCountersUdp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1000, false);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1000, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacMd5Tcp4() throws Exception {
|
public void testAesCbcHmacMd5Tcp4() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
||||||
@@ -677,6 +695,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacMd5Tcp6() throws Exception {
|
public void testAesCbcHmacMd5Tcp6() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
||||||
@@ -684,6 +703,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacMd5Udp4() throws Exception {
|
public void testAesCbcHmacMd5Udp4() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
||||||
@@ -691,6 +711,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacMd5Udp6() throws Exception {
|
public void testAesCbcHmacMd5Udp6() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
||||||
@@ -698,6 +719,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha1Tcp4() throws Exception {
|
public void testAesCbcHmacSha1Tcp4() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
|
||||||
@@ -705,6 +727,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha1Tcp6() throws Exception {
|
public void testAesCbcHmacSha1Tcp6() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
|
||||||
@@ -712,6 +735,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha1Udp4() throws Exception {
|
public void testAesCbcHmacSha1Udp4() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
|
||||||
@@ -719,6 +743,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha1Udp6() throws Exception {
|
public void testAesCbcHmacSha1Udp6() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
|
||||||
@@ -726,6 +751,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha256Tcp4() throws Exception {
|
public void testAesCbcHmacSha256Tcp4() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
||||||
@@ -733,6 +759,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha256Tcp6() throws Exception {
|
public void testAesCbcHmacSha256Tcp6() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
||||||
@@ -740,6 +767,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha256Udp4() throws Exception {
|
public void testAesCbcHmacSha256Udp4() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
||||||
@@ -747,6 +775,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha256Udp6() throws Exception {
|
public void testAesCbcHmacSha256Udp6() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
||||||
@@ -754,6 +783,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha384Tcp4() throws Exception {
|
public void testAesCbcHmacSha384Tcp4() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
|
||||||
@@ -761,6 +791,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha384Tcp6() throws Exception {
|
public void testAesCbcHmacSha384Tcp6() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
|
||||||
@@ -768,6 +799,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha384Udp4() throws Exception {
|
public void testAesCbcHmacSha384Udp4() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
|
||||||
@@ -775,6 +807,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha384Udp6() throws Exception {
|
public void testAesCbcHmacSha384Udp6() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
|
||||||
@@ -782,6 +815,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha512Tcp4() throws Exception {
|
public void testAesCbcHmacSha512Tcp4() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
|
||||||
@@ -789,6 +823,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha512Tcp6() throws Exception {
|
public void testAesCbcHmacSha512Tcp6() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
|
||||||
@@ -796,6 +831,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha512Udp4() throws Exception {
|
public void testAesCbcHmacSha512Udp4() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
|
||||||
@@ -803,6 +839,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha512Udp6() throws Exception {
|
public void testAesCbcHmacSha512Udp6() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
|
||||||
@@ -810,6 +847,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm64Tcp4() throws Exception {
|
public void testAesGcm64Tcp4() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
|
||||||
@@ -817,6 +855,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm64Tcp6() throws Exception {
|
public void testAesGcm64Tcp6() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
|
||||||
@@ -824,6 +863,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm64Udp4() throws Exception {
|
public void testAesGcm64Udp4() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
|
||||||
@@ -831,6 +871,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm64Udp6() throws Exception {
|
public void testAesGcm64Udp6() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
|
||||||
@@ -838,6 +879,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm96Tcp4() throws Exception {
|
public void testAesGcm96Tcp4() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
|
||||||
@@ -845,6 +887,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm96Tcp6() throws Exception {
|
public void testAesGcm96Tcp6() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
|
||||||
@@ -852,6 +895,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm96Udp4() throws Exception {
|
public void testAesGcm96Udp4() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
|
||||||
@@ -859,6 +903,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm96Udp6() throws Exception {
|
public void testAesGcm96Udp6() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
|
||||||
@@ -866,6 +911,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm128Tcp4() throws Exception {
|
public void testAesGcm128Tcp4() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
|
||||||
@@ -873,6 +919,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm128Tcp6() throws Exception {
|
public void testAesGcm128Tcp6() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
|
||||||
@@ -880,6 +927,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm128Udp4() throws Exception {
|
public void testAesGcm128Udp4() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
|
||||||
@@ -887,6 +935,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm128Udp6() throws Exception {
|
public void testAesGcm128Udp6() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
|
||||||
@@ -894,6 +943,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacMd5Tcp4UdpEncap() throws Exception {
|
public void testAesCbcHmacMd5Tcp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
||||||
@@ -901,6 +951,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacMd5Udp4UdpEncap() throws Exception {
|
public void testAesCbcHmacMd5Udp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
|
||||||
@@ -908,6 +959,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha1Tcp4UdpEncap() throws Exception {
|
public void testAesCbcHmacSha1Tcp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
|
||||||
@@ -915,6 +967,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha1Udp4UdpEncap() throws Exception {
|
public void testAesCbcHmacSha1Udp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
|
||||||
@@ -922,6 +975,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha256Tcp4UdpEncap() throws Exception {
|
public void testAesCbcHmacSha256Tcp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
||||||
@@ -929,6 +983,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha256Udp4UdpEncap() throws Exception {
|
public void testAesCbcHmacSha256Udp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
||||||
@@ -936,6 +991,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha384Tcp4UdpEncap() throws Exception {
|
public void testAesCbcHmacSha384Tcp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
|
||||||
@@ -943,6 +999,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha384Udp4UdpEncap() throws Exception {
|
public void testAesCbcHmacSha384Udp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
|
||||||
@@ -950,6 +1007,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha512Tcp4UdpEncap() throws Exception {
|
public void testAesCbcHmacSha512Tcp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
|
||||||
@@ -957,6 +1015,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesCbcHmacSha512Udp4UdpEncap() throws Exception {
|
public void testAesCbcHmacSha512Udp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
|
||||||
@@ -964,6 +1023,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm64Tcp4UdpEncap() throws Exception {
|
public void testAesGcm64Tcp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
|
||||||
@@ -971,6 +1031,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm64Udp4UdpEncap() throws Exception {
|
public void testAesGcm64Udp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
|
||||||
@@ -978,6 +1039,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm96Tcp4UdpEncap() throws Exception {
|
public void testAesGcm96Tcp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
|
||||||
@@ -985,6 +1047,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm96Udp4UdpEncap() throws Exception {
|
public void testAesGcm96Udp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
|
||||||
@@ -992,6 +1055,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm128Tcp4UdpEncap() throws Exception {
|
public void testAesGcm128Tcp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
|
||||||
@@ -999,6 +1063,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAesGcm128Udp4UdpEncap() throws Exception {
|
public void testAesGcm128Udp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm authCrypt =
|
IpSecAlgorithm authCrypt =
|
||||||
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
|
new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
|
||||||
@@ -1006,78 +1071,91 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testCryptUdp4() throws Exception {
|
public void testCryptUdp4() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, null, null, false, 1, false);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, null, null, false, 1, false);
|
||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, null, null, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, null, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAuthUdp4() throws Exception {
|
public void testAuthUdp4() throws Exception {
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, auth, null, false, 1, false);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, auth, null, false, 1, false);
|
||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, auth, null, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testCryptUdp6() throws Exception {
|
public void testCryptUdp6() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, null, null, false, 1, false);
|
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, null, null, false, 1, false);
|
||||||
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, null, null, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, null, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAuthUdp6() throws Exception {
|
public void testAuthUdp6() throws Exception {
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
||||||
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, auth, null, false, 1, false);
|
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, auth, null, false, 1, false);
|
||||||
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, auth, null, false, 1, true);
|
checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testCryptTcp4() throws Exception {
|
public void testCryptTcp4() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, null, null, false, 1, false);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, null, null, false, 1, false);
|
||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, null, null, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, null, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAuthTcp4() throws Exception {
|
public void testAuthTcp4() throws Exception {
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, auth, null, false, 1, false);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, auth, null, false, 1, false);
|
||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, auth, null, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testCryptTcp6() throws Exception {
|
public void testCryptTcp6() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, null, null, false, 1, false);
|
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, null, null, false, 1, false);
|
||||||
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, null, null, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, null, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAuthTcp6() throws Exception {
|
public void testAuthTcp6() throws Exception {
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
||||||
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, auth, null, false, 1, false);
|
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, auth, null, false, 1, false);
|
||||||
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, auth, null, false, 1, true);
|
checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, auth, null, false, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testCryptUdp4UdpEncap() throws Exception {
|
public void testCryptUdp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, null, null, true, 1, false);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, null, null, true, 1, false);
|
||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, null, null, true, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, null, null, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAuthUdp4UdpEncap() throws Exception {
|
public void testAuthUdp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, auth, null, true, 1, false);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, auth, null, true, 1, false);
|
||||||
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, auth, null, true, 1, true);
|
checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, auth, null, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testCryptTcp4UdpEncap() throws Exception {
|
public void testCryptTcp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
|
||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, null, null, true, 1, false);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, null, null, true, 1, false);
|
||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, null, null, true, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, null, null, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAuthTcp4UdpEncap() throws Exception {
|
public void testAuthTcp4UdpEncap() throws Exception {
|
||||||
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
|
||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, auth, null, true, 1, false);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, auth, null, true, 1, false);
|
||||||
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, auth, null, true, 1, true);
|
checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, auth, null, true, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testOpenUdpEncapSocketSpecificPort() throws Exception {
|
public void testOpenUdpEncapSocketSpecificPort() throws Exception {
|
||||||
IpSecManager.UdpEncapsulationSocket encapSocket = null;
|
IpSecManager.UdpEncapsulationSocket encapSocket = null;
|
||||||
int port = -1;
|
int port = -1;
|
||||||
@@ -1106,6 +1184,7 @@ public class IpSecManagerTest extends IpSecBaseTest {
|
|||||||
assertTrue("Returned invalid port", encapSocket.getPort() == port);
|
assertTrue("Returned invalid port", encapSocket.getPort() == port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testOpenUdpEncapSocketRandomPort() throws Exception {
|
public void testOpenUdpEncapSocketRandomPort() throws Exception {
|
||||||
try (IpSecManager.UdpEncapsulationSocket encapSocket = mISM.openUdpEncapsulationSocket()) {
|
try (IpSecManager.UdpEncapsulationSocket encapSocket = mISM.openUdpEncapsulationSocket()) {
|
||||||
assertTrue("Returned invalid port", encapSocket.getPort() != 0);
|
assertTrue("Returned invalid port", encapSocket.getPort() != 0);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import static org.junit.Assert.assertArrayEquals;
|
|||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import android.app.AppOpsManager;
|
import android.app.AppOpsManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -69,9 +69,7 @@ import com.android.compatibility.common.util.SystemUtil;
|
|||||||
import java.net.Inet4Address;
|
import java.net.Inet4Address;
|
||||||
import java.net.Inet6Address;
|
import java.net.Inet6Address;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.InterfaceAddress;
|
|
||||||
import java.net.NetworkInterface;
|
import java.net.NetworkInterface;
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@@ -146,6 +144,7 @@ public class IpSecManagerTunnelTest extends IpSecBaseTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
@@ -512,11 +511,10 @@ public class IpSecManagerTunnelTest extends IpSecBaseTest {
|
|||||||
NetworkInterface netIntf = NetworkInterface.getByName(tunnelIntf.getInterfaceName());
|
NetworkInterface netIntf = NetworkInterface.getByName(tunnelIntf.getInterfaceName());
|
||||||
assertNotNull(netIntf);
|
assertNotNull(netIntf);
|
||||||
|
|
||||||
// Check addresses
|
// Verify address was added
|
||||||
List<InterfaceAddress> intfAddrs = netIntf.getInterfaceAddresses();
|
netIntf = NetworkInterface.getByInetAddress(localInner);
|
||||||
assertEquals(1, intfAddrs.size());
|
assertNotNull(netIntf);
|
||||||
assertEquals(localInner, intfAddrs.get(0).getAddress());
|
assertEquals(tunnelIntf.getInterfaceName(), netIntf.getDisplayName());
|
||||||
assertEquals(innerPrefixLen, intfAddrs.get(0).getNetworkPrefixLength());
|
|
||||||
|
|
||||||
// Configure Transform parameters
|
// Configure Transform parameters
|
||||||
IpSecTransform.Builder transformBuilder = new IpSecTransform.Builder(sContext);
|
IpSecTransform.Builder transformBuilder = new IpSecTransform.Builder(sContext);
|
||||||
@@ -544,15 +542,14 @@ public class IpSecManagerTunnelTest extends IpSecBaseTest {
|
|||||||
// Teardown the test network
|
// Teardown the test network
|
||||||
sTNM.teardownTestNetwork(testNetwork);
|
sTNM.teardownTestNetwork(testNetwork);
|
||||||
|
|
||||||
// Remove addresses and check
|
// Remove addresses and check that interface is still present, but fails lookup-by-addr
|
||||||
tunnelIntf.removeAddress(localInner, innerPrefixLen);
|
tunnelIntf.removeAddress(localInner, innerPrefixLen);
|
||||||
netIntf = NetworkInterface.getByName(tunnelIntf.getInterfaceName());
|
assertNotNull(NetworkInterface.getByName(tunnelIntf.getInterfaceName()));
|
||||||
assertTrue(netIntf.getInterfaceAddresses().isEmpty());
|
assertNull(NetworkInterface.getByInetAddress(localInner));
|
||||||
|
|
||||||
// Check interface was cleaned up
|
// Check interface was cleaned up
|
||||||
tunnelIntf.close();
|
tunnelIntf.close();
|
||||||
netIntf = NetworkInterface.getByName(tunnelIntf.getInterfaceName());
|
assertNull(NetworkInterface.getByName(tunnelIntf.getInterfaceName()));
|
||||||
assertNull(netIntf);
|
|
||||||
} finally {
|
} finally {
|
||||||
if (testNetworkCb != null) {
|
if (testNetworkCb != null) {
|
||||||
sCM.unregisterNetworkCallback(testNetworkCb);
|
sCM.unregisterNetworkCallback(testNetworkCb);
|
||||||
|
|||||||
Reference in New Issue
Block a user