Exemple #1
0
        public override void Init(Parameters param, TPMProvider tpmProvider, TPMWrapper tpmWrapper)
        {
            base.Init (param, tpmProvider, tpmWrapper);

            _param = param;
            _capArea = param.GetValueOf<CapabilityData.TPMCapabilityArea> ("capArea");
        }
Exemple #2
0
        public override void Init(Parameters param, TPMProvider tpmProvider, TPMWrapper tpmWrapper)
        {
            base.Init (param, tpmProvider, tpmWrapper);

            if(_params.IsDefined<uint>("pcr") == false)
                throw new ArgumentException("Parameter 'pcr' is not defined");
            if(_params.IsDefined<byte[]>("digest") == false)
                throw new ArgumentException("Parameter 'digest' is not defined");
        }
Exemple #3
0
        public override void Init(Parameters param, TPMProvider tpmProvider, TPMWrapper tpmWrapper)
        {
            base.Init (param, tpmProvider, tpmWrapper);

            _digest = null;
            _responseDigest = null;

            if(param.IsDefined<byte[]>("externalData"))
                _nonce = param.GetValueOf<byte[]>("externalData");
            else
                _nonce = NonceGenerator.GenerateByteNonce(20);

            object myType = param.GetValueOf<object>("targetPCR");
            _pcrSelection = param.GetValueOf<TPMPCRSelectionCore>("targetPCR");
        }
Exemple #4
0
        public override void Init(Parameters param, TPMProvider tpmProvider, TPMWrapper tpmWrapper)
        {
            base.Init (param, tpmProvider, tpmWrapper);

            _digest = null;
            _responseDigest = null;
            _inData = param.GetValueOf<byte[]>("in_data");
        }
Exemple #5
0
        public override void Init(Parameters param, TPMProvider tpmProvider, TPMWrapper tpmWrapper)
        {
            base.Init (param, tpmProvider, tpmWrapper);

            _digest = null;

            _tpmKey = TPMKeyCore.Create (
                CapabilityDataCore.TPMVersionCore.CreateVersion11(),
                _params.GetValueOf<TPMKeyUsage>("key_usage"),
                _params.GetValueOf<TPMKeyFlags>("key_flags"),
                TPMAuthDataUsage.TPM_AUTH_ALWAYS,
                TPMKeyParamsCore.Create (
                    TPMAlgorithmId.TPM_ALG_RSA,
                    _params.GetValueOf<TPMEncScheme>("enc_scheme"),
                    _params.GetValueOf<TPMSigScheme>("sig_scheme"),
                    TPMRSAKeyParamsCore.Create (
                        _params.GetValueOf<uint>("key_length"),
                        _params.GetValueOf<uint>("num_primes"),
                        _params.GetValueOf<byte[]>("exponent"))
                    ),
                null, //Pubkey, use default (empty) pubkey
                null  //no encoded data
                );
        }
Exemple #6
0
        public override void Init(Parameters param, TPMProvider tpmProvider, TPMWrapper tpmWrapper)
        {
            base.Init (param, tpmProvider, tpmWrapper);

            _digest = null;
            _responseDigest = null;
            _inData = TPMStoredDataCore.CreateFromBytes(param.GetValueOf<byte[]>("in_data"));
        }
Exemple #7
0
 public override void Init(Parameters param, TPMProvider provider, TPMWrapper tpmWrapper)
 {
     base.Init(param, provider, tpmWrapper);
     _register = param.GetValueOf<UInt32>("pcrnum");
 }
