Exemple #1
0
 public override bool SupportsAuthType(AuthHandle.AuthType authType)
 {
     return authType == AuthHandle.AuthType.OIAP;
 }
Exemple #2
0
 /// <summary>
 /// Integrates the nonce even, nonce even osap and auth handle from the givn authhandle
 /// </summary>
 /// <param name="other">
 /// A <see cref="AuthHandle"/>
 /// </param>
 public void UpdateFromOtherAuthHandle(AuthHandle other)
 {
     _nonceEven     = other._nonceEven;
     _nonceEvenOSAP = other._nonceEvenOSAP;
     _authHandle    = other._authHandle;
 }
Exemple #3
0
 /// <summary>
 /// Integrates the nonce even, nonce even osap and auth handle from the givn authhandle
 /// </summary>
 /// <param name="other">
 /// A <see cref="AuthHandle"/>
 /// </param>
 public void UpdateFromOtherAuthHandle(AuthHandle other)
 {
     _nonceEven = other._nonceEven;
     _nonceEvenOSAP = other._nonceEvenOSAP;
     _authHandle = other._authHandle;
 }
 public void RemoveAuthorizationHandle(IAuthorizableCommand cmd, AuthHandle handle)
 {
     _tpmContext.AuthHandleManager.RemoveAuthHandles(cmd, handle);
 }
 public abstract bool SupportsAuthType(AuthHandle.AuthType authType);
 public void DestroyAuthorizationHandle(IAuthorizableCommand cmd, AuthHandle handle)
 {
     _tpmContext.AuthHandleManager.DestroyAuthHandles(cmd, handle);
 }
Exemple #7
0
        public override TPMCommandResponse Process()
        {
            TPMEntityTypeLSB entityLSB = _params.GetValueOf<TPMEntityTypeLSB>("entity_lsb");
            TPMEntityTypeMSB entityMSB = _params.GetValueOf<TPMEntityTypeMSB>("entity_msb");
            string identifier = _params.GetValueOf<string>("entity_value");

            if( entityLSB != TPMEntityTypeLSB.TPM_ET_KEYHANDLE &&
                entityLSB != TPMEntityTypeLSB.TPM_ET_SRK &&
                entityLSB != TPMEntityTypeLSB.TPM_ET_OWNER)
            {
                throw new ArgumentException("TPM_OSAP does currently not support entityType: " + entityLSB.ToString());
            }

            if(entityMSB != TPMEntityTypeMSB.TPM_ET_XOR)
            {
                throw new ArgumentException(string.Format("TPM_OSAP does currently not support '{0}' EncAuth encryption", entityMSB));
            }

            if(entityLSB == TPMEntityTypeLSB.TPM_ET_KEYHANDLE ||
               entityLSB == TPMEntityTypeLSB.TPM_ET_SRK)
            {
                //We now know that the current identifier is a key identifier (maybe srk, but then the value is ignored by TPM_OSAP).
                //So we invoke the key manager to load the key with the specified identifier and establish an OSAP session
                _keyManager.LoadKey(identifier);
            }

            //handle is not known yet
            AuthHandle authHandle = new AuthHandle(AuthHandle.AuthType.OSAP, 0);
            authHandle.EntityType = entityLSB;
            authHandle.NewNonceOddOSAP();

            using(_keyManager.AcquireLock())
            {

                TPMBlob requestBlob = new TPMBlob();
                requestBlob.WriteCmdHeader(TPMCmdTags.TPM_TAG_RQU_COMMAND, TPMOrdinals.TPM_ORD_OSAP);
                requestBlob.WriteUInt16((ushort)(((ushort)entityMSB <<  8) | (ushort)entityLSB));

                if(entityLSB == TPMEntityTypeLSB.TPM_ET_KEYHANDLE ||
                   entityLSB == TPMEntityTypeLSB.TPM_ET_SRK)
                {
                    if (identifier == KeyHandle.KEY_SRK)
                    {
                        requestBlob.WriteUInt32((uint)TPMKeyHandles.TPM_KH_SRK);
                        authHandle.EntityValue = (uint)TPMKeyHandles.TPM_KH_SRK;
                    }
                    else
                    {
                        KeyHandle keyHandle = _keyManager.IdentifierToHandle(identifier);
                        requestBlob.WriteUInt32(keyHandle.Handle);
                        authHandle.EntityValue = keyHandle.Handle;
                    }
                }
                else if(entityLSB == TPMEntityTypeLSB.TPM_ET_OWNER)
                {
                    requestBlob.WriteUInt32((uint)TPMKeyHandles.TPM_KH_OWNER);
                    authHandle.EntityValue = (uint)TPMKeyHandles.TPM_KH_OWNER;
                }

                requestBlob.Write(authHandle.NonceOddOSAP, 0, authHandle.NonceOddOSAP.Length);
                requestBlob.WriteCmdSize();

                _commandAuthHelper.EnsureFreeSlot();
                _responseBlob = TransmitMe(requestBlob);
            }

            _responseBlob.SkipHeader();
            AuthHandleCore receivedAuthHandle = new AuthHandleCore(AuthHandle.AuthType.OSAP, _responseBlob);
            authHandle.UpdateFromOtherAuthHandle(receivedAuthHandle);

            _responseParameters = new Parameters();
            _responseParameters.AddValue("auth_handle", authHandle);
            return new TPMCommandResponse(true, TPMCommandNames.TPM_CMD_OSAP, _responseParameters);
        }
Exemple #8
0
 public AuthorizationInfo(AuthHandle authHandle, bool continueAuthSession, byte[] authData)
 {
     _authHandle          = authHandle;
     _authData            = authData;
     _continueAuthSession = continueAuthSession;
 }
Exemple #9
0
 public AuthorizationInfo(AuthHandle authHandle, bool continueAuthSession, byte[] authData)
 {
     _authHandle = authHandle;
     _authData = authData;
     _continueAuthSession = continueAuthSession;
 }
Exemple #10
0
 public override bool SupportsAuthType(AuthHandle.AuthType authType)
 {
     //TPM_TakeOwnership only supports OIAP
     return authType == AuthHandle.AuthType.OIAP;
 }