mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-18 20:47:58 +00:00
Additional changes
This commit is contained in:
parent
0a89846f4c
commit
b7ac1e06da
@ -328,7 +328,7 @@ public class CertificateTest {
|
||||
*/
|
||||
@Test
|
||||
public void testX509AttributeCertificateParsingExtended()
|
||||
throws IOException, URISyntaxException, UnsupportedOperationException {
|
||||
throws IOException, URISyntaxException {
|
||||
Certificate platformCert = getTestCertificate(
|
||||
PlatformCredential.class, PlatformCredentialTest.TEST_PLATFORM_CERT_6);
|
||||
|
||||
|
@ -211,7 +211,13 @@ public class PlatformCredentialTest {
|
||||
URL resource = this.getClass().getResource(TEST_PLATFORM_CERT_2);
|
||||
Path certPath = Paths.get(resource.toURI());
|
||||
|
||||
PlatformCredential credential = new PlatformCredential(certPath);
|
||||
PlatformCredential credential = null;
|
||||
try {
|
||||
credential = new PlatformCredential(certPath);
|
||||
} catch (UnsupportedOperationException uoEx) {
|
||||
|
||||
}
|
||||
Assertions.assertNotNull(credential);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
calendar.set(2017, 2, 23, 22, 34, 33);
|
||||
@ -227,8 +233,7 @@ public class PlatformCredentialTest {
|
||||
Assertions.assertEquals(sigStr.toUpperCase(), EXPECTED_CERT_SIGNATURE_FOR_CERT_2);
|
||||
|
||||
String issuer = Certificate.getAttributeCertificateIssuerNames(
|
||||
credential.getAttributeCertificate().getAcinfo().getIssuer()
|
||||
)[0].toString();
|
||||
credential.getAttributeCertificate().getAcinfo().getIssuer())[0].toString();
|
||||
|
||||
Assertions.assertEquals(credential.getManufacturer(), "Intel");
|
||||
Assertions.assertEquals(credential.getModel(), "DE3815TYKH");
|
||||
@ -260,7 +265,13 @@ public class PlatformCredentialTest {
|
||||
URL resource = this.getClass().getResource(TEST_PLATFORM_CERT_3);
|
||||
Path certPath = Paths.get(resource.toURI());
|
||||
|
||||
PlatformCredential credential = new PlatformCredential(certPath);
|
||||
PlatformCredential credential = null;
|
||||
try {
|
||||
credential = new PlatformCredential(certPath);
|
||||
} catch (UnsupportedOperationException uoEx) {
|
||||
|
||||
}
|
||||
Assertions.assertNotNull(credential);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
calendar.set(2017, 2, 23, 22, 34, 33);
|
||||
@ -308,7 +319,13 @@ public class PlatformCredentialTest {
|
||||
URL resource = this.getClass().getResource(TEST_PLATFORM_CERT_4);
|
||||
Path certPath = Paths.get(resource.toURI());
|
||||
|
||||
PlatformCredential credential = new PlatformCredential(certPath);
|
||||
PlatformCredential credential = null;
|
||||
try {
|
||||
credential = new PlatformCredential(certPath);
|
||||
} catch (UnsupportedOperationException uoEx) {
|
||||
|
||||
}
|
||||
Assertions.assertNotNull(credential);
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
@ -325,8 +342,7 @@ public class PlatformCredentialTest {
|
||||
Assertions.assertEquals(sigStr.toUpperCase(), EXPECTED_CERT_SIGNATURE_FOR_CERT_4);
|
||||
|
||||
String issuer = Certificate.getAttributeCertificateIssuerNames(
|
||||
credential.getAttributeCertificate().getAcinfo().getIssuer()
|
||||
)[0].toString();
|
||||
credential.getAttributeCertificate().getAcinfo().getIssuer())[0].toString();
|
||||
|
||||
Assertions.assertEquals(credential.getManufacturer(), "Intel");
|
||||
Assertions.assertEquals(credential.getModel(), "DE3815TYKH");
|
||||
@ -353,7 +369,13 @@ public class PlatformCredentialTest {
|
||||
URL resource = this.getClass().getResource(TEST_PLATFORM_CERT_5);
|
||||
Path certPath = Paths.get(resource.toURI());
|
||||
|
||||
PlatformCredential credential = new PlatformCredential(certPath);
|
||||
PlatformCredential credential = null;
|
||||
try {
|
||||
credential = new PlatformCredential(certPath);
|
||||
} catch (UnsupportedOperationException uoEx) {
|
||||
|
||||
}
|
||||
Assertions.assertNotNull(credential);
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
@ -370,8 +392,7 @@ public class PlatformCredentialTest {
|
||||
Assertions.assertEquals(sigStr.toUpperCase(), EXPECTED_CERT_SIGNATURE_FOR_CERT_5);
|
||||
|
||||
String issuer = Certificate.getAttributeCertificateIssuerNames(
|
||||
credential.getAttributeCertificate().getAcinfo().getIssuer()
|
||||
)[0].toString();
|
||||
credential.getAttributeCertificate().getAcinfo().getIssuer())[0].toString();
|
||||
|
||||
Assertions.assertEquals(credential.getManufacturer(), "Intel");
|
||||
Assertions.assertEquals(credential.getModel(), "DE3815TYKH");
|
||||
@ -393,12 +414,18 @@ public class PlatformCredentialTest {
|
||||
* @throws URISyntaxException if there is a problem constructing the cert's URI
|
||||
*/
|
||||
@Test
|
||||
public final void testIsIssuer() throws IOException, URISyntaxException, UnsupportedOperationException {
|
||||
public final void testIsIssuer() throws IOException, URISyntaxException {
|
||||
|
||||
URL resource = this.getClass().getResource(TEST_PLATFORM_CERT2_1);
|
||||
Path certPath = Paths.get(resource.toURI());
|
||||
|
||||
PlatformCredential platformCert = new PlatformCredential(certPath);
|
||||
PlatformCredential platformCert = null;
|
||||
try {
|
||||
platformCert = new PlatformCredential(certPath);
|
||||
} catch (UnsupportedOperationException uoEx) {
|
||||
|
||||
}
|
||||
Assertions.assertNotNull(platformCert);
|
||||
|
||||
Certificate issuer = new CertificateAuthorityCredential(
|
||||
Base64.decode(EXPECTED_CERT_SIGNATURE_FOR_CERT2_1));
|
||||
@ -414,12 +441,18 @@ public class PlatformCredentialTest {
|
||||
* @throws URISyntaxException if there is a problem constructing the cert's URI
|
||||
*/
|
||||
@Test
|
||||
public final void testPlatformConfiguration() throws IOException, URISyntaxException, UnsupportedOperationException {
|
||||
public final void testPlatformConfiguration() throws IOException, URISyntaxException {
|
||||
|
||||
URL resource = this.getClass().getResource(TEST_PLATFORM_CERT2_1);
|
||||
Path certPath = Paths.get(resource.toURI());
|
||||
|
||||
PlatformCredential platformCert = new PlatformCredential(certPath);
|
||||
PlatformCredential platformCert = null;
|
||||
try {
|
||||
platformCert = new PlatformCredential(certPath);
|
||||
} catch (UnsupportedOperationException uoEx) {
|
||||
|
||||
}
|
||||
Assertions.assertNotNull(platformCert);
|
||||
PlatformConfiguration platformConfig = platformCert.getPlatformConfiguration();
|
||||
|
||||
//Check component identifier
|
||||
@ -502,12 +535,18 @@ public class PlatformCredentialTest {
|
||||
* @throws URISyntaxException if there is a problem constructing the cert's URI
|
||||
*/
|
||||
@Test
|
||||
public final void testPlatformConfiguration2() throws IOException, URISyntaxException, UnsupportedOperationException {
|
||||
public final void testPlatformConfiguration2() throws IOException, URISyntaxException {
|
||||
|
||||
URL resource = this.getClass().getResource(TEST_PLATFORM_CERT2_2);
|
||||
Path certPath = Paths.get(resource.toURI());
|
||||
|
||||
PlatformCredential platformCert = new PlatformCredential(certPath);
|
||||
PlatformCredential platformCert = null;
|
||||
try {
|
||||
platformCert = new PlatformCredential(certPath);
|
||||
} catch (UnsupportedOperationException uoEx) {
|
||||
|
||||
}
|
||||
Assertions.assertNotNull(platformCert);
|
||||
PlatformConfiguration platformConfig = platformCert.getPlatformConfiguration();
|
||||
|
||||
//Check component identifier
|
||||
@ -540,12 +579,18 @@ public class PlatformCredentialTest {
|
||||
* @throws URISyntaxException if there is a problem constructing the cert's URI
|
||||
*/
|
||||
@Test
|
||||
public final void testPlatformConfiguration3() throws IOException, URISyntaxException, UnsupportedOperationException {
|
||||
public final void testPlatformConfiguration3() throws IOException, URISyntaxException {
|
||||
|
||||
URL resource = this.getClass().getResource(TEST_PLATFORM_CERT2_3);
|
||||
Path certPath = Paths.get(resource.toURI());
|
||||
|
||||
PlatformCredential platformCert = new PlatformCredential(certPath);
|
||||
PlatformCredential platformCert = null;
|
||||
try {
|
||||
platformCert = new PlatformCredential(certPath);
|
||||
} catch (UnsupportedOperationException uoEx) {
|
||||
|
||||
}
|
||||
Assertions.assertNotNull(platformCert);
|
||||
PlatformConfiguration platformConfig = platformCert.getPlatformConfiguration();
|
||||
|
||||
//Check component identifier
|
||||
@ -613,12 +658,18 @@ public class PlatformCredentialTest {
|
||||
* @throws URISyntaxException if there is a problem constructing the cert's URI
|
||||
*/
|
||||
@Test
|
||||
public final void testPlatformConfiguration4() throws IOException, URISyntaxException, UnsupportedOperationException {
|
||||
public final void testPlatformConfiguration4() throws IOException, URISyntaxException {
|
||||
|
||||
URL resource = this.getClass().getResource(TEST_PLATFORM_CERT2_4);
|
||||
Path certPath = Paths.get(resource.toURI());
|
||||
|
||||
PlatformCredential platformCert = new PlatformCredential(certPath);
|
||||
PlatformCredential platformCert = null;
|
||||
try {
|
||||
platformCert = new PlatformCredential(certPath);
|
||||
} catch (UnsupportedOperationException uoEx) {
|
||||
|
||||
}
|
||||
Assertions.assertNotNull(platformCert);
|
||||
PlatformConfiguration platformConfig = platformCert.getPlatformConfiguration();
|
||||
|
||||
//Check component identifier
|
||||
@ -686,12 +737,18 @@ public class PlatformCredentialTest {
|
||||
* @throws URISyntaxException if there is a problem constructing the cert's URI
|
||||
*/
|
||||
@Test
|
||||
public final void testPlatformConfiguration5() throws IOException, URISyntaxException, UnsupportedOperationException {
|
||||
public final void testPlatformConfiguration5() throws IOException, URISyntaxException {
|
||||
|
||||
URL resource = this.getClass().getResource(TEST_PLATFORM_CERT2_SPEC2);
|
||||
Path certPath = Paths.get(resource.toURI());
|
||||
|
||||
PlatformCredential platformCert = new PlatformCredential(certPath);
|
||||
PlatformCredential platformCert = null;
|
||||
try {
|
||||
platformCert = new PlatformCredential(certPath);
|
||||
} catch (UnsupportedOperationException uoEx) {
|
||||
|
||||
}
|
||||
Assertions.assertNotNull(platformCert);
|
||||
PlatformConfiguration platformConfig = platformCert.getPlatformConfiguration();
|
||||
|
||||
//Check component identifier
|
||||
@ -731,12 +788,18 @@ public class PlatformCredentialTest {
|
||||
* @throws URISyntaxException if there is a problem constructing the cert's URI
|
||||
*/
|
||||
@Test
|
||||
public final void testPlatformConfiguration6() throws IOException, URISyntaxException, UnsupportedOperationException {
|
||||
public final void testPlatformConfiguration6() throws IOException, URISyntaxException {
|
||||
|
||||
URL resource = this.getClass().getResource(TEST_BASE_PLATFORM_CERT_1);
|
||||
Path certPath = Paths.get(resource.toURI());
|
||||
|
||||
PlatformCredential platformCert = new PlatformCredential(certPath);
|
||||
PlatformCredential platformCert = null;
|
||||
try {
|
||||
platformCert = new PlatformCredential(certPath);
|
||||
} catch (UnsupportedOperationException uoEx) {
|
||||
|
||||
}
|
||||
Assertions.assertNotNull(platformCert);
|
||||
PlatformConfiguration platformConfig = platformCert.getPlatformConfiguration();
|
||||
|
||||
Assertions.assertTrue(platformConfig instanceof PlatformConfigurationV2);
|
||||
@ -758,10 +821,15 @@ public class PlatformCredentialTest {
|
||||
* @throws IOException if there is a problem reading the cert file
|
||||
*/
|
||||
@Test
|
||||
public final void testSmallNewPlatformCredential() throws URISyntaxException, IOException, UnsupportedOperationException {
|
||||
public final void testSmallNewPlatformCredential() throws URISyntaxException, IOException {
|
||||
Path path = Paths.get(this.getClass().getResource(
|
||||
"/validation/platform_credentials_2/small_attribute_cert_2187.pem").toURI());
|
||||
PlatformCredential credential = new PlatformCredential(path);
|
||||
PlatformCredential credential = null;
|
||||
try {
|
||||
credential = new PlatformCredential(path);
|
||||
} catch (UnsupportedOperationException uoEx) {
|
||||
|
||||
}
|
||||
Assertions.assertNotNull(credential);
|
||||
}
|
||||
|
||||
@ -772,10 +840,15 @@ public class PlatformCredentialTest {
|
||||
* @throws URISyntaxException if there is a problem constructing the cert's URI
|
||||
*/
|
||||
@Test
|
||||
public final void testMediumNewPlatformCredential() throws URISyntaxException, IOException, UnsupportedOperationException {
|
||||
public final void testMediumNewPlatformCredential() throws URISyntaxException, IOException {
|
||||
Path path = Paths.get(this.getClass().getResource(
|
||||
"/validation/platform_credentials_2/medium_attribute_cert_2187.pem").toURI());
|
||||
PlatformCredential credential = new PlatformCredential(path);
|
||||
PlatformCredential credential = null;
|
||||
try {
|
||||
credential = new PlatformCredential(path);
|
||||
} catch (UnsupportedOperationException uoEx) {
|
||||
|
||||
}
|
||||
Assertions.assertNotNull(credential);
|
||||
}
|
||||
|
||||
@ -786,10 +859,15 @@ public class PlatformCredentialTest {
|
||||
* @throws URISyntaxException if there is a problem constructing the cert's URI
|
||||
*/
|
||||
@Test
|
||||
public final void testLargeNewPlatformCredential() throws URISyntaxException, IOException, UnsupportedOperationException {
|
||||
public final void testLargeNewPlatformCredential() throws URISyntaxException, IOException {
|
||||
Path path = Paths.get(this.getClass().getResource(
|
||||
"/validation/platform_credentials_2/large_attribute_cert_2187.pem").toURI());
|
||||
PlatformCredential credential = new PlatformCredential(path);
|
||||
PlatformCredential credential = null;
|
||||
try {
|
||||
credential = new PlatformCredential(path);
|
||||
} catch (UnsupportedOperationException uoEx) {
|
||||
|
||||
}
|
||||
Assertions.assertNotNull(credential);
|
||||
}
|
||||
|
||||
@ -800,10 +878,15 @@ public class PlatformCredentialTest {
|
||||
* @throws URISyntaxException if there is a problem constructing the cert's URI
|
||||
*/
|
||||
@Test
|
||||
public final void testFlawedNewPlatformCredential() throws URISyntaxException, IOException, UnsupportedOperationException {
|
||||
public final void testFlawedNewPlatformCredential() throws URISyntaxException, IOException {
|
||||
Path path = Paths.get(this.getClass().getResource(
|
||||
"/validation/platform_credentials_2/flawed_attribute_cert_2187.pem").toURI());
|
||||
PlatformCredential credential = new PlatformCredential(path);
|
||||
PlatformCredential credential = null;
|
||||
try {
|
||||
credential = new PlatformCredential(path);
|
||||
} catch (UnsupportedOperationException uoEx) {
|
||||
|
||||
}
|
||||
Assertions.assertNotNull(credential);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user