|
From: Ahmed R. <ahm...@gm...> - 2009-02-26 13:32:22
|
Good Day All,
I am using JTss and JTPM-Tools to try the Quote and validation concept.
My problems lies that I am not able to load any of the keys created (AIK particular).
Added below my code, and error message.
TcIContext context = CommonSettings.getTssFactory().newContextObject();
context.connect(CommonSettings.getHostname());
TcITpm tpm = context.getTpmObject();
// load Storage Root Key
TcBlobData srkSecret = TcBlobData.newByteArray(TcTssConstants.TSS_WELL_KNOWN_SECRET);
long srkSecretMode = TcTssConstants.TSS_SECRET_MODE_SHA1;
TcIRsaKey srk = context.loadKeyByUuidFromSystem(TcUuidFactory.getInstance().getUuidSRK());
TcIPolicy srkPolicy = context.createPolicyObject(TcTssConstants.TSS_POLICY_USAGE);
srkPolicy.setSecret(srkSecretMode, srkSecret);
srkPolicy.assignToObject(srk);
byte nonce[] = {0x1, 0x2, 0x3, 0x4, 0x5, 0x1, 0x2, 0x3, 0x4, 0x5, 0x1, 0x2,
0x3, 0x4, 0x5, 0x1, 0x2, 0x3, 0x4, 0x5};
// create a TCBlobData using the provided nonce
TcBlobData nonceData = TcBlobData.newByteArray(nonce);
TcTssValidation nonceVal = new TcTssValidation();
nonceVal.setExternalData(nonceData);
// the tpmQuote to receive data from tpm's quote
TcTssValidation tpmQuote = new TcTssValidation();
context.connect(null); // connect to localhost
// get the number of PCRs from TPM
TcBlobData subCap = TcBlobData.newUINT32((int) TcTssConstants.TSS_TPMCAP_PROP_PCR);
long numPCRs = tpm.getCapabilityUINT32(TcTssConstants.TSS_TPMCAP_PROPERTY, subCap);
for (int i = 0; i < numPCRs; i++) {
// create a pcr composite object
TcIPcrComposite pcrComp = context.createPcrCompositeObject(0);
pcrComp.selectPcrIndex(i);
// set pcr value to read
pcrComp.setPcrValue(i, tpm.pcrRead(i));
// create the UUID of the AIK
TcTssUuid uuid = new TcTssUuid().initString("00000001-0002-0003-0405-5fd0073c8832");
// set the key password
TcBlobData keySecret = TcBlobData.newString("keypass", false, "UTF-16LE");
// the AIK
TcIRsaKey identityKey = context.getKeyByUuid(TcTssConstants.TSS_PS_TYPE_SYSTEM, uuid);
TcIPolicy keyUsgPolicy = context.createPolicyObject(TcTssConstants.TSS_POLICY_USAGE);
keyUsgPolicy.setSecret(TcTssConstants.TSS_SECRET_MODE_NONE, keySecret);
keyUsgPolicy.assignToObject(identityKey);
=======================================================================
identityKey.loadKey(srk); // ERROR LOADING THE KEY
=======================================================================
// now get the quote
tpmQuote = tpm.quote(identityKey, pcrComp, nonceVal);
=======================================================================
Error Message:
============
iaik.tc.tss.api.exceptions.tcs.TcTpmException:
TSS Error:
error layer: 0x00 (TPM)
error code (without layer): 0x21
error code (full): 0x21
error message: The decryption process did not complete.
=++=============================================++=
Libaries
======
TPM-Emaulator 0.5
TCLinux:/home/aramadan/Desktop/Java/jTpmTools_0.3c # ./jtt.sh version
JTpmTools: 0.3c 20080605 10:56:50
JTSS_TSP: 0.4 20081218 10:30:08
JTSS_JNI: 0.3.1 20071128 9:44:59
XKMS: 0.2a-20080605-153902
TCcert: 0.2.2a-20080709-114558
Any comments are welcome.
Regards, Dan
_________________________________________________________________
Windows Live™ Hotmail®:…more than just e-mail.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_explore_022009 |