crypto/weakcryptospi/inc/keyidentifierutil.h
changeset 8 35751d3474b7
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
       
     1 /*
       
     2 * Copyright (c) 2003-2009 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 the License "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: 
       
    15 * This utility class provides functions to generate key identifer data from
       
    16 * supplied key data
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 /**
       
    22  @file
       
    23  @publishedPartner
       
    24  @released
       
    25 */
       
    26 
       
    27 #ifndef _KEYIDENTIFIERUTIL_H_
       
    28 #define _KEYIDENTIFIERUTIL_H_
       
    29 
       
    30 #include <e32base.h>
       
    31 
       
    32 class CRSAPublicKey;
       
    33 class CDSAPublicKey;
       
    34 class RInteger;
       
    35 
       
    36 /** The length of a SHA-1 hash 
       
    37   * @publishedPartner
       
    38   * @released
       
    39   */
       
    40  const TInt KSHA1HashLengthInBytes = 20;
       
    41 
       
    42 /**
       
    43   * A SHA-1 hash.
       
    44   * @publishedPartner
       
    45   * @released
       
    46   */
       
    47  typedef  TBuf8<KSHA1HashLengthInBytes> TSHA1Hash;
       
    48  
       
    49   
       
    50  /**
       
    51   * A SHA-1 hash is also used as a key identifier.
       
    52   * @publishedPartner
       
    53   * @released
       
    54   */
       
    55  typedef TSHA1Hash TKeyIdentifier;
       
    56 
       
    57 
       
    58 /**
       
    59  * Utilities for generation of the key identifier
       
    60  * @publishedPartner
       
    61  * @released
       
    62  */
       
    63 class KeyIdentifierUtil
       
    64 	{
       
    65 public:
       
    66 	/**
       
    67 	 * Creates a RSA key identifier using the RSAPublicKey.
       
    68 	 *
       
    69 	 * @param aKey	The RSA encryption key
       
    70 	 * @param aIdentifier	key identifier
       
    71 	  */
       
    72 	IMPORT_C static void RSAKeyIdentifierL(const CRSAPublicKey& aKey, TKeyIdentifier& aIdentifier);
       
    73 	/**
       
    74 	 * Creates a DSA key identifier using the DSAPublicKey.
       
    75 	 *
       
    76 	 * @param aKey	The DSA encryption key
       
    77 	 * @param aIdentifier	key identifier
       
    78 	  */
       
    79 	IMPORT_C static void DSAKeyIdentifierL(const CDSAPublicKey& aKey, TKeyIdentifier& aIdentifier);
       
    80 	/**
       
    81 	 * Creates a DHKeyIdentifier using the RInteger.
       
    82 	 *
       
    83 	 * @param aKey			The DH parameter 
       
    84 	 * @param aIdentifier	key identifier
       
    85 	  */
       
    86 	IMPORT_C static void DHKeyIdentifierL(const RInteger& aKey, TKeyIdentifier& aIdentifier);
       
    87 	};
       
    88 
       
    89 #endif