iaik.tc.tss.impl.java.tsp
Class TcRsaKey

java.lang.Object
  extended by iaik.tc.tss.impl.java.tsp.TcAttributes
      extended by iaik.tc.tss.impl.java.tsp.TcWorkingObject
          extended by iaik.tc.tss.impl.java.tsp.TcAuthObject
              extended by iaik.tc.tss.impl.java.tsp.TcRsaKey
All Implemented Interfaces:
TcIAttributes, TcIAuthObject, TcIRsaKey, TcIWorkingObject

public class TcRsaKey
extends TcAuthObject
implements TcIRsaKey


Method Summary
 TcTssValidation certifyKey(TcIRsaKey certifyingKey, TcTssValidation validation)
          This method signs a public key inside the TPM using TcTssConstants.TSS_SS_RSASSAPKCS1V15_SHA1).
 void changeAuth(TcIAuthObject parentObject, TcIPolicy newPolicy)
          This method changes the authorization data (secret) of an entity (object) and assigns the object to the newPolicy object.
 void CMKConvertMigration(TcIRsaKey parentKey, TcIMigData migrationData, TcBlobData random)
          This method completes the migration of a certified migration process.
 TcBlobData CMKCreateBlob(TcIRsaKey parentKey, TcIMigData migrationData)
          This method implements the first step in the process of moving a certified-migrateable-key to a new parent platform.
 void convertMigrationBlob(TcIRsaKey parent, TcBlobData random, TcBlobData migrationBlob)
          This method takes the migration blob built by Tspi_Key_CreateMigrationBlob using the migration scheme TSS_MS_MIGRATE and creates a normal wrapped key.
 void createKey(TcIRsaKey wrappingKey, TcIPcrComposite pcrComposite)
          This method creates a key pair within the TPM and wraps it with the key addressed by wrappingKey.
