First public contribution.
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
31 #include "asymmetriccipherimpl.h"
34 * Implementation of RSA encryption as described in PKCS#1 v1.5.
36 namespace SoftwareCrypto
38 using namespace CryptoSpi;
40 NONSHARABLE_CLASS(CRSAImpl) : public CAsymmetricCipherImpl
44 Creates an instance of an RSA asymmetric cipher plug-in.
46 @param aCryptoMode Whether to encrypt or decrypt
47 @param aPadding The padding scheme to use None, SSLv3, PKCS#7
48 @return A pointer to a CRSAImpl instance
50 static CRSAImpl* NewL(const CKey& aKey,
51 TUid aCryptoMode, TUid aPadding);
54 Creates an instance of an RSA asymmetric cipher plug-in.
55 A pointer to the plug-in instance is placed on the cleanup stack.
57 @param aCryptoMode Whether to encrypt or decrypt
58 @param aPadding The padding scheme to use None, SSLv3, PKCS#7
59 @return A pointer to a CRSAImpl instance
61 static CRSAImpl* NewLC(const CKey& aKey,
62 TUid aCryptoMode, TUid aPadding);
64 // Override CAsymmetricCipherImpl virtual functions
65 TUid ImplementationUid() const;
66 TBool IsValidKeyLengthL(TInt aKeyBytes) const;
67 TInt GetMaximumInputLengthL() const;
68 TInt GetMaximumOutputLengthL() const;
69 void ProcessL(const TDesC8& aInput, TDes8& aOutput);
70 // End of CAsymmetricCipherImpl
72 const CExtendedCharacteristics* GetExtendedCharacteristicsL();
73 static CExtendedCharacteristics* CreateExtendedCharacteristicsL();
81 @param aCryptoMode Whether to encrypt or decrypt
82 @param aPaddingMode The padding mode to use. None, SSL, PKCS#7
84 CRSAImpl(TUid aCryptoMode, TUid aPaddingMode);
86 /// second phase of construction
87 void ConstructL(const CKey& aKey);
89 /// for internal usage, called from ProcessL
90 void EncryptL(const TDesC8& aInput, TDes8& aOutput) const;
91 void DecryptL(const TDesC8& aInput, TDes8& aOutput) const;
96 #endif // __RSAIMPL_H__