1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptoservices/certificateandkeymgmt/wtlscert/wtlskeys.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,63 @@
1.4 +/*
1.5 +* Copyright (c) 1997-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 +
1.23 +#include <wtlskeys.h>
1.24 +#include "wtlsdec.h"
1.25 +#include <bigint.h>
1.26 +
1.27 +EXPORT_C CWTLSRSAPublicKey* CWTLSRSAPublicKey::NewL(const TDesC8& aBinaryData)
1.28 + {
1.29 + TInt pos = 0;
1.30 + return CWTLSRSAPublicKey::NewL(aBinaryData, pos);
1.31 + }
1.32 +
1.33 +EXPORT_C CWTLSRSAPublicKey* CWTLSRSAPublicKey::NewLC(const TDesC8& aBinaryData)
1.34 + {
1.35 + TInt pos = 0;
1.36 + return CWTLSRSAPublicKey::NewLC(aBinaryData, pos);
1.37 + }
1.38 +
1.39 +EXPORT_C CWTLSRSAPublicKey* CWTLSRSAPublicKey::NewL(const TDesC8& aBinaryData, TInt& aPos)
1.40 + {
1.41 + CWTLSRSAPublicKey* self = CWTLSRSAPublicKey::NewLC(aBinaryData, aPos);
1.42 + CleanupStack::Pop();
1.43 + return self;
1.44 + }
1.45 +
1.46 +EXPORT_C CWTLSRSAPublicKey* CWTLSRSAPublicKey::NewLC(const TDesC8& aBinaryData, TInt& aPos)
1.47 + {
1.48 + CWTLSRSAPublicKey* self = new(ELeave) CWTLSRSAPublicKey;
1.49 + CleanupStack::PushL(self);
1.50 + self->ConstructL(aBinaryData, aPos);
1.51 + return self;
1.52 + }
1.53 +
1.54 +
1.55 +void CWTLSRSAPublicKey::ConstructL(const TDesC8& aBinaryData, TInt& aPos)
1.56 + {
1.57 + TWTLSDecUnsignedInteger decInt;
1.58 + TInt expLength = decInt.DecodeShortL(aBinaryData, aPos, 2);
1.59 + iE = decInt.DecodeLongL(aBinaryData, aPos, expLength);
1.60 + TInt modLength = decInt.DecodeShortL(aBinaryData, aPos, 2);
1.61 + iN = decInt.DecodeLongL(aBinaryData, aPos, modLength);
1.62 + }
1.63 +
1.64 +CWTLSRSAPublicKey::CWTLSRSAPublicKey()
1.65 +{}
1.66 +