crypto/weakcryptospi/test/tplugins/src/signerimpl.cpp
changeset 8 35751d3474b7
child 49 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 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32def.h>
       
    20 #include <e32cmn.h>
       
    21 #include "keys.h"
       
    22 #include <cryptospi/cryptospidef.h>
       
    23 
       
    24 #include "signerimpl.h"
       
    25 #include "pluginconfig.h"
       
    26 
       
    27 using namespace SoftwareCrypto;
       
    28 
       
    29 CSignerImpl::CSignerImpl()
       
    30 	{
       
    31 	}
       
    32 
       
    33 CSignerImpl::~CSignerImpl()
       
    34 	{
       
    35 	delete iKey;
       
    36 	}
       
    37 
       
    38 void CSignerImpl::Close()
       
    39 	{
       
    40 	delete this;
       
    41 	}
       
    42 	
       
    43 void CSignerImpl::Reset()
       
    44 	{
       
    45 	}
       
    46 	
       
    47 TAny* CSignerImpl::GetExtension(TUid /*aExtensionId*/)
       
    48 	{
       
    49 	return 0;
       
    50 	}
       
    51 	
       
    52 void CSignerImpl::GetCharacteristicsL(const TAny*& aPluginCharacteristics)
       
    53 	{
       
    54 	TInt numCiphers = sizeof(KSignerCharacteristics)/sizeof(TAsymmetricSignatureCharacteristics*);
       
    55 	TInt32 implUid = ImplementationUid().iUid;
       
    56 	for (TInt i = 0; i < numCiphers; ++i)
       
    57 		{
       
    58 		if (KSignerCharacteristics[i]->cmn.iImplementationUID == implUid)
       
    59 			{
       
    60 			aPluginCharacteristics = KSignerCharacteristics[i];
       
    61 			break;
       
    62 			}
       
    63 		}
       
    64 	}
       
    65 
       
    66 void CSignerImpl::SetPaddingModeL(TUid /*aPaddingMode*/)
       
    67 	{
       
    68 	}
       
    69 	
       
    70 void CSignerImpl::SetKeyL(const CKey& /*aPrivateKey*/) 
       
    71 	{
       
    72 	}
       
    73 
       
    74 TInt CSignerImpl::GetMaximumInputLengthL() const 
       
    75 	{
       
    76 	// Override in subclass
       
    77 	User::Leave(KErrNotSupported);
       
    78 	return 0;
       
    79 	}
       
    80 TInt CSignerImpl::GetMaximumOutputLengthL() const
       
    81 	{
       
    82 	// Override in subclass
       
    83 	User::Leave(KErrNotSupported);
       
    84 	return 0;
       
    85 	}
       
    86 
       
    87 void CSignerImpl::DoSetKeyL(const CKey& aPrivateKey)
       
    88 	{
       
    89 	delete iKey;
       
    90 	iKey = CKey::NewL(aPrivateKey);
       
    91 	}
       
    92 
       
    93 void CSignerImpl::ConstructL(const CKey& aPrivateKey)
       
    94 	{
       
    95 	SetKeyL(aPrivateKey);
       
    96 	}