If the internal key structure is a 1.1 TPM key, the provided PcrComposite must be a TcTssConstants.TSS_PCRS_STRUCT_INFO.
 TcBlobData[] createMigrationBlob(TcIRsaKey parent, TcTpmMigrationkeyAuth migTicket)
          This method creates a migration blob of the key.
 TcBlobData getAttribCmkInfo(long subFlag)
          This method returns CMK information as defined for TcTssConstants.TSS_TSPATTRIB_KEY_CMKINFO.
 TcBlobData getAttribKeyBlob(long subFlag)
          This method returns key blobs as defined for TcTssConstants.TSS_TSPATTRIB_KEY_BLOB.
 TcBlobData getAttribKeyInfo(long subFlag)
          This method returns key version information as defined for TcTssConstants.TSS_TSPATTRIB_KEY_INFO.
 long getAttribKeyInfoUINT32(long subFlag)
          This method returns information about the key.
 TcTssVersion getAttribKeyInfoVersion()
          This method returns the version of the key.
 TcBlobData getAttribKeyPcr(long subFlag)
          This method returns PCR_INFO information as defined for TcTssConstants.TSS_TSPATTRIB_KEY_PCR.
 TcBlobData getAttribKeyPcrLong(long subFlag)
          This method returns PCR_LONG information as defined for TcTssConstants.TSS_TSPATTRIB_KEY_PCR_LONG.
 long getAttribKeyPcrLongUINT32(long subFlag)
          This method returns locality information as defined for TcTssConstants.TSS_TSPATTRIB_KEY_PCR_LONG.
 long getAttribKeyRegister(long subFlag)
          This method returns the register the key is registered in.
 TcBlobData getAttribRsaKeyInfo(long subFlag)
          This method returns RSA key information as defined for TcTssConstants.TSS_TSPATTRIB_RSAKEY_INFO.
 long getAttribRsaKeyInfoUINT32(long subFlag)
          This method returns RSA key information as defined for TcTssConstants.TSS_TSPATTRIB_RSAKEY_INFO.
 TcTssUuid getAttribUuid()
          This method returns the UUID of the key.
 TcIPolicy getMigrationPolicyObject()
          This method returns a policy object representing the migration policy currently assigned to the object.
 TcIPolicy getPolicyObject(long policyType)
          Note: Policy objects are returned by reference.
 TcBlobData getPubKey()
          This method returns the public key of the key object.
 void loadKey(TcIRsaKey unwrappingKey)
          This method loads the key blob into the TPM.
 void migrateKey(TcIRsaKey publicKey, TcIRsaKey migData)
          This method decrypts with assistance of the TPM the input package (e.g.
 void setAttribCmkInfo(long subFlag, TcBlobData attrib)
          This method sets CMK information as defined for TcTssConstants.TSS_TSPATTRIB_KEY_CMKINFO.
 void setAttribKeyBlob(long subFlag, TcBlobData attrib)
          This method sets RSA key information as defined for TcTssConstants.TSS_TSPATTRIB_KEY_BLOB.
 void setAttribKeyInfo(long subFlag, long attrib)
          This method sets key information as defined for TcTssConstants.TSS_TSPATTRIB_KEY_INFO.
 void setAttribRsaKeyInfo(long subFlag, TcBlobData attrib)
          This method sets RSA key information as defined for TcTssConstants.TSS_TSPATTRIB_RSAKEY_INFO.
 void setAttribRsaKeyInfoUINT32(long subFlag, long attrib)
          This method sets RSA key information as defined for TcTssConstants.TSS_TSPATTRIB_RSAKEY_INFO.
 void setAttribUuid(TcTssUuid uuid)
          This method sets the UUID of the key.
 void unloadKey()
          This method unloads the key from the TPM.
 void wrapKey(TcIRsaKey wrappingKey, TcIPcrComposite pcrComposite)
          This method wraps a key (created externally) with the key addressed by wrappingKey.
 
Methods inherited from class iaik.tc.tss.impl.java.tsp.TcAuthObject
changeAuthAsym, getUsagePolicyObject
 
Methods inherited from class iaik.tc.tss.impl.java.tsp.TcAttributes
getAttribData, getAttribUint32, setAttribData, setAttribUint32
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface iaik.tc.tss.api.tspi.TcIAttributes
getAttribData, getAttribUint32, setAttribData, setAttribUint32
 
Methods inherited from interface iaik.tc.tss.api.tspi.TcIAuthObject
changeAuthAsym, getUsagePolicyObject
 

Method Detail

certifyKey

public TcTssValidation certifyKey(TcIRsaKey certifyingKey,
                                  TcTssValidation validation)
                           throws TcTssException
Description copied from interface: TcIRsaKey
This method signs a public key inside the TPM using TcTssConstants.TSS_SS_RSASSAPKCS1V15_SHA1).

Specified by:
certifyKey in interface TcIRsaKey
Parameters:
certifyingKey - Certifying key used to sign the key.
validation - Structure of the type TcTssValidation. After successful completion of the call the validationData field of this structure contains the signature data of the command. The data field of the structure contains an instance of TcTpmCertifyInfo or TcTpmCertifyInfo2.
Returns:
The filled validation object.
Throws:
TcTssException

convertMigrationBlob

public void convertMigrationBlob(TcIRsaKey parent,
                                 TcBlobData random,
                                 TcBlobData migrationBlob)
                          throws TcTssException
Description copied from interface: TcIRsaKey
This method takes the migration blob built by Tspi_Key_CreateMigrationBlob using the migration scheme TSS_MS_MIGRATE and creates a normal wrapped key. The resulting normal wrapped key. It may be retrieved from that instance by Tspi_GetAttribData().

Specified by:
convertMigrationBlob in interface TcIRsaKey
Parameters:
parent - Parent key related to the key.
random - Random data as returned together with the migration blob by the method CreateMigrationBlob.
migrationBlob - Migration blob data as returned by a previously called method CreateMigrationBlob.
Throws:
TcTssException

migrateKey

public void migrateKey(TcIRsaKey publicKey,
                       TcIRsaKey migData)
                throws TcTssException
