use of com.microsoft.azure.sdk.iot.provisioning.security.hsm.SecurityProviderDiceEmulator in project azure-iot-sdk-java by Azure.
the class SecurityProviderDiceEmulatorTest method getterForAliasCertPemSucceeds.
// SRS_SecurityClientDiceEmulator_25_009: [ This method shall return Alias certificate generated by DICE as PEM string]
@Test
public void getterForAliasCertPemSucceeds() throws Exception {
// arrange
SecurityProviderDiceEmulator testSecurityClientDiceEmulator = new SecurityProviderDiceEmulator(TEST_ALIAS, TEST_SIGNER, TEST_ROOT);
// act
String cert = testSecurityClientDiceEmulator.getAliasCertPem();
// 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 getterForDeviceSignerCertificatesSucceeds.
// SRS_SecurityClientDiceEmulator_25_008: [ This method shall return Signer certificates generated by DICE ]
@Test
public void getterForDeviceSignerCertificatesSucceeds() throws Exception {
// arrange
SecurityProviderDiceEmulator testSecurityClientDiceEmulator = new SecurityProviderDiceEmulator(TEST_ALIAS, TEST_SIGNER, TEST_ROOT);
// act
Collection<X509Certificate> cert = testSecurityClientDiceEmulator.getIntermediateCertificatesChain();
// assert
assertNotNull(cert);
assertFalse(cert.isEmpty());
}
use of com.microsoft.azure.sdk.iot.provisioning.security.hsm.SecurityProviderDiceEmulator in project azure-iot-sdk-java by Azure.
the class SecurityProviderDiceEmulatorTest method generateLeafCertThrowsOnEmptyID.
@Test(expected = SecurityProviderException.class)
public void generateLeafCertThrowsOnEmptyID() throws Exception {
// arrange
SecurityProviderDiceEmulator testSecurityClientDiceEmulator = new SecurityProviderDiceEmulator(TEST_ALIAS, TEST_SIGNER, TEST_ROOT);
// act
testSecurityClientDiceEmulator.generateLeafCert("");
}
use of com.microsoft.azure.sdk.iot.provisioning.security.hsm.SecurityProviderDiceEmulator in project azure-iot-sdk-java by Azure.
the class SecurityProviderDiceEmulatorTest method getterForAliasKeySucceeds.
// SRS_SecurityClientDiceEmulator_25_007: [ This method shall return Alias private key generated by DICE ]
@Test
public void getterForAliasKeySucceeds() throws Exception {
// arrange
SecurityProviderDiceEmulator testSecurityClientDiceEmulator = new SecurityProviderDiceEmulator(TEST_ALIAS, TEST_SIGNER, TEST_ROOT);
// act
Key aliasKey = testSecurityClientDiceEmulator.getClientPrivateKey();
// assert
assertNotNull(aliasKey);
}
use of com.microsoft.azure.sdk.iot.provisioning.security.hsm.SecurityProviderDiceEmulator in project azure-iot-sdk-java by Azure.
the class SecurityProviderDiceEmulatorTest method constructorWithNamesSucceeds.
@Test
public void constructorWithNamesSucceeds() throws Exception {
// act
SecurityProviderDiceEmulator testSecurityClientDiceEmulator = new SecurityProviderDiceEmulator(TEST_ALIAS, TEST_SIGNER, TEST_ROOT);
// assert
assertEquals(TEST_ALIAS, Deencapsulation.getField(testSecurityClientDiceEmulator, "commonNameAlias"));
assertEquals(TEST_SIGNER, Deencapsulation.getField(testSecurityClientDiceEmulator, "commonNameSigner"));
assertEquals(TEST_ROOT, Deencapsulation.getField(testSecurityClientDiceEmulator, "commonNameRoot"));
}
Aggregations