From 74ab262bc080aa92257bf72047cfe166c2e7ff6a Mon Sep 17 00:00:00 2001 From: chubtub <43381989+chubtub@users.noreply.github.com> Date: Thu, 29 Feb 2024 10:43:11 -0500 Subject: [PATCH] Revert "Parse the signing cert authority key identifier during signing and place in " This reverts commit 63e184f9a36d1676f712f711c58e415f4032acf5. --- .../src/main/java/hirs/swid/CredentialParser.java | 12 +++++------- .../src/main/java/hirs/swid/SwidTagGateway.java | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/tools/tcg_rim_tool/src/main/java/hirs/swid/CredentialParser.java b/tools/tcg_rim_tool/src/main/java/hirs/swid/CredentialParser.java index 5ab6dbfa..013095d8 100644 --- a/tools/tcg_rim_tool/src/main/java/hirs/swid/CredentialParser.java +++ b/tools/tcg_rim_tool/src/main/java/hirs/swid/CredentialParser.java @@ -278,19 +278,17 @@ public class CredentialParser { } /** - * This method returns the authorityKeyIdentifier from the local X509Certificate. - * @return the String representation of the AKI + * This method returns the subjectKeyIdentifier from the local X509Certificate. + * @return the String representation of the subjectKeyIdentifier * @throws IOException */ - public String getCertificateAuthorityKeyIdentifier() throws IOException { + public String getCertificateSubjectKeyIdentifier() throws IOException { String decodedValue = null; - byte[] extension = certificate.getExtensionValue(Extension.authorityKeyIdentifier.getId()); + byte[] extension = certificate.getExtensionValue(Extension.subjectKeyIdentifier.getId()); if (extension != null && extension.length > 0) { decodedValue = JcaX509ExtensionUtils.parseExtensionValue(extension).toString(); } - //decodedValue above is of the form [[CONTEXT 0]#e0f...], parse out the extraneous chars - decodedValue = decodedValue.substring(decodedValue.indexOf("#")+1,decodedValue.length()-1); - return decodedValue; + return decodedValue.substring(1);//Drop the # at the beginning of the string } /** diff --git a/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java b/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java index 45b72476..aa9b23d2 100644 --- a/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java +++ b/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java @@ -646,7 +646,7 @@ public class SwidTagGateway { } } try { - KeyName keyName = kiFactory.newKeyName(cp.getCertificateAuthorityKeyIdentifier()); + KeyName keyName = kiFactory.newKeyName(cp.getCertificateSubjectKeyIdentifier()); keyInfoElements.add(keyName); } catch (IOException e) { System.out.println("Error while getting SKID: " + e.getMessage());