Exemple #8
0
        public override void Init(Parameters param, TPMProvider tpmProvider, TPMWrapper tpmWrapper)
        {
            base.Init (param, tpmProvider, tpmWrapper);

            _digest = null;
            _responseDigest = null;
            _inData = param.GetValueOf<byte[]>("in_data");
            _pcrInfo = new TPMPCRInfoCore(new TPMPCRSelectionCore(param.GetValueOf<TPMPCRSelection>("pcr_selection")));

            _pcrInfo.CalculateDigests((TPMPCRInfoCore.GetPCRValueDelegate)delegate(uint pcrNum)
            {
                //TODO: Use TPM_Quote to determine pcr values once it's available

                Parameters pcrParams = new Parameters();
                pcrParams.AddPrimitiveType("pcrnum", pcrNum);
                TPMCommandResponse pcrResponse = _tpmWrapper.Process(new TPMCommandRequest(TPMCommandNames.TPM_CMD_PCRRead, pcrParams));
                if(!pcrResponse.Status)
                    throw new TPMResponseException("An unknown error occured on performing pcrread");
                return pcrResponse.Parameters.GetValueOf<byte[]>("value");
            });
        }
Exemple #9
0
        public override void Init(Parameters param, TPMProvider tpmProvider, TPMWrapper tpmWrapper)
        {
            base.Init (param, tpmProvider, tpmWrapper);

            _digest = null;
            _tpmKey =  TPMKeyCore.CreateFromBytes(param.GetValueOf<byte[]>("key_blob"));
        }
Exemple #10
0
 /// <summary>
 /// Init TPM Connection with a suitable backend, that requiers some options
 /// </summary>
 /// <param name="providerName">
 /// A <see cref="System.String"/>
 /// </param>
 /// <param name="options">
 /// A <see cref="IDictionary<String, String>"/>
 /// </param>
 public void Init(string providerName, IDictionary<String, String> options)
 {
     _backend = TPMProviders.Create(providerName,options);
 }
Exemple #11
0
 /// <summary>
 /// Init TPM Connection with a suitable backend
 /// </summary>
 /// <param name="providerName">
 /// A <see cref="System.String"/>
 /// </param>
 public void Init(string providerName)
 {
     _backend = TPMProviders.Create(providerName,null);
 }
Exemple #12
0
        public override void Init(Parameters param, TPMProvider tpmProvider, TPMWrapper tpmWrapper)
        {
            base.Init (param, tpmProvider, tpmWrapper);

            _secret = _params.GetValueOf<byte[]>("secret");
            _label = _params.GetValueOf<byte[]>("label");
        }
Exemple #13
0
        public override void Init(Parameters param, TPMProvider tpmProvider, TPMWrapper tpmWrapper)
        {
            base.Init (param, tpmProvider, tpmWrapper);

            _digest = null;
        }
Exemple #14
0
        public override void Init(Parameters param, TPMProvider tpmProvider, TPMWrapper tpmWrapper)
        {
            base.Init (param, tpmProvider, tpmWrapper);

            _digest = null;

            _tpmKey = TPMKeyCore.Create (
                CapabilityDataCore.TPMVersionCore.CreateVersion11(),
                TPMKeyUsage.TPM_KEY_STORAGE,
                TPMKeyFlags.None,
                TPMAuthDataUsage.TPM_AUTH_ALWAYS,
                TPMKeyParamsCore.Create (
                    TPMAlgorithmId.TPM_ALG_RSA,
                    TPMEncScheme.TPM_ES_RSAESOAEP_SHA1_MGF1,
                    TPMSigScheme.TPM_SS_NONE,
                    TPMRSAKeyParamsCore.Create (TPMRSAKeyParamsCore.DEFAULT_KEYLENGTH, TPMRSAKeyParamsCore.DEFAULT_NUMPRIMES, null)
                    ),
                null, //Pubkey, use default (empty) pubkey
                null  //no encoded data
                );
        }
Exemple #15
0
 //        private TPMCommand (UInt32 tag, UInt32 ordinal, Parameters param) : this(tag, ordinal)
 //        {
 //            _params = param;
 //        }
 //        
 public virtual void Init(Parameters param, TPMProvider tpmProvider, TPMWrapper tpmWrapper)
 {
     _tpmProvider = tpmProvider;
     _params = param;
     _tpmWrapper = tpmWrapper;
 }