Description copied from interface: TcIRsaKey
This method decrypts with assistance of the TPM the input package (e.g. Key) and then re-encrypts it with the input public key. This command exists to allow the TPM to be a migration authority

Specified by:
migrateKey in interface TcIRsaKey
Parameters:
publicKey - Public key to which the blob is to be migrated
migData - Migration data key object to transfer the input and output data blob during the migration process. The input data blob is from the previous call of the function Tspi_CreateMigrationBlob() or Tspi_CMK_CreateBlob().
Throws:
TcTssException

CMKConvertMigration

public void CMKConvertMigration(TcIRsaKey parentKey,
                                TcIMigData migrationData,
                                TcBlobData random)
                         throws TcTssException
Description copied from interface: TcIRsaKey
This method completes the migration of a certified migration process. This function takes a certified migration blob and creates a normal wrapped key blob which must be loaded into the TPM using the normal LoadKey operation.

Specified by:
CMKConvertMigration in interface TcIRsaKey
Parameters:
parentKey - The parent key related to this key object.
migrationData - Migration data key object to transfer the input and output data blob during the migration process.
random - The random data as returned together with the migration blob by the method Tspi_CMKCreateBlob().
Throws:
TcTssException

CMKCreateBlob

public TcBlobData CMKCreateBlob(TcIRsaKey parentKey,
                                TcIMigData migrationData)
                         throws TcTssException
Description copied from interface: TcIRsaKey
This method implements the first step in the process of moving a certified-migrateable-key to a new parent platform.

Specified by:
CMKCreateBlob in interface TcIRsaKey
Parameters:
parentKey - The parent key related to this key object.
migrationData - Migration data key object to transfer the input and output data blob during the migration process.
Returns:
the random data
Throws:
TcTssException

createKey

public void createKey(TcIRsaKey wrappingKey,
                      TcIPcrComposite pcrComposite)
               throws TcTssException
Description copied from interface: TcIRsaKey
This method creates a key pair within the TPM and wraps it with the key addressed by wrappingKey.
If the internal key structure is a 1.1 TPM key, the provided PcrComposite must be a TcTssConstants.TSS_PCRS_STRUCT_INFO. If the key is a 1.2 TPM key, the PcrComposite must be a TcTssConstants.TSS_PCRS_STRUCT_INFO_LONG. If a wrong combination is used, a TcTssException with error code TcTssErrors.TSS_E_INVALID_OBJ_ACCESS is thrown.
The key must already be properly set up via the key init flags or TcIAttributes.setAttribData(long, long, TcBlobData) and TcIAttributes.setAttribUint32(long, long, long).

Specified by:
createKey in interface TcIRsaKey
Parameters:
wrappingKey - The key used to wrap the newly created key.
pcrComposite - If this parameter is not omitted (i.e. set to null), the newly created key will be bound to the PCR values described within this object.
Throws:
TcTssException

createMigrationBlob

public TcBlobData[] createMigrationBlob(TcIRsaKey parent,
                                        TcTpmMigrationkeyAuth migTicket)
                                 throws TcTssException
Description copied from interface: TcIRsaKey
This method creates a migration blob of the key.

Specified by:
createMigrationBlob in interface TcIRsaKey
Parameters:
parent - Parent key related to the key.
migTicket - Migration ticket (migration public key and its authorization digest). This data previously has been returned by the method TPM.authorizeMigrationTicket()
Returns:
An array with 2 elements: Element[0]: random data Element[1]: migration blob
Throws:
TcTssException

getPubKey

public TcBlobData getPubKey()
                     throws TcTssException
Description copied from interface: TcIRsaKey
This method returns the public key of the key object.

Specified by:
getPubKey in interface TcIRsaKey
Returns:
Memory block containing the public key blob retrieved for the key. The returned blob is of type TcTpmPubkey.
Throws:
TcTssException

loadKey

public void loadKey(TcIRsaKey unwrappingKey)
             throws TcTssException
Description copied from interface: TcIRsaKey
This method loads the key blob into the TPM. The TPM will unwrap the key when it is loaded.

