de.datenzone.tpm4java
Class TPMPubKeyWrapper

java.lang.Object
  extended by de.datenzone.tpm4java.TPMPubKeyWrapper
All Implemented Interfaces:
java.io.Serializable

public class TPMPubKeyWrapper
extends java.lang.Object
implements java.io.Serializable

Wrapper around a public key from a tpm.

Author:
Martin Hermanowski
See Also:
Serialized Form

Constructor Summary
TPMPubKeyWrapper()
           
TPMPubKeyWrapper(byte[] raw, boolean pcr_present)
          Parse a public key from a TPM structure
TPMPubKeyWrapper(java.nio.ByteBuffer bb, boolean pcr_present)
          Parse a public key from a TPM structure
TPMPubKeyWrapper(java.security.PublicKey pk)
          Wrap an existing RSA-PublicKey into a TPMPubKey Structure.
 
Method Summary
 byte[] buildBuffer(boolean pcr_present)
          Create a native TPM structure using the information given in this field
 int getAlgorithm()
           
 byte[] getBlobForHashing(boolean pcrPresent)
          Return a blob that can be used for hashing.
 short getEncscheme()
           
 int getExponent()
           
 int getExpsize()
           
 int getKeybitlen()
           
 int getKeylength()
           
 TPMKeyParms getKeyParms()
           
 byte[] getModulus()
           
 int getNumprimes()
           
 int getParmsize()
           
 byte[] getPcrinfo()
           
 int getPcrinfolen()
           
 byte[] getRaw_exp()
           
 byte[] getRaw_parms()
           
 byte[] getRaw()
           
 java.security.PublicKey getRSAPubKey()
          Convert to a PublicKey, or return the PublicKey with which this object was created.
 short getSigscheme()
           
 void setAlgorithm(int algorithm)
           
 void setEncscheme(short encscheme)
           
 void setExponent(int exponent)
           
 void setExpsize(int expsize)
           
 void setKeybitlen(int keybitlen)
           
 void setKeylength(int keylength)
           
 void setKeyParms(TPMKeyParms keyParms)
           
 void setModulus(byte[] modulus)
           
 void setNumprimes(int numprimes)
           
 void setPcrinfo(byte[] pcrinfo)
           
 void setPcrinfolen(int pcrinfolen)
           
 void setSigscheme(short sigscheme)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TPMPubKeyWrapper

public TPMPubKeyWrapper(java.nio.ByteBuffer bb,
                        boolean pcr_present)
Parse a public key from a TPM structure

Parameters:
bb -
pcr_present - whether a PCRInfo field is present in the key

TPMPubKeyWrapper

public TPMPubKeyWrapper(byte[] raw,
                        boolean pcr_present)
Parse a public key from a TPM structure

Parameters:
raw -
pcr_present - whether a PCRInfo field is present in the key

TPMPubKeyWrapper

public TPMPubKeyWrapper()

TPMPubKeyWrapper

public TPMPubKeyWrapper(java.security.PublicKey pk)
Wrap an existing RSA-PublicKey into a TPMPubKey Structure. Note that not all fields are filled, this is mainly a convenience function for Privacy CAs

Parameters:
pk -
Method Detail

buildBuffer

public byte[] buildBuffer(boolean pcr_present)
Create a native TPM structure using the information given in this field

Parameters:
pcr_present - whether a PCRInfo field should be present in the assembled structure
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getRSAPubKey

public java.security.PublicKey getRSAPubKey()
                                     throws java.security.spec.InvalidKeySpecException,
                                            java.security.NoSuchAlgorithmException
Convert to a PublicKey, or return the PublicKey with which this object was created.

Returns:
the RSA public key
Throws:
java.security.spec.InvalidKeySpecException
java.security.NoSuchAlgorithmException

getBlobForHashing

public byte[] getBlobForHashing(boolean pcrPresent)
Return a blob that can be used for hashing. Hashed public keys normally include the key parms, the length of the modulus and the modulus itself.

Parameters:
pcrPresent - whether the PCRInfo field should be included
Returns:

getKeylength

public int getKeylength()

setKeylength

public void setKeylength(int keylength)

getKeyParms

public TPMKeyParms getKeyParms()

setKeyParms

public void setKeyParms(TPMKeyParms keyParms)

getModulus

public byte[] getModulus()

setModulus

public void setModulus(byte[] modulus)

getRaw

public byte[] getRaw()

getAlgorithm

public int getAlgorithm()

getEncscheme

public short getEncscheme()

getExponent

public int getExponent()

getExpsize

public int getExpsize()

getKeybitlen

public int getKeybitlen()

getNumprimes

public int getNumprimes()

getParmsize

public int getParmsize()

getPcrinfo

public byte[] getPcrinfo()

getPcrinfolen

public int getPcrinfolen()

getRaw_exp

public byte[] getRaw_exp()

getRaw_parms

public byte[] getRaw_parms()

getSigscheme

public short getSigscheme()

setAlgorithm

public void setAlgorithm(int algorithm)

setEncscheme

public void setEncscheme(short encscheme)

setExponent

public void setExponent(int exponent)

setExpsize

public void setExpsize(int expsize)

setKeybitlen

public void setKeybitlen(int keybitlen)

setNumprimes

public void setNumprimes(int numprimes)

setPcrinfo

public void setPcrinfo(byte[] pcrinfo)

setPcrinfolen

public void setPcrinfolen(int pcrinfolen)

setSigscheme

public void setSigscheme(short sigscheme)


http://tpm4java.datenzone.de/