Added a null check for the endorsement credential for the tpm 1.2

This commit is contained in:
Cyrus 2020-12-18 06:58:18 -05:00
parent a7eae2fd77
commit 6dd948c828
2 changed files with 5 additions and 6 deletions

View File

@ -1263,12 +1263,8 @@ public abstract class AbstractAttestationCertificateAuthority
Extension authKeyIdentifier = null; Extension authKeyIdentifier = null;
try { authKeyIdentifier = IssuedCertificateAttributeHelper
authKeyIdentifier = IssuedCertificateAttributeHelper .buildAuthorityKeyIdentifier(endorsementCredential);
.buildAuthorityKeyIdentifier(endorsementCredential);
} catch (Exception ex) {
LOG.error("Test");
}
builder.addExtension(subjectAlternativeName); builder.addExtension(subjectAlternativeName);
if (authKeyIdentifier != null) { if (authKeyIdentifier != null) {

View File

@ -76,6 +76,9 @@ public final class IssuedCertificateAttributeHelper {
*/ */
public static Extension buildAuthorityKeyIdentifier( public static Extension buildAuthorityKeyIdentifier(
final EndorsementCredential endorsementCredential) throws IOException { final EndorsementCredential endorsementCredential) throws IOException {
if (endorsementCredential == null || endorsementCredential.getX509Certificate() == null) {
return null;
}
byte[] extValue = endorsementCredential.getX509Certificate() byte[] extValue = endorsementCredential.getX509Certificate()
.getExtensionValue(Extension.authorityKeyIdentifier.getId()); .getExtensionValue(Extension.authorityKeyIdentifier.getId());