os/security/crypto/weakcryptospi/inc/keyidentifierutil.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
* This utility class provides functions to generate key identifer data from
sl@0
    16
* supplied key data
sl@0
    17
*
sl@0
    18
*/
sl@0
    19
sl@0
    20
sl@0
    21
/**
sl@0
    22
 @file
sl@0
    23
 @publishedPartner
sl@0
    24
 @released
sl@0
    25
*/
sl@0
    26
sl@0
    27
#ifndef _KEYIDENTIFIERUTIL_H_
sl@0
    28
#define _KEYIDENTIFIERUTIL_H_
sl@0
    29
sl@0
    30
#include <e32base.h>
sl@0
    31
sl@0
    32
class CRSAPublicKey;
sl@0
    33
class CDSAPublicKey;
sl@0
    34
class RInteger;
sl@0
    35
sl@0
    36
/** The length of a SHA-1 hash 
sl@0
    37
  * @publishedPartner
sl@0
    38
  * @released
sl@0
    39
  */
sl@0
    40
 const TInt KSHA1HashLengthInBytes = 20;
sl@0
    41
sl@0
    42
/**
sl@0
    43
  * A SHA-1 hash.
sl@0
    44
  * @publishedPartner
sl@0
    45
  * @released
sl@0
    46
  */
sl@0
    47
 typedef  TBuf8<KSHA1HashLengthInBytes> TSHA1Hash;
sl@0
    48
 
sl@0
    49
  
sl@0
    50
 /**
sl@0
    51
  * A SHA-1 hash is also used as a key identifier.
sl@0
    52
  * @publishedPartner
sl@0
    53
  * @released
sl@0
    54
  */
sl@0
    55
 typedef TSHA1Hash TKeyIdentifier;
sl@0
    56
sl@0
    57
sl@0
    58
/**
sl@0
    59
 * Utilities for generation of the key identifier
sl@0
    60
 * @publishedPartner
sl@0
    61
 * @released
sl@0
    62
 */
sl@0
    63
class KeyIdentifierUtil
sl@0
    64
	{
sl@0
    65
public:
sl@0
    66
	/**
sl@0
    67
	 * Creates a RSA key identifier using the RSAPublicKey.
sl@0
    68
	 *
sl@0
    69
	 * @param aKey	The RSA encryption key
sl@0
    70
	 * @param aIdentifier	key identifier
sl@0
    71
	  */
sl@0
    72
	IMPORT_C static void RSAKeyIdentifierL(const CRSAPublicKey& aKey, TKeyIdentifier& aIdentifier);
sl@0
    73
	/**
sl@0
    74
	 * Creates a DSA key identifier using the DSAPublicKey.
sl@0
    75
	 *
sl@0
    76
	 * @param aKey	The DSA encryption key
sl@0
    77
	 * @param aIdentifier	key identifier
sl@0
    78
	  */
sl@0
    79
	IMPORT_C static void DSAKeyIdentifierL(const CDSAPublicKey& aKey, TKeyIdentifier& aIdentifier);
sl@0
    80
	/**
sl@0
    81
	 * Creates a DHKeyIdentifier using the RInteger.
sl@0
    82
	 *
sl@0
    83
	 * @param aKey			The DH parameter 
sl@0
    84
	 * @param aIdentifier	key identifier
sl@0
    85
	  */
sl@0
    86
	IMPORT_C static void DHKeyIdentifierL(const RInteger& aKey, TKeyIdentifier& aIdentifier);
sl@0
    87
	};
sl@0
    88
sl@0
    89
#endif