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);
}
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"));
}
Aggregations