Пример #1
0
        public static TPMKeyCore Create(CapabilityDataCore.TPMVersionCore version, TPMKeyUsage keyUsage, TPMKeyFlags keyFlags, 
			TPMAuthDataUsage authDataUsage, TPMKeyParamsCore algorithmParams, TPMStorePubkeyCore pubkey, byte[] encdata)
        {
            TPMKeyCore key = new TPMKeyCore ();

            key._keyUsage = keyUsage;
            key._keyFlags = keyFlags;
            key._authDataUsage = authDataUsage;
            key._algorithmParams = algorithmParams;

            if (version == null)
                key._version = CapabilityDataCore.TPMVersionCore.CreateVersion12 ();
            else
                key._version = version;

            if (pubkey == null)
                key._pubKey = TPMStorePubkeyCore.CreateEmptyPubkey ();
            else
                key._pubKey = pubkey;

            if (encdata == null)
                key._encData = new byte[0];
            else
                key._encData = encdata;

            return key;
        }
Пример #2
0
        public static TPMStorePubkeyCore CreateFromTpmBlob(TPMBlob blob)
        {
            TPMStorePubkeyCore pubkey = new TPMStorePubkeyCore();

            pubkey.ReadFromTpmBlob(blob);
            return(pubkey);
        }
Пример #3
0
        /// <summary>
        /// Creates an empty pubkey object with key length = 0
        /// </summary>
        /// <returns></returns>
        public static TPMStorePubkeyCore CreateEmptyPubkey()
        {
            TPMStorePubkeyCore pubkey = new TPMStorePubkeyCore();

            pubkey._pubkey = new Byte[0];
            return(pubkey);
        }
Пример #4
0
        public void ReadFromTpmBlob(TPMBlob blob)
        {
            _version         = CapabilityDataCore.TPMVersionCore.CreateFromTPMBlob(blob);
            _keyUsage        = (TPMKeyUsage)blob.ReadUInt16();
            _keyFlags        = (TPMKeyFlags)blob.ReadUInt32();
            _authDataUsage   = (TPMAuthDataUsage)blob.ReadByte();
            _algorithmParams = TPMKeyParamsCore.CreateFromTPMBlob(blob);

            uint pcrInfoSize = blob.ReadUInt32();

            /*byte[] pcrInfo =*/ blob.ReadBytes((int)pcrInfoSize);

            _pubKey = TPMStorePubkeyCore.CreateFromTpmBlob(blob);

            uint encDataSize = blob.ReadUInt32();

            _encData = blob.ReadBytes((int)encDataSize);
        }
Пример #5
0
        public static TPMKeyCore Create(CapabilityDataCore.TPMVersionCore version, TPMKeyUsage keyUsage, TPMKeyFlags keyFlags,
                                        TPMAuthDataUsage authDataUsage, TPMKeyParamsCore algorithmParams, TPMStorePubkeyCore pubkey, byte[] encdata)
        {
            TPMKeyCore key = new TPMKeyCore();


            key._keyUsage        = keyUsage;
            key._keyFlags        = keyFlags;
            key._authDataUsage   = authDataUsage;
            key._algorithmParams = algorithmParams;


            if (version == null)
            {
                key._version = CapabilityDataCore.TPMVersionCore.CreateVersion12();
            }
            else
            {
                key._version = version;
            }

            if (pubkey == null)
            {
                key._pubKey = TPMStorePubkeyCore.CreateEmptyPubkey();
            }
            else
            {
                key._pubKey = pubkey;
            }

            if (encdata == null)
            {
                key._encData = new byte[0];
            }
            else
            {
                key._encData = encdata;
            }

            return(key);
        }
Пример #6
0
 public void ReadFromTpmBlob(TPMBlob blob)
 {
     _keyParams = TPMKeyParamsCore.CreateFromTPMBlob(blob);
     _publicKey = TPMStorePubkeyCore.CreateFromTpmBlob(blob);
 }
Пример #7
0
 public static TPMStorePubkeyCore CreateFromTpmBlob(TPMBlob blob)
 {
     TPMStorePubkeyCore pubkey = new TPMStorePubkeyCore();
     pubkey.ReadFromTpmBlob(blob);
     return pubkey;
 }
Пример #8
0
 /// <summary>
 /// Creates an empty pubkey object with key length = 0
 /// </summary>
 /// <returns></returns>
 public static TPMStorePubkeyCore CreateEmptyPubkey()
 {
     TPMStorePubkeyCore pubkey = new TPMStorePubkeyCore ();
     pubkey._pubkey = new Byte[0];
     return pubkey;
 }