<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="urn:liberty:ac:2003-08" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns="urn:liberty:ac:2003-08">

    <!-- added to get the Extension element -->
    <xs:include schemaLocation="liberty-utility-v1.1.xsd"/>

    <xs:annotation>
        <xs:documentation> ### IMPORTANT NOTICE ###

            The source code in this XSD file was excerpted verbatim from:

            Liberty Authentication Context Specification
            Version 1.3
            14 December 2004
            
            Copyright (c) 2004 Liberty Alliance participants, see
            http://www.projectliberty.org/specs/idwsf_1_1_copyrights.php

        </xs:documentation>
    </xs:annotation>
    <xs:element name="AuthenticationContextStatement" type="AuthenticationContextStatementType">
        <xs:annotation>
            <xs:documentation>
                A particular assertion on an identity
                provider's part with respect to the authentication
                context associated with an authentication assertion. 
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="Identification" type="IdentificationType">
        <xs:annotation>
            <xs:documentation>
                Refers to those characteristics that describe the processes and mechanisms 
                the Authentication Authority uses to initially create an association between a Principal 
                and the identity (or name) by which the Principal will be known
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="PhysicalVerification">
        <xs:annotation>
            <xs:documentation>
                This element indicates that identification has been performed in a physical 
                face-to-face meeting with the principal and not in an online manner. 
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="credentialLevel">
                <xs:simpleType>
                    <xs:restriction base="xs:NMTOKEN">
                        <xs:enumeration value="primary"/>
                        <xs:enumeration value="secondary"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="WrittenConsent">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="TechnicalProtection" type="TechnicalProtectionType">
        <xs:annotation>
            <xs:documentation>
                Refers to those characterstics that describe how the 'secret' (the knowledge or possession 
                of which allows the Principal to authenticate to the Authentication Authority) is kept secure
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="SecretKeyProtection" type="SecretKeyProtectionType">
        <xs:annotation>
            <xs:documentation>
                This element indicates the types and strengths of facilities 
                of a UA used to protect a shared secret key from unauthorized access and/or use.
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="PrivateKeyProtection" type="PrivateKeyProtectionType">
        <xs:annotation>
            <xs:documentation>
                This element indicates the types and strengths of facilities            
                of a UA used to protect a private key from unauthorized access and/or use.
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="KeyActivation" type="KeyActivationType">
        <xs:annotation>
            <xs:documentation>The actions that must be performed before the private key can be used. </xs:documentation>
        </xs:annotation>
    </xs:element>
   <xs:element name="KeySharing" type="KeySharingType">
        <xs:annotation>
            <xs:documentation>Whether or not the private key is shared with the certificate authority.</xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="KeyStorage" type="KeyStorageType">
        <xs:annotation>
            <xs:documentation>
                In which medium is the key stored.
                memory - the key is stored in memory. 
                smartcard - the key is stored in a smartcard.
                token - the key is stored in a hardware token. 
                MobileDevice - the key is stored in a mobile device.
                MobileAuthCard - the key is stored in a mobile authentication card. 
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="Password" type="PasswordType">
        <xs:annotation>
            <xs:documentation>
                This element indicates that a password (or passphrase) has been used to 
                authenticate the Principal to a remote system.
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="ActivationPin" type="ActivationPinType">
        <xs:annotation>
            <xs:documentation>
                This element indicates that a Pin (Personal Identification Number) has been used to authenticate the Principal to some local system in order to activate a key.  
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="Token" type="TokenType">
        <xs:annotation>
            <xs:documentation>
                This element indicates that a hardware or software token is  used 
                as a method of identifying the Principal.
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="TimeSyncToken" type="TimeSyncTokenType">
        <xs:annotation>
            <xs:documentation>
                This element indicates that a time synchronization  
                token is used to identify the Principal. hardware - the time synchronization 
                token has been implemented in hardware. software - the time synchronization 
                token has been implemented in software. SeedLength - the length, in bits, of the 
                random seed used in the time synchronization token. 
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="Smartcard">
        <xs:annotation>
            <xs:documentation>
                This element indicates that a smartcard is used to identity the Principal.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="Length" type="LengthType">
        <xs:annotation>
            <xs:documentation>
                This element indicates the minimum and/or maximum ASCII  length of the password which is enforced (by the UA or the IdP).  In other words,  this is the minimum and/or maximum number of ASCII characters required to represent a valid password.                               
                min - the minimum number of ASCII characters required in a valid password, as enforced by the UA or the IdP.                    
                max - the maximum number of ASCII characters required in a valid password, as enforced by the UA or the IdP.
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="ActivationLimit" type="ActivationLimitType">
        <xs:annotation>
            <xs:documentation>
                This element indicates the length of time for which an PIN-based authentication is valid.                              
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="Generation">
        <xs:annotation>
            <xs:documentation>
                Indicates whether the password was chosen by the Principal or auto-supplied by the Authentication Authority.
                principalchosen - the Principal is allowed to choose the value of the password.  This is true even if 
                the initial password is chosen at random by the UA or the IdP and the Principal is then free to change 
                the password. 
                automatic - the password is chosen by the UA or the IdP to be cryptographically strong in some sense, 
                or to satisfy certain  password rules, and that the Principal is not free to change it or to choose a new password.     
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="mechanism" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:NMTOKEN">
                        <xs:enumeration value="principalchosen"/>
                        <xs:enumeration value="automatic"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="AuthenticationMethod" type="AuthenticationMethodType">
        <xs:annotation>
            <xs:documentation>
                Refers to those characteristics that define the mechanisms by which the Principal authenticates to the Authentication Authority.
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="PrincipalAuthenticationMechanism" type="PrincipalAuthenticationMechanismType">
        <xs:annotation>
            <xs:documentation>
                The method that a Principal employs to perform authentication to local system components.
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="Authenticator" type="AuthenticatorType">
        <xs:annotation>
            <xs:documentation>
                The method applied to validate a principal's authentication across a network 
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="PreviousSession">
        <xs:annotation>
            <xs:documentation>
                Indicates that the Principal has been strongly authenticated in a previous session during which  the IdP has set a cookie in the UA.  During the present session the Principal has only been authenticated by the UA returning the cookie to the IdP.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="ResumeSession">
        <xs:annotation>
            <xs:documentation>
                Rather like PreviousSession but using stronger security.  A secret that was established in a previous session with the Authentication Authority has been cached by the local system and is now re-used (e.g. a Master Secret is used to derive new session keys in TLS, SSL, WTLS).
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="ZeroKnowledge">
        <xs:annotation>
            <xs:documentation>
                This element indicates that the Principal has been authenticated by a zero knowledge technique as specified in ISO/IEC 9798-5.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="SharedSecretChallengeResponse">
        <xs:annotation>
            <xs:documentation>
                This element indicates that the Principal has been authenticated by a challenge-response protocol utilizing shared secret keys and symmetric cryptography.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="DigSig">
        <xs:annotation>
            <xs:documentation>
                This element indicates that the Principal has been authenticated by a mechanism which involves the Principal computing a digital signature over at least challenge data provided by the IdP.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="IPAddress">
        <xs:annotation>
            <xs:documentation>
                This element indicates that the Principal has been authenticated through connection from a particular IP address.                     
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="AsymmetricDecryption">
        <xs:annotation>
            <xs:documentation>
                     The local system has a private key but it is used in decryption mode, rather than signature mode. For example, the Authentication Authority generates a secret and encrypts it using the local system's public key: the local system then proves it has decrypted the secret.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="AsymmetricKeyAgreement">
        <xs:annotation>
            <xs:documentation>
                    The local system has a private key and uses it for shared secret key agreement with the Authentication Authority (e.g. via Diffie Helman).
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="SharedSecretDynamicPlaintext">
        <xs:annotation>
            <xs:documentation>
                     The local system and Authentication Authority share a secret key.  The local system uses this to encrypt a randomized string to pass to the Authentication Authority.       
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="AuthenticatorTransportProtocol" type="AuthenticatorTransportProtocolType">
        <xs:annotation>
            <xs:documentation>
                The protocol across which Authenticator information is transferred to an Authentication Authority verifier.
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="HTTP">
        <xs:annotation>
            <xs:documentation>
                This element indicates that the Authenticator has been transmitted using bare HTTP utilizing no additional security protocols.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="IPSec">
        <xs:annotation>
            <xs:documentation>
                This element indicates that the Authenticator has been transmitted using a transport mechanism protected by an IPSEC session.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="WTLS">
        <xs:annotation>
            <xs:documentation>
                This element indicates that the Authenticator has been transmitted using a transport mechanism protected by a WTLS session.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="MobileNetworkNoEncryption">
        <xs:annotation>
            <xs:documentation>
                This element indicates that the Authenticator has been transmitted solely across a mobile network using no additional security mechanism.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
  <xs:element name="MobileNetworkRadioEncryption">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
  <xs:element name="MobileNetworkEndToEndEncryption">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="SSL">
        <xs:annotation>
            <xs:documentation>
                This element indicates that the Authenticator has been transmitted using a transport mechanism protected by an SSL or TLS session.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="OperationalProtection" type="OperationalProtectionType">
        <xs:annotation>
            <xs:documentation>
                Refers to those characteristics that describe procedural security controls employed by the Authentication Authority.
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="SecurityAudit" type="SecurityAuditType"/>
    <xs:element name="SwitchAudit">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="DeactivationCallCenter">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="GoverningAgreements" type="GoverningAgreementsType">
        <xs:annotation>
            <xs:documentation>
                Provides a mechanism for linking to external (likely human readable) documents in which additional business agreements,(e.g. liability constraints, obligations, etc) can be placed.
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="GoverningAgreementRef" type="GoverningAgreementRefType"/>
    <xs:element name="AuthenticatingAuthority" type="AuthenticatingAuthorityType">
        <xs:annotation>
            <xs:documentation>
                The Authority that originally authenticated the Principal.
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:complexType name="IdentificationType">
        <xs:sequence>
            <xs:element ref="PhysicalVerification" minOccurs="0"/>
            <xs:element ref="WrittenConsent" minOccurs="0"/>
            <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="nym">
            <xs:annotation>
                <xs:documentation>
                    This attribute indicates whether or not the Identification mechanisms allow the  actions of the Principal to be linked to an actual end user.
                </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:NMTOKEN">
                    <xs:enumeration value="anonymity"/>
                    <xs:enumeration value="verinymity"/>
                    <xs:enumeration value="pseudonymity"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:complexType>
    <xs:complexType name="GoverningAgreementsType">
        <xs:sequence>
            <xs:element ref="GoverningAgreementRef" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="GoverningAgreementRefType">
        <xs:attribute name="governingAgreementRef" type="xs:anyURI" use="required"/>
    </xs:complexType>
    <xs:complexType name="AuthenticatingAuthorityType">
        <xs:sequence>
            <xs:element ref="GoverningAgreements"/>
        </xs:sequence>
        <xs:attribute name="ID" type="xs:anyURI" use="required"/>
    </xs:complexType>
    <xs:complexType name="AuthenticatorTransportProtocolType">
        <xs:choice>
            <xs:element ref="HTTP"/>
            <xs:element ref="SSL"/>
            <xs:element ref="MobileNetworkNoEncryption"/>
            <xs:element ref="MobileNetworkRadioEncryption"/>
            <xs:element ref="MobileNetworkEndToEndEncryption"/>
            <xs:element ref="WTLS"/>
            <xs:element ref="IPSec"/>
            <xs:element ref="Extension" maxOccurs="unbounded"/>
        </xs:choice>
    </xs:complexType>
    <xs:complexType name="PrincipalAuthenticationMechanismType">
        <xs:choice>
            <xs:element ref="Password"/>
            <xs:element ref="Token"/>
            <xs:element ref="Smartcard"/>
            <xs:element ref="ActivationPin"/>
            <xs:element ref="Extension" maxOccurs="unbounded"/>
        </xs:choice>
    </xs:complexType>
    <xs:complexType name="AuthenticationMethodType">
        <xs:sequence>
            <xs:element ref="PrincipalAuthenticationMechanism" minOccurs="0"/>
            <xs:element ref="Authenticator" minOccurs="0"/>
            <xs:element ref="AuthenticatorTransportProtocol" minOccurs="0"/>
            <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="AuthenticationContextStatementType">
        <xs:sequence>
            <xs:element ref="Identification" minOccurs="0"/>
            <xs:element ref="TechnicalProtection" minOccurs="0"/>
            <xs:element ref="OperationalProtection" minOccurs="0"/>
            <xs:element ref="AuthenticationMethod" minOccurs="0"/>
            <xs:element ref="GoverningAgreements" minOccurs="0"/>
            <xs:element ref="AuthenticatingAuthority" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="ID" type="xs:ID"/>
    </xs:complexType>
    <xs:complexType name="TechnicalProtectionType">
        <xs:choice>
            <xs:element ref="PrivateKeyProtection" minOccurs="0"/>
            <xs:element ref="SecretKeyProtection" minOccurs="0"/>
            <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
        </xs:choice>
    </xs:complexType>
    <xs:complexType name="OperationalProtectionType">
        <xs:sequence>
            <xs:element ref="SecurityAudit" minOccurs="0"/>
            <xs:element ref="DeactivationCallCenter" minOccurs="0"/>
            <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="AuthenticatorType">
        <xs:choice>
            <xs:element ref="PreviousSession"/>
            <xs:element ref="ResumeSession"/>
            <xs:element ref="DigSig"/>
            <xs:element ref="Password"/>
            <xs:element ref="ZeroKnowledge"/>
            <xs:element ref="SharedSecretChallengeResponse"/>
            <xs:element ref="SharedSecretDynamicPlaintext"/>
            <xs:element ref="IPAddress"/>
            <xs:element ref="AsymmetricDecryption"/>
            <xs:element ref="AsymmetricKeyAgreement"/>
            <xs:element ref="Extension" maxOccurs="unbounded"/>
        </xs:choice>
    </xs:complexType>
    <xs:complexType name="KeyActivationType">
        <xs:choice>
            <xs:element ref="ActivationPin"/>
            <xs:element ref="Extension" maxOccurs="unbounded"/>
        </xs:choice>
    </xs:complexType>
    <xs:complexType name="KeySharingType">
        <xs:attribute name="sharing" type="xs:boolean" use="required"/>
    </xs:complexType>
    <xs:complexType name="PrivateKeyProtectionType">
        <xs:sequence>
            <xs:element ref="KeyActivation" minOccurs="0"/>
            <xs:element ref="KeyStorage" minOccurs="0"/>
            <xs:element ref="KeySharing" minOccurs="0"/>
            <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    
    <xs:complexType name="PasswordType">
        <xs:sequence>
            <xs:element ref="Length" minOccurs="0"/>
            <xs:element ref="Alphabet" minOccurs="0"/>
            <xs:element ref="Generation" minOccurs="0"/>
            <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="ActivationPinType">
        <xs:sequence>
            <xs:element ref="Length" minOccurs="0"/>
            <xs:element ref="Alphabet" minOccurs="0"/>
            <xs:element ref="Generation" minOccurs="0"/>
            <xs:element ref="ActivationLimit" minOccurs="0"/>
            <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>

    <xs:element name="Alphabet" type="AlphabetType"/>

    <xs:complexType name="AlphabetType">
        <xs:attribute name="requiredChars" type="xs:string" use="required"/>
        <xs:attribute name="excludedChars" type="xs:string" use="optional"/>
        <xs:attribute name="case" type="xs:string" use="optional"/>
    </xs:complexType>

    <xs:complexType name="TokenType">
        <xs:sequence>
            <xs:element ref="TimeSyncToken"/>
            <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="TimeSyncTokenType">
        <xs:attribute name="DeviceType" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:NMTOKEN">
                    <xs:enumeration value="hardware"/>
                    <xs:enumeration value="software"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="SeedLength" type="xs:integer" use="required"/>
        <xs:attribute name="DeviceInHand" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:NMTOKEN">
                    <xs:enumeration value="true"/>
                    <xs:enumeration value="false"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:complexType>
    <xs:complexType name="ActivationLimitType">
        <xs:choice>
          <xs:element ref="ActivationLimitDuration"/>
          <xs:element ref="ActivationLimitUsages"/>
          <xs:element ref="ActivationLimitSession"/>
        </xs:choice>
    </xs:complexType>
    
      <xs:element name="ActivationLimitDuration" type="ActivationLimitDurationType">
        <xs:annotation>
           <xs:documentation>
              This element indicates that the Key Activation Limit is defined as a specific duration of time. 
           </xs:documentation>
        </xs:annotation>
      </xs:element>

      <xs:element name="ActivationLimitUsages" type="ActivationLimitUsagesType">
        <xs:annotation>
           <xs:documentation>
              This element indicates that the Key Activation Limit is defined as a number of usages. 
           </xs:documentation>
        </xs:annotation>
      </xs:element>

      <xs:element name="ActivationLimitSession" type="ActivationLimitSessionType">
        <xs:annotation>
           <xs:documentation>
              This element indicates that the Key Activation Limit is the session. 
           </xs:documentation>
        </xs:annotation>
      </xs:element>

       <xs:complexType name="ActivationLimitDurationType">
          <xs:attribute name="duration" type="xs:duration" use="required"/>
       </xs:complexType>

       <xs:complexType name="ActivationLimitUsagesType">
          <xs:attribute name="number" type="xs:integer" use="required"/>
       </xs:complexType>

       <xs:complexType name="ActivationLimitSessionType"/>

    <xs:complexType name="LengthType">
        <xs:attribute name="min" type="xs:integer" use="required"/>
        <xs:attribute name="max" type="xs:integer" use="optional"/>
    </xs:complexType>

    <xs:complexType name="KeyStorageType">
        <xs:attribute name="medium" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:NMTOKEN">
                    <xs:enumeration value="memory"/>
                    <xs:enumeration value="smartcard"/>
                    <xs:enumeration value="token"/>
                    <xs:enumeration value="MobileDevice"/>
                    <xs:enumeration value="MobileAuthCard"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:complexType>
    <xs:complexType name="SecretKeyProtectionType">
        <xs:sequence>
            <xs:element ref="KeyActivation" minOccurs="0"/>
            <xs:element ref="KeyStorage" minOccurs="0"/>
            <xs:element ref="Extension" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="SecurityAuditType">
        <xs:sequence>
            <xs:element ref="SwitchAudit" minOccurs="0"/>
            <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>