Specified by:
loadKey in interface TcIRsaKey
Parameters:
unwrappingKey - The key which should be used for unwrapping.
Throws:
TcTssException

unloadKey

public void unloadKey()
               throws TcTssException
Description copied from interface: TcIRsaKey
This method unloads the key from the TPM.

Specified by:
unloadKey in interface TcIRsaKey
Throws:
TcTssException

wrapKey

public void wrapKey(TcIRsaKey wrappingKey,
                    TcIPcrComposite pcrComposite)
             throws TcTssException
Description copied from interface: TcIRsaKey
This method wraps a key (created externally) with the key addressed by wrappingKey.

Specified by:
wrapKey in interface TcIRsaKey
Parameters:
wrappingKey - kKey used for wrapping.
pcrComposite - object of the type PcrComposite. If the value of the handle doesn't equal to NULL, the key addressed by hKey will be bound to the PCR values described with this object.
Throws:
TcTssException

getPolicyObject

public TcIPolicy getPolicyObject(long policyType)
                          throws TcTssException
Description copied from class: TcAuthObject
Note: Policy objects are returned by reference. Keep that in mind when modifying a policy. For general documentation of this method refer to TcIAuthObject.getPolicyObject(long).

Specified by:
getPolicyObject in interface TcIAuthObject
Overrides:
getPolicyObject in class TcAuthObject
Parameters:
policyType - The policy type to be returned (TSS_POLICY_*)
Returns:
Policy object currently assigned to the object.
Throws:
TcTssException

getMigrationPolicyObject

public TcIPolicy getMigrationPolicyObject()
                                   throws TcTssException
This method returns a policy object representing the migration policy currently assigned to the object. It is based on the getPolicy method of the TSS with TSS_POLICY_MIGRATION as parameter. Note: Policy objects are returned by reference. Keep that in mind when modifying a policy.

Specified by:
getMigrationPolicyObject in interface TcIRsaKey
Returns:
Migration policy object.
Throws:
TcTssException
TSS Spec. 1.2 Errata A, page number:
182
TSS Spec. 1.10 Golden, Aug. 20, 2003, page number:
73

changeAuth

public void changeAuth(TcIAuthObject parentObject,
                       TcIPolicy newPolicy)
                throws TcTssException
Description copied from interface: TcIAuthObject
This method changes the authorization data (secret) of an entity (object) and assigns the object to the newPolicy object. All classes using secrets provide this method for changing their authorization data. To change the TPM owner authorization, this method has to be called on the TPM object. The parent has to be set to null. To change the SRK authorization, this method has to be called on the SRK key object and the parent has to be set to the TPM object.

Specified by:
changeAuth in interface TcIAuthObject
Parameters:
parentObject - The parent object wrapping this object.
newPolicy - Policy object providing the new authorization data.
Throws:
TcTssException

getAttribKeyInfoVersion

public TcTssVersion getAttribKeyInfoVersion()
                                     throws TcTssException
Description copied from interface: TcIRsaKey
This method returns the version of the key.

Specified by:
getAttribKeyInfoVersion in interface TcIRsaKey
Returns:
Version of the key.
Throws:
TcTssException

getAttribUuid

public TcTssUuid getAttribUuid()
                        throws TcTssException
Description copied from interface: TcIRsaKey
This method returns the UUID of the key.

Specified by:
getAttribUuid in interface TcIRsaKey
Returns:
UUID of the key.
Throws:
TcTssException

setAttribUuid

public void setAttribUuid(TcTssUuid uuid)
                   throws TcTssException
Description copied from interface: TcIRsaKey
This method sets the UUID of the key.

Specified by:
setAttribUuid in interface TcIRsaKey
Throws:
TcTssException

getAttribKeyRegister

public long getAttribKeyRegister(long subFlag)
                          throws TcTspException
This method returns the register the key is registered in. This method is an alternative to using TcIAttributes.getAttribUint32(long, long) using TcTssConstants.TSS_TSPATTRIB_KEY_REGISTER as flag.

