use of com.microsoft.azure.sdk.iot.provisioning.security.hsm.SecurityProviderDiceEmulator in project azure-iot-sdk-java by Azure.
the class SecurityProviderDiceEmulatorTest method getterForRootCertPemSucceeds.
// SRS_SecurityClientDiceEmulator_25_011: [ This method shall return Root certificate generated by DICE as PEM string ]
@Test
public void getterForRootCertPemSucceeds() throws Exception {
// arrange
SecurityProviderDiceEmulator testSecurityClientDiceEmulator = new SecurityProviderDiceEmulator(TEST_ALIAS, TEST_SIGNER, TEST_ROOT);
// act
String cert = testSecurityClientDiceEmulator.getRootCertPem();
// assert
assertNotNull(cert);
}
use of com.microsoft.azure.sdk.iot.provisioning.security.hsm.SecurityProviderDiceEmulator in project azure-iot-sdk-java by Azure.
the class SecurityProviderDiceEmulatorTest method constructorSucceeds.
// SRS_SecurityClientDiceEmulator_25_001: [ Constructor shall create a default unique names for Alias Certificate, Signer Certificate and Root certificate ]
// SRS_SecurityClientDiceEmulator_25_002: [ Constructor shall create a diceBundle by calling CreateDeviceAuthBundle ]
@Test
public void constructorSucceeds() throws Exception {
// act
SecurityProviderDiceEmulator testSecurityClientDiceEmulator = new SecurityProviderDiceEmulator();
// assert
assertNotNull(Deencapsulation.getField(testSecurityClientDiceEmulator, "commonNameAlias"));
assertNotNull(Deencapsulation.getField(testSecurityClientDiceEmulator, "commonNameSigner"));
assertNotNull(Deencapsulation.getField(testSecurityClientDiceEmulator, "commonNameRoot"));
}
use of com.microsoft.azure.sdk.iot.provisioning.security.hsm.SecurityProviderDiceEmulator in project azure-iot-sdk-java by Azure.
the class SecurityProviderDiceEmulatorTest method getterForSignerCertPemSucceeds.
// SRS_SecurityClientDiceEmulator_25_010: [ This method shall return Signer certificate generated by DICE as PEM string ]
@Test
public void getterForSignerCertPemSucceeds() throws Exception {
// arrange
SecurityProviderDiceEmulator testSecurityClientDiceEmulator = new SecurityProviderDiceEmulator(TEST_ALIAS, TEST_SIGNER, TEST_ROOT);
// act
String cert = testSecurityClientDiceEmulator.getSignerCertPem();
// assert
assertNotNull(cert);
}
use of com.microsoft.azure.sdk.iot.provisioning.security.hsm.SecurityProviderDiceEmulator in project azure-iot-sdk-java by Azure.
the class SecurityProviderDiceEmulatorTest method generateLeafCertThrowsOnNullID.
// SRS_SecurityClientDiceEmulator_25_012: [ This method shall return Leaf certificate generated by DICE with unique ID as common Name in PEM Format ]
@Test(expected = SecurityProviderException.class)
public void generateLeafCertThrowsOnNullID() throws Exception {
// arrange
SecurityProviderDiceEmulator testSecurityClientDiceEmulator = new SecurityProviderDiceEmulator(TEST_ALIAS, TEST_SIGNER, TEST_ROOT);
// act
testSecurityClientDiceEmulator.generateLeafCert(null);
}
use of com.microsoft.azure.sdk.iot.provisioning.security.hsm.SecurityProviderDiceEmulator in project azure-iot-sdk-java by Azure.
the class SecurityProviderDiceEmulatorTest method getterForCommonNameSucceeds.
// SRS_SecurityClientDiceEmulator_25_005: [ This method shall return Root certificate name as common name ]
@Test
public void getterForCommonNameSucceeds() throws Exception {
// arrange
SecurityProviderDiceEmulator testSecurityClientDiceEmulator = new SecurityProviderDiceEmulator(TEST_ALIAS, TEST_SIGNER, TEST_ROOT);
// act
String cName = testSecurityClientDiceEmulator.getClientCertificateCommonName();
// assert
assertEquals(cName, TEST_ALIAS);
}
Aggregations