hti/HtiFramework/inc/HtiSecurityManager.h
branchRCL_3
changeset 59 8ad140f3dd41
parent 0 a03f92240627
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
       
     1 /*
       
     2 * Copyright (c) 2743 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Security interface for HTI framework will provide
       
    15 *        implementation of security functionality:
       
    16 *        - authenication (establishing security context),
       
    17 *        - integrity (generating Message Integrity Code),
       
    18 *        - confidentiality (message encryption/decryption).
       
    19 *        The interface and terms are based on the GSS API [RFC 2743].
       
    20 *
       
    21 */
       
    22 
       
    23 
       
    24 #ifndef SECURITYMANAGER_H__
       
    25 #define SECURITYMANAGER_H__
       
    26 
       
    27 #include <e32base.h>
       
    28 
       
    29 
       
    30 class CHtiSecurityManager : public CBase
       
    31     {
       
    32 public:
       
    33     static CHtiSecurityManager* NewL();
       
    34     static CHtiSecurityManager* NewLC();
       
    35 
       
    36     virtual ~CHtiSecurityManager();
       
    37 
       
    38     /**
       
    39     * Processes the token in question and generates reply tokens
       
    40     * for security context establishment.
       
    41     * The function is called as many times as needed depending on
       
    42     * underlying authentication algorithm
       
    43     *
       
    44     * @param aToken token received from client that wish to establish
       
    45     *       communcation with HTI framework
       
    46     *
       
    47     * @return reply token that should be sent back to the client,
       
    48     *         transfer ownership
       
    49     */
       
    50     TDesC8* SetSecurityContext(const TDesC8& aToken);
       
    51 
       
    52     /**
       
    53     * Checks either security context has been established
       
    54     */
       
    55     TBool IsContextEstablashed() const;
       
    56 
       
    57     /**
       
    58     * Reset security context
       
    59     */
       
    60     void ResetSecurityContext();
       
    61 
       
    62     /**
       
    63     * Implementeion of integrity and confedentiality services.
       
    64     * It can generates message MIC and combine it with message.
       
    65     * Optionaly, the message also can be encrypted.
       
    66     *
       
    67     * @param aMessage message to be wrapped
       
    68     * @param aEncrypt flag indicates that message should be encrypted
       
    69     *
       
    70     * @return wrapped message ready to send, transfer ownership
       
    71     *
       
    72     */
       
    73     TDesC8* WrapL(const TDesC8& aMessage, TBool aEncrypt = EFalse);
       
    74 
       
    75     /**
       
    76     * Implementeion of integrity and confedentiality services.
       
    77     * It unwrape message that was previosly wrapped.
       
    78     *
       
    79     * @param aMessage wrapped message
       
    80     *
       
    81     * @return plain message ready for processing, transfer ownership
       
    82     *
       
    83     */
       
    84     TDesC8* UnwrapL(const TDesC8& aMessage);
       
    85 
       
    86     /**
       
    87     * Generates MIC for a message in question.
       
    88     *
       
    89     * @param aMessage plain message
       
    90     *
       
    91     * @return MIC generated by an underlying algorithm (e.g. CRC16)
       
    92     */
       
    93     TPtrC8 MIC(const TDesC8& aMessage) const;
       
    94 
       
    95 protected:
       
    96     CHtiSecurityManager();
       
    97     void ConstructL();
       
    98 
       
    99 protected:
       
   100     TBool iSecurityContext;
       
   101     };
       
   102 
       
   103 #endif