Parameters:
subFlag - Ignored (set to 0).
Returns:
TcTssConstants.TSS_TSPATTRIB_KEYREGISTER_SYSTEM or TcTssConstants.TSS_TSPATTRIB_KEYREGISTER_USER or TcTssConstants.TSS_TSPATTRIB_KEYREGISTER_NO
Throws:
TcTspException

getAttribKeyInfoUINT32

public long getAttribKeyInfoUINT32(long subFlag)
                            throws TcTssException
This method returns information about the key. This method is an alternative to using TcIAttributes.getAttribUint32(long, long) with TcTssConstants.TSS_TSPATTRIB_KEY_INFO as flag.

Parameters:
subFlag - Valid subFlags are:
Returns:
Returns values depend on the actual subFlag.
Throws:
TcTssException

setAttribKeyInfo

public void setAttribKeyInfo(long subFlag,
                             long attrib)
                      throws TcTssException
This method sets key information as defined for TcTssConstants.TSS_TSPATTRIB_KEY_INFO. This method is an alternative to using TcIAttributes.setAttribUint32(long, long, long). Note that this method is not standardized as part of the TSP Interface (TSPI).

Parameters:
subFlag - Valid subFlags are:
attrib - The attribute value corresponding to the given subFlag.
Throws:
TcTssException

setAttribRsaKeyInfoUINT32

public void setAttribRsaKeyInfoUINT32(long subFlag,
                                      long attrib)
                               throws TcTssException
This method sets RSA key information as defined for TcTssConstants.TSS_TSPATTRIB_RSAKEY_INFO. This method is an alternative to using TcIAttributes.setAttribUint32(long, long, long) with Constants#TSS_TSPATTRIB_RSAKEY_INFO} as flag.

Parameters:
subFlag - Valid subFlags are:
attrib - The attribute value corresponding to the given subFlag.
Throws:
TcTssException

getAttribRsaKeyInfoUINT32

public long getAttribRsaKeyInfoUINT32(long subFlag)
                               throws TcTssException
This method returns RSA key information as defined for TcTssConstants.TSS_TSPATTRIB_RSAKEY_INFO. This method is an alternative to using TcIAttributes.getAttribUint32(long, long) with TcTssConstants.TSS_TSPATTRIB_RSAKEY_INFO as flag.

Parameters:
subFlag - Valid subFlags are:
Returns:
The requested key information.
Throws:
TcTssException

getAttribKeyPcrLongUINT32

public long getAttribKeyPcrLongUINT32(long subFlag)
                               throws TcTssException
This method returns locality information as defined for TcTssConstants.TSS_TSPATTRIB_KEY_PCR_LONG. This method is an alternative to using TcIAttributes.getAttribUint32(long, long) with Constants#TSS_TSPATTRIB_KEY_PCR_LONG} as flag.

Parameters:
subFlag - Valid subFlags are:
Returns:
The requested locality information.
Throws:
TcTssException

setAttribRsaKeyInfo

public void setAttribRsaKeyInfo(long subFlag,
                                TcBlobData attrib)
                         throws TcTssException
This method sets RSA key information as defined for TcTssConstants.TSS_TSPATTRIB_RSAKEY_INFO. This method is an alternative to using TcIAttributes.setAttribData(long, long, TcBlobData) with TcTssConstants.TSS_TSPATTRIB_RSAKEY_INFO as flag.

Parameters:
subFlag - Valid subFlags are:
attrib - The attribute value corresponding to the given subFlag.
Throws:
TcTssException

getAttribRsaKeyInfo

public TcBlobData getAttribRsaKeyInfo(long subFlag)
                               throws TcTssException
This method returns RSA key information as defined for TcTssConstants.TSS_TSPATTRIB_RSAKEY_INFO. This method is an alternative to using TcIAttributes.getAttribData(long, long) with TcTssConstants.TSS_TSPATTRIB_RSAKEY_INFO as subFlag.

