Search in sources :

Example 1 with Configuration

use of org.eclipse.californium.elements.config.Configuration in project californium by eclipse.

the class LibCoapClientGnuTlsInteroperabilityTest method testLibCoapClientPskNoSessionId.

@Test
public void testLibCoapClientPskNoSessionId() throws Exception {
    CipherSuite cipherSuite = CipherSuite.TLS_PSK_WITH_AES_128_CCM_8;
    DtlsConnectorConfig.Builder builder = DtlsConnectorConfig.builder(new Configuration()).set(DtlsConfig.DTLS_SERVER_USE_SESSION_ID, false);
    californiumUtil.start(BIND, builder, null, cipherSuite);
    processUtil.startupClient(DESTINATION_URL + "test", PSK, "Hello, CoAP!", cipherSuite);
    connect("Hello, CoAP!", "Greetings!");
    californiumUtil.assertPrincipalType(PreSharedKeyIdentity.class);
}
Also used : Configuration(org.eclipse.californium.elements.config.Configuration) CipherSuite(org.eclipse.californium.scandium.dtls.cipher.CipherSuite) DtlsConnectorConfig(org.eclipse.californium.scandium.config.DtlsConnectorConfig) Test(org.junit.Test)

Example 2 with Configuration

use of org.eclipse.californium.elements.config.Configuration in project californium by eclipse.

the class LibCoapClientOpensslInteroperabilityTest method testLibCoapClientPskNoSessionId.

@Test
public void testLibCoapClientPskNoSessionId() throws Exception {
    CipherSuite cipherSuite = CipherSuite.TLS_PSK_WITH_AES_128_CCM_8;
    DtlsConnectorConfig.Builder builder = DtlsConnectorConfig.builder(new Configuration()).set(DtlsConfig.DTLS_SERVER_USE_SESSION_ID, false);
    californiumUtil.start(BIND, builder, null, cipherSuite);
    processUtil.startupClient(DESTINATION_URL + "test", PSK, "Hello, CoAP!", cipherSuite);
    connect("Hello, CoAP!", "Greetings!");
    californiumUtil.assertPrincipalType(PreSharedKeyIdentity.class);
}
Also used : Configuration(org.eclipse.californium.elements.config.Configuration) CipherSuite(org.eclipse.californium.scandium.dtls.cipher.CipherSuite) DtlsConnectorConfig(org.eclipse.californium.scandium.config.DtlsConnectorConfig) Test(org.junit.Test)

Example 3 with Configuration

use of org.eclipse.californium.elements.config.Configuration in project californium by eclipse.

the class LibCoapClientOpensslInteroperabilityTest method testLibCoapClientPskMultiFragment.

@Test
public void testLibCoapClientPskMultiFragment() throws Exception {
    CipherSuite cipherSuite = CipherSuite.TLS_PSK_WITH_AES_128_CCM_8;
    DtlsConnectorConfig.Builder builder = DtlsConnectorConfig.builder(new Configuration()).set(DtlsConfig.DTLS_USE_MULTI_HANDSHAKE_MESSAGE_RECORDS, true);
    californiumUtil.start(BIND, builder, null, cipherSuite);
    processUtil.startupClient(DESTINATION_URL + "test", PSK, "Hello, CoAP!", cipherSuite);
    connect("Hello, CoAP!", "Greetings!");
    californiumUtil.assertPrincipalType(PreSharedKeyIdentity.class);
}
Also used : Configuration(org.eclipse.californium.elements.config.Configuration) CipherSuite(org.eclipse.californium.scandium.dtls.cipher.CipherSuite) DtlsConnectorConfig(org.eclipse.californium.scandium.config.DtlsConnectorConfig) Test(org.junit.Test)

Example 4 with Configuration

use of org.eclipse.californium.elements.config.Configuration in project californium by eclipse.

the class LibCoapClientTinyDtlsInteroperabilityTest method testLibCoapClientTinyDtlsPskMultiFragment.

