From: Britta S. <Io...@we...> - 2010-07-13 11:08:32
|
Sorry for my last email, I've found the answer. The description in the mail of September 2009 works with TcBlobData DataEncrypted = TcCrypto.pubEncryptRsaOaepSha1Mgf1(pubKey, toBind.getEncoded()) Greetings, Britta -----Ursprüngliche Nachricht----- Von: "Britta Schätzke" <Io...@we...> Gesendet: Jul 13, 2010 12:18:41 PM An: tru...@li... Betreff: Problems with tcsCryptopubEncrypt -unbind >Hello, > >I' started programming with jtss a month ago. Now I'm searching for a possibility >to bind a small amount of data with a public key on one machine and unbind it on >another, where the bindkey was generated. (Actually it is the same machine at the moment) >I'm using a Tpm Version 1.2 and tried encrypting with TcCrypto.pubEncryptRsaEcbPcks1Padding (pubkey, data). >This went fine but unbinding lead to an exception (decryption process did not complete). >I've also tried with TcCrypto.pubEncryptRsaOaepSha1Mgf1, but that leads to an Exception too (The operation failed). >In the archives of this mailing list I've found a description for a Tpm Version 1.1 but >that doesn't work on a Tpm 1.2. > > >Could you please tell me, where is my error in reasoning? > >Thank you, >Britta > > Code: > >/*pubSignKey = public part >of myBindingKey */ > TcTpmPubkey >pubKey = new TcTpmPubkey (myBindingKey.getAttribData (TcTssConstants.TSS_TSPATTRIB_KEY_BLOB, > TcTssConstants.TSS_TSPATTRIB_KEYBLOB_PUBLIC_KEY)); > > String plaintext = "Daten"; >/*bind*/ > TcBlobData Data = TcBlobData.newByteArray(plaintext.getBytes("UTF_16LE")); > System.out.println(Data.toString()); > TcBlobData DataEncrypted= TcCrypto.pubEncryptRsaEcbPkcs1Padding(pubKey, Data); >System.out.println(DataEncrypted.toString()); > > /*unbind*/ > TcIEncData remoteBoundData = context.createEncDataObject(TcTssConstants.TSS_ENCDATA_BIND); > >remoteBoundData.setAttribData(TcTssConstants.TSS_TSPATTRIB_ENCDATA_BLOB, > TcTssConstants.TSS_TSPATTRIB_ENCDATABLOB_BLOB, DataEncrypted); > > TcBlobData unboundData = remoteBoundData.unbind(myBindingKey); > > > >Output: > >Daten >ꉈ㍯⪀ꇝ쾢壝䕒䞭㤷书图꺶읽馈湧⽙ᅶଋ槽广ꝍ牷䏧쟬틄�쀌⡘方庪떰ஔ獲䗖⤃夝죷梛闬ꋢ浤綃Λ䜞ꈅ㩈糵ﭳ獏ᑰ㐵㾫瘒䓖꧸嗥堟帩鐦陪͝쨎䎂㢪蝖宯낚쌐㜰䶉ૡ禚嗚ῤ䠀鲴ᨇᐟ㶜롗ꎩ庿䱯렷茛楍숮ꊸ聀醈䡱聛�ፕ腹ৠ樅ﺔⰁꯀ絇⑸ﲮ꿪ꫛ᰼忈⢪ > >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. > > at iaik.tc.tss.impl.java.tsp.tcsbinding.soapservice.ConvertRemoteExceptions.convertTcTpmException(ConvertRemoteExceptions.java:89) > at iaik.tc.tss.impl.java.tsp.tcsbinding.soapservice.TcTcsBindingSoap.TcsipUnBind(TcTcsBindingSoap.java:1187) > at iaik.tc.tss.impl.java.tsp.internal.TcTspInternal.TspUnBind_Internal(TcTspInternal.java:1766) > at iaik.tc.tss.impl.java.tsp.TcEncData.unbind(TcEncData.java:221) > at tpmmodule.tpmUtils.testEncryptWithPubKey(tpmUtils.java:365) > at tpmmodule.Main.main(Main.java:149) ___________________________________________________________ Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail |