Search in sources :

Example 1 with SignatureSupportingConfigProperties

use of org.eclipse.hono.config.SignatureSupportingConfigProperties in project hono by eclipse.

the class BaseRegistrationServiceTest method init.

/**
 * Initializes common properties.
 */
@BeforeClass
public static void init() {
    vertx = mock(Vertx.class);
    props = new SignatureSupportingConfigProperties();
    props.setSharedSecret(secret);
}
Also used : Vertx(io.vertx.core.Vertx) SignatureSupportingConfigProperties(org.eclipse.hono.config.SignatureSupportingConfigProperties) BeforeClass(org.junit.BeforeClass)

Example 2 with SignatureSupportingConfigProperties

use of org.eclipse.hono.config.SignatureSupportingConfigProperties in project hono by eclipse.

the class RegistrationAssertionHelperImplTest method testForSigningWorksWithRsaSignatures.

/**
 * Verifies that signatures created using an RSA private key can be validated using the corresponding public key.
 */
@Test
public void testForSigningWorksWithRsaSignatures() {
    SignatureSupportingConfigProperties props = new SignatureSupportingConfigProperties();
    props.setKeyPath("target/certs/hono-messaging-key.pem");
    props.setCertPath("target/certs/hono-messaging-cert.pem");
    RegistrationAssertionHelper factory = RegistrationAssertionHelperImpl.forSigning(vertx, props);
    String assertion = factory.getAssertion("tenant", "device");
    assertNotNull(assertion);
    RegistrationAssertionHelper validator = RegistrationAssertionHelperImpl.forValidating(vertx, props);
    assertTrue(validator.isValid(assertion, "tenant", "device"));
}
Also used : SignatureSupportingConfigProperties(org.eclipse.hono.config.SignatureSupportingConfigProperties) Test(org.junit.Test)

Aggregations

SignatureSupportingConfigProperties (org.eclipse.hono.config.SignatureSupportingConfigProperties)2 Vertx (io.vertx.core.Vertx)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1