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());