Tpm2Lib.Tpm2.PolicySigned C# (CSharp) Method

PolicySigned() private method

private PolicySigned ( TpmHandle authObject, TpmHandle policySession, byte nonceTPM, byte cpHashA, byte policyRef, int expiration, ISignatureUnion auth, [ policyTicket ) : byte[]
authObject TpmHandle
policySession TpmHandle
nonceTPM byte
cpHashA byte
policyRef byte
expiration int
auth ISignatureUnion
policyTicket [
return byte[]
        public byte[] PolicySigned(
            TpmHandle authObject,
            TpmHandle policySession,
            byte[] nonceTPM,
            byte[] cpHashA,
            byte[] policyRef,
            int expiration,
            ISignatureUnion auth,
            [SuppressMessage("Microsoft.Design", "CA1021")]
            out TkAuth policyTicket
        )
        {
            Tpm2PolicySignedRequest inS = new Tpm2PolicySignedRequest();
            inS.authObject = authObject;
            inS.policySession = policySession;
            inS.nonceTPM = nonceTPM;
            inS.cpHashA = cpHashA;
            inS.policyRef = policyRef;
            inS.expiration = expiration;
            inS.auth = auth;
            TpmStructureBase outSBase;
            DispatchMethod(TpmCc.PolicySigned, (TpmStructureBase) inS, typeof(Tpm2PolicySignedResponse), out outSBase, 2, 0);
            Tpm2PolicySignedResponse outS = (Tpm2PolicySignedResponse) outSBase;
            policyTicket = outS.policyTicket;
            return outS.timeout;
        }
        /// <summary>

Usage Example

コード例 #1
0
        internal override TpmRc Execute(Tpm2 tpm, AuthSession sess, PolicyTree policy)
        {
            byte[] nonceTpm = UseNonceTpm ? Globs.CopyData(sess.NonceTpm) : new byte[0];

            TpmHandle sigKey;

            // If we have both the authorizing signature and the corresponding
            // signing key handle, we are good to go.
            if (AuthSig == null)
            {
                var dataToSign = new Marshaller();
                dataToSign.Put(nonceTpm, "");

                // If we have a signing key we can build the challenge here
                // (else we need to call out)
                if (SwSigningKey != null)
                {
                    dataToSign.Put(ExpirationTime, "");
                    dataToSign.Put(CpHash, "");
                    dataToSign.Put(PolicyRef, "");
                    // Just ask the key to sign the challenge
                    AuthSig = SwSigningKey.Sign(dataToSign.GetBytes());
                    sigKey  = tpm.LoadExternal(null, SigningKeyPub, TpmRh.Owner);
                }
                else
                {
                    TpmPublic verifier;
                    AuthSig = AssociatedPolicy.ExecuteSignerCallback(this, nonceTpm,
                                                                     out verifier);
                    sigKey = tpm.LoadExternal(null, verifier, TpmRh.Owner);
                }
            }
            else
            {
                sigKey = tpm.LoadExternal(null, SigningKeyPub, TpmRh.Owner);
            }
            Timeout = tpm.PolicySigned(sigKey, sess, nonceTpm,
                                       CpHash, PolicyRef, ExpirationTime,
                                       AuthSig, out Ticket);

            TpmRc responseCode = tpm._GetLastResponseCode();

            tpm.FlushContext(sigKey);
            if (!KeepAuth)
            {
                AuthSig = null;
            }
            return(responseCode);
        }
All Usage Examples Of Tpm2Lib.Tpm2::PolicySigned
Tpm2