crypto/weakcryptospi/source/spi/keypair.cpp
changeset 8 35751d3474b7
child 43 2f10d260163b
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
       
     1 /*
       
     2 * Copyright (c) 2006-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 * Generic Keypair implementation
       
    16 * Generic Keypair implementation
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 /**
       
    22  @file
       
    23 */
       
    24 
       
    25 #include "keypair.h"
       
    26 #include <cryptospi/cryptoparams.h>
       
    27 #include "keys.h"
       
    28 
       
    29 #include "../common/inlines.h"
       
    30 
       
    31 using namespace CryptoSpi;
       
    32 
       
    33 
       
    34 EXPORT_C CKeyPair* CKeyPair::NewL(CKey* aPublicKey, CKey* aPrivateKey)
       
    35 	{
       
    36 	CKeyPair* self = new(ELeave) CKeyPair();
       
    37 	CleanupStack::PushL(self);
       
    38 	self->ConstructL(aPublicKey, aPrivateKey);
       
    39 	CleanupStack::Pop();
       
    40 	return self;
       
    41 	}
       
    42 
       
    43 EXPORT_C const CKey& CKeyPair::PublicKey() const
       
    44 	{
       
    45 	return *iPublicKey;
       
    46 	}
       
    47 	
       
    48 EXPORT_C const CKey& CKeyPair::PrivateKey() const
       
    49 	{
       
    50 	return *iPrivateKey;
       
    51 	}
       
    52 
       
    53 CKeyPair::CKeyPair()
       
    54 	{
       
    55 	}
       
    56 
       
    57 CKeyPair::~CKeyPair()
       
    58 	{
       
    59 	delete iPublicKey;
       
    60 	delete iPrivateKey;
       
    61 	}
       
    62 
       
    63 void CKeyPair::ConstructL(CKey* aPublicKey, CKey* aPrivateKey)
       
    64 	{
       
    65 	iPublicKey = aPublicKey;
       
    66 	iPrivateKey = aPrivateKey;
       
    67 	}