crypto/weakcryptospi/source/asymmetric/rsaverifier.cpp
changeset 19 cd501b96611d
equal deleted inserted replaced
15:da2ae96f639b 19:cd501b96611d
       
     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 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "rsashim.h"
       
    20 
       
    21 /* CRSAVerifier */
       
    22 
       
    23 EXPORT_C CRSAVerifier::CRSAVerifier(void)
       
    24 	{
       
    25 	}
       
    26 
       
    27 /* CRSAPKCS1v15Verifier */
       
    28 EXPORT_C CRSAPKCS1v15Verifier* CRSAPKCS1v15Verifier::NewL(const CRSAPublicKey& aKey)
       
    29 	{
       
    30 	return CRSAPKCS1v15VerifierShim::NewL(aKey);
       
    31 	}
       
    32 
       
    33 EXPORT_C CRSAPKCS1v15Verifier* CRSAPKCS1v15Verifier::NewLC(const CRSAPublicKey& aKey)
       
    34 	{
       
    35 	return CRSAPKCS1v15VerifierShim::NewLC(aKey);
       
    36 	}
       
    37 
       
    38 CRSAPKCS1v15Verifier::~CRSAPKCS1v15Verifier(void)
       
    39 	{
       
    40 	}
       
    41 
       
    42 CRSAPKCS1v15Verifier::CRSAPKCS1v15Verifier(const CRSAPublicKey& aKey)
       
    43 	: iPublicKey(aKey)
       
    44 	{
       
    45 	}
       
    46 
       
    47 // All these methods have been replaced by the shim
       
    48 #ifdef _BullseyeCoverage
       
    49 #pragma suppress_warnings on
       
    50 #pragma BullseyeCoverage off
       
    51 #pragma suppress_warnings off
       
    52 #endif
       
    53 TInt CRSAPKCS1v15Verifier::MaxInputLength(void) const
       
    54 	{
       
    55 	// Method replaced by shim
       
    56 	ASSERT(EFalse);
       
    57 	return 0;
       
    58 	}
       
    59 
       
    60 TInt CRSAPKCS1v15Verifier::MaxOutputLength(void) const
       
    61 	{
       
    62 	// Method replaced by shim
       
    63 	ASSERT(EFalse);
       
    64 	return 0;
       
    65 	}
       
    66 
       
    67 HBufC8* CRSAPKCS1v15Verifier::InverseSignLC(const CRSASignature& /*aSignature*/) const
       
    68 	{
       
    69 	// Method replaced by shim
       
    70 	ASSERT(EFalse);
       
    71 	return 0;
       
    72 	}
       
    73 
       
    74 void CRSAPKCS1v15Verifier::ConstructL(void)
       
    75 	{
       
    76 	// Method replaced by shim
       
    77 	ASSERT(EFalse);
       
    78 	}
       
    79 
       
    80 // InverseSignLC is replaced by shim. So, VerifyL also can not be used properly, hence excluded from coverage.
       
    81 EXPORT_C TBool CRSAVerifier::VerifyL(const TDesC8& aInput, const CRSASignature& aSignature) const
       
    82 	{
       
    83 	TBool retval = EFalse;
       
    84 	HBufC8* inverseSign = InverseSignLC(aSignature);
       
    85 	
       
    86 	if (inverseSign->Compare(aInput)==0)
       
    87 		{
       
    88 		retval = ETrue;
       
    89 		}
       
    90 	CleanupStack::PopAndDestroy(inverseSign);
       
    91 	return retval;	
       
    92 	}