java - TPM 32-bit key handles -
i've been exploring tpm world , have tried out few different libraries (i.e. trousers, jtss, jsr321, , tpm/j). based on number of requirements tpm/j fits bill , i'm able accomplish majority of operations necessary binding/unbinding, signing/verifying, etc.
however 1 issue have come across key handle. according specs issued trusted computing group, 1.2 , 2.0, both declare key handles 32-bit values. when run tpm/j , load key tpm issues key outside of 32-bit space.
for example if run following command:
sudo java edu.mit.csail.tpmj.tools.tpmloadkey testkey.key srk ""
i receive following output:
parsing command-line arguments ... using srk parent. parentpwd = null, encoded (null [no authorization]) = null read testkey.key ... loading key tpm ... keyhandle = 0xc5e94bf9
if calculations (and online conversion tools found) correct key handle above computes 3,320,400,889 outside 32-bits. believe 32-bit signed values limited around 2 billion.
this becomes problem because when issue following command:
sudo java -cp $classpath edu.mit.csail.tpmj.tools.tpmunbind helloworld.txt.enc 0xc5e94bf9
i following output:
parsing command-line arguments ... exception in thread "main" java.lang.numberformatexception: input string: "c5e94bf9" @ java.lang.numberformatexception.forinputstring(numberformatexception.java:65) @ java.lang.integer.parseint(integer.java:484) @ bayanihan.util.params.params.getint(params.java:67) @ edu.mit.csail.tpmj.tools.tpmunbind.main(tpmunbind.java:71)
just sanity check if use tpmunbind
command above , wait until load key can handled java int type (i.e. falls within 32-bit range) command runs fine.
has else encountered this? in advance.
0xc5e94bf9
32 bit number.
in hexadecimal representation 1 'digit' represents 4 bits. 8-bit number ranges 0x00
0xff
. 2 hex-digits, called nibbles.
16 bit 0x0000
0xffff
and case 32 bit: 0x00000000
0xffffffff
the link found signed integers states -2,147,483,648
2,147,483,647
. if interprete unsigned, 0
4,294,967,296
in decimal representation. 3,320,400,889
in range.
now error get: that's bug in tpm/j. uses
integer.parseint( s.substring( 2 ), 16 );
to parse input string. parseint()
-method not work hexadecimal numbers larger 0x7fffffff
.
Comments
Post a Comment