@Ignore
@Test
public void testLibCoapClientTinyDtlsPskMultiFragment() throws Exception {
    CipherSuite cipherSuite = CipherSuite.TLS_PSK_WITH_AES_128_CCM_8;
    DtlsConnectorConfig.Builder builder = DtlsConnectorConfig.builder(new Configuration()).set(DtlsConfig.DTLS_USE_MULTI_HANDSHAKE_MESSAGE_RECORDS, true);
    californiumUtil.start(BIND, builder, null, cipherSuite);
    processUtil.startupClient(DESTINATION_URL + "test", PSK, "Hello, CoAP!", cipherSuite);
    connect("Hello, CoAP!", "Greetings!");
    californiumUtil.assertPrincipalType(PreSharedKeyIdentity.class);
}
Also used : Configuration(org.eclipse.californium.elements.config.Configuration) CipherSuite(org.eclipse.californium.scandium.dtls.cipher.CipherSuite) DtlsConnectorConfig(org.eclipse.californium.scandium.config.DtlsConnectorConfig) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 5 with Configuration

use of org.eclipse.californium.elements.config.Configuration in project californium by eclipse.

the class LibCoapClientTinyDtlsInteroperabilityTest method testLibCoapClientTinyDtlsRpkAnonymousClient.

@Test
public void testLibCoapClientTinyDtlsRpkAnonymousClient() throws Exception {
    processUtil.assumeMinVersion("4.3.0");
    CipherSuite cipherSuite = CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8;
    Configuration configuration = new Configuration();
    configuration.set(DtlsConfig.DTLS_CLIENT_AUTHENTICATION_MODE, CertificateAuthenticationMode.NONE);
    DtlsConnectorConfig.Builder builder = DtlsConnectorConfig.builder(configuration);
    californiumUtil.start(BIND, builder, null, cipherSuite);
    processUtil.startupClient(DESTINATION_URL + "test", RPK, "Hello, CoAP!", cipherSuite);
    connect("Hello, CoAP!", "Greetings!", "certificate \\(11\\)");
    assertNull(californiumUtil.getPrincipal());
}
Also used : Configuration(org.eclipse.californium.elements.config.Configuration) CipherSuite(org.eclipse.californium.scandium.dtls.cipher.CipherSuite) DtlsConnectorConfig(org.eclipse.californium.scandium.config.DtlsConnectorConfig) Test(org.junit.Test)

Aggregations

Configuration (org.eclipse.californium.elements.config.Configuration)152 Test (org.junit.Test)55 DtlsConnectorConfig (org.eclipse.californium.scandium.config.DtlsConnectorConfig)52 CoapEndpoint (org.eclipse.californium.core.network.CoapEndpoint)44 CipherSuite (org.eclipse.californium.scandium.dtls.cipher.CipherSuite)30 CoapServer (org.eclipse.californium.core.CoapServer)24 InetSocketAddress (java.net.InetSocketAddress)21 Before (org.junit.Before)19 DTLSConnector (org.eclipse.californium.scandium.DTLSConnector)16 Endpoint (org.eclipse.californium.core.network.Endpoint)14 CoapResource (org.eclipse.californium.core.CoapResource)7 MessageTracer (org.eclipse.californium.core.network.interceptors.MessageTracer)7 Response (org.eclipse.californium.core.coap.Response)6 Exchange (org.eclipse.californium.core.network.Exchange)6 CoapExchange (org.eclipse.californium.core.server.resources.CoapExchange)6 AdvancedSinglePskStore (org.eclipse.californium.scandium.dtls.pskstore.AdvancedSinglePskStore)6 InetAddress (java.net.InetAddress)5 CoapClient (org.eclipse.californium.core.CoapClient)5 Request (org.eclipse.californium.core.coap.Request)5 Builder (org.eclipse.californium.scandium.config.DtlsConnectorConfig.Builder)5