os/security/crypto/weakcryptospi/source/asymmetric/rsaverifier.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/crypto/weakcryptospi/source/asymmetric/rsaverifier.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,92 @@
     1.4 +/*
     1.5 +* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#include "rsashim.h"
    1.23 +
    1.24 +/* CRSAVerifier */
    1.25 +
    1.26 +EXPORT_C CRSAVerifier::CRSAVerifier(void)
    1.27 +	{
    1.28 +	}
    1.29 +
    1.30 +/* CRSAPKCS1v15Verifier */
    1.31 +EXPORT_C CRSAPKCS1v15Verifier* CRSAPKCS1v15Verifier::NewL(const CRSAPublicKey& aKey)
    1.32 +	{
    1.33 +	return CRSAPKCS1v15VerifierShim::NewL(aKey);
    1.34 +	}
    1.35 +
    1.36 +EXPORT_C CRSAPKCS1v15Verifier* CRSAPKCS1v15Verifier::NewLC(const CRSAPublicKey& aKey)
    1.37 +	{
    1.38 +	return CRSAPKCS1v15VerifierShim::NewLC(aKey);
    1.39 +	}
    1.40 +
    1.41 +CRSAPKCS1v15Verifier::~CRSAPKCS1v15Verifier(void)
    1.42 +	{
    1.43 +	}
    1.44 +
    1.45 +CRSAPKCS1v15Verifier::CRSAPKCS1v15Verifier(const CRSAPublicKey& aKey)
    1.46 +	: iPublicKey(aKey)
    1.47 +	{
    1.48 +	}
    1.49 +
    1.50 +// All these methods have been replaced by the shim
    1.51 +#ifdef _BullseyeCoverage
    1.52 +#pragma suppress_warnings on
    1.53 +#pragma BullseyeCoverage off
    1.54 +#pragma suppress_warnings off
    1.55 +#endif
    1.56 +TInt CRSAPKCS1v15Verifier::MaxInputLength(void) const
    1.57 +	{
    1.58 +	// Method replaced by shim
    1.59 +	ASSERT(EFalse);
    1.60 +	return 0;
    1.61 +	}
    1.62 +
    1.63 +TInt CRSAPKCS1v15Verifier::MaxOutputLength(void) const
    1.64 +	{
    1.65 +	// Method replaced by shim
    1.66 +	ASSERT(EFalse);
    1.67 +	return 0;
    1.68 +	}
    1.69 +
    1.70 +HBufC8* CRSAPKCS1v15Verifier::InverseSignLC(const CRSASignature& /*aSignature*/) const
    1.71 +	{
    1.72 +	// Method replaced by shim
    1.73 +	ASSERT(EFalse);
    1.74 +	return 0;
    1.75 +	}
    1.76 +
    1.77 +void CRSAPKCS1v15Verifier::ConstructL(void)
    1.78 +	{
    1.79 +	// Method replaced by shim
    1.80 +	ASSERT(EFalse);
    1.81 +	}
    1.82 +
    1.83 +// InverseSignLC is replaced by shim. So, VerifyL also can not be used properly, hence excluded from coverage.
    1.84 +EXPORT_C TBool CRSAVerifier::VerifyL(const TDesC8& aInput, const CRSASignature& aSignature) const
    1.85 +	{
    1.86 +	TBool retval = EFalse;
    1.87 +	HBufC8* inverseSign = InverseSignLC(aSignature);
    1.88 +	
    1.89 +	if (inverseSign->Compare(aInput)==0)
    1.90 +		{
    1.91 +		retval = ETrue;
    1.92 +		}
    1.93 +	CleanupStack::PopAndDestroy(inverseSign);
    1.94 +	return retval;	
    1.95 +	}