Parameters:
subFlag - Valid subFlags are:
Returns:
The requested information as specified by subFlag.
Throws:
TcTssException

setAttribKeyBlob

public void setAttribKeyBlob(long subFlag,
                             TcBlobData attrib)
                      throws TcTssException
This method sets RSA key information as defined for TcTssConstants.TSS_TSPATTRIB_KEY_BLOB. This method is an alternative to using TcIAttributes.setAttribData(long, long, TcBlobData) with TcTssConstants.TSS_TSPATTRIB_KEY_BLOB as flag.

Parameters:
subFlag - Valid subFlags are:
attrib - The attribute value corresponding to the given subFlag.
Throws:
TcTssException

getAttribKeyBlob

public TcBlobData getAttribKeyBlob(long subFlag)
                            throws TcTssException
This method returns key blobs as defined for TcTssConstants.TSS_TSPATTRIB_KEY_BLOB. This method is an alternative to using TcIAttributes.getAttribData(long, long) with TcTssConstants.TSS_TSPATTRIB_KEY_BLOB as flag.

Parameters:
subFlag - Valid subFlags are:
Returns:
The requested key blob (or null if the key blob is not available).
Throws:
TcTssException

getAttribKeyInfo

public TcBlobData getAttribKeyInfo(long subFlag)
                            throws TcTssException
This method returns key version information as defined for TcTssConstants.TSS_TSPATTRIB_KEY_INFO. The data returned by this method is a TcTpmVersion struct, not a TcTssVersion struct. To get the key version field as a TcTssVersion us getAttribKeyInfoVersion(). This method is an alternative to using TcIAttributes.getAttribData(long, long) with TcTssConstants.TSS_TSPATTRIB_KEY_INFO as flag.

Parameters:
subFlag - Valid subFlags are:
Returns:
The requested information as specified by subFlag.
Throws:
TcTssException

getAttribKeyPcrLong

public TcBlobData getAttribKeyPcrLong(long subFlag)
                               throws TcTssException
This method returns PCR_LONG information as defined for TcTssConstants.TSS_TSPATTRIB_KEY_PCR_LONG. This method is an alternative to using TcIAttributes.getAttribData(long, long) with TcTssConstants.TSS_TSPATTRIB_KEY_PCR_LONG as flag.

Parameters:
subFlag - Valid subFlags are:
Returns:
The requested information as specified by subFlag.
Throws:
TcTssException

getAttribKeyPcr

public TcBlobData getAttribKeyPcr(long subFlag)
                           throws TcTssException
This method returns PCR_INFO information as defined for TcTssConstants.TSS_TSPATTRIB_KEY_PCR. This method is an alternative to using TcIAttributes.getAttribData(long, long) with TcTssConstants.TSS_TSPATTRIB_KEY_PCR as flag.

Parameters:
subFlag - Valid subFlags are:
Returns:
The requested information as specified by subFlag.
Throws:
TcTssException

setAttribCmkInfo

public void setAttribCmkInfo(long subFlag,
                             TcBlobData attrib)
                      throws TcTssException
This method sets CMK information as defined for TcTssConstants.TSS_TSPATTRIB_KEY_CMKINFO. This method is an alternative to using TcIAttributes.setAttribData(long, long, TcBlobData) with TcTssConstants.TSS_TSPATTRIB_KEY_CMKINFO as flag.

Parameters:
subFlag - Valid subFlags are:
attrib - The attribute value corresponding to the given subFlag.
Throws:
TcTssException

getAttribCmkInfo

public TcBlobData getAttribCmkInfo(long subFlag)
                            throws TcTssException
This method returns CMK information as defined for TcTssConstants.TSS_TSPATTRIB_KEY_CMKINFO. This method is an alternative to using TcIAttributes.getAttribData(long, long) with TcTssConstants.TSS_TSPATTRIB_KEY_CMKINFO as subFlag.

Parameters:
subFlag - Valid subFlags are:
Returns:
The requested information as specified by subFlag.
Throws:
TcTssException