crypto/weakcryptospi/source/asymmetric/asymmetric.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 <asymmetric.h>
       
    20 #include <bigint.h>
       
    21 
       
    22 /* MCryptoSystem */
       
    23 
       
    24 EXPORT_C MCryptoSystem::MCryptoSystem(void)
       
    25 	{
       
    26 	}
       
    27 
       
    28 /* CEncryptor */
       
    29 
       
    30 EXPORT_C CEncryptor::CEncryptor(void)
       
    31 	{
       
    32 	}
       
    33 
       
    34 /* CDecryptor */
       
    35 
       
    36 EXPORT_C CDecryptor::CDecryptor(void)
       
    37 	{
       
    38 	}
       
    39 
       
    40 /* MSignatureSystem */
       
    41 
       
    42 EXPORT_C MSignatureSystem::MSignatureSystem(void)
       
    43 	{
       
    44 	}
       
    45 
       
    46 /* CRSASignature */ 
       
    47 
       
    48 EXPORT_C CRSASignature* CRSASignature::NewL(RInteger& aS)
       
    49 	{
       
    50 	CRSASignature* self = new(ELeave)CRSASignature(aS);
       
    51 	return self;
       
    52 	}
       
    53 
       
    54 EXPORT_C CRSASignature* CRSASignature::NewLC(RInteger& aS)
       
    55 	{
       
    56 	CRSASignature* self = NewL(aS);
       
    57 	CleanupStack::PushL(self);
       
    58 	return self;
       
    59 	}
       
    60 
       
    61 EXPORT_C const TInteger& CRSASignature::S(void) const
       
    62 	{
       
    63 	return iS;
       
    64 	}
       
    65 
       
    66 EXPORT_C TBool CRSASignature::operator==(const CRSASignature& aSig) const
       
    67 	{
       
    68 	return ( S() == aSig.S() );
       
    69 	}
       
    70 
       
    71 EXPORT_C CRSASignature::~CRSASignature(void)
       
    72 	{
       
    73 	iS.Close();
       
    74 	}
       
    75 
       
    76 EXPORT_C CRSASignature::CRSASignature(RInteger& aS) : iS(aS)
       
    77 	{
       
    78 	}
       
    79 
       
    80 /* CDSASignature */
       
    81 
       
    82 EXPORT_C CDSASignature* CDSASignature::NewL(RInteger& aR, RInteger& aS)
       
    83 	{
       
    84 	CDSASignature* self = new(ELeave)CDSASignature(aR, aS);
       
    85 	return self;
       
    86 	}
       
    87 
       
    88 EXPORT_C CDSASignature* CDSASignature::NewLC(RInteger& aR, RInteger& aS)
       
    89 	{
       
    90 	CDSASignature* self = NewL(aR, aS);
       
    91 	CleanupStack::PushL(self);
       
    92 	return self;
       
    93 	}
       
    94 
       
    95 EXPORT_C const TInteger& CDSASignature::R(void) const
       
    96 	{
       
    97 	return iR;
       
    98 	}
       
    99 
       
   100 EXPORT_C const TInteger& CDSASignature::S(void) const
       
   101 	{
       
   102 	return iS;
       
   103 	}
       
   104 
       
   105 EXPORT_C TBool CDSASignature::operator==(const CDSASignature& aSig) const
       
   106 	{
       
   107 	return ( R() == aSig.R() && S() == aSig.S() );
       
   108 	}
       
   109 
       
   110 EXPORT_C CDSASignature::~CDSASignature(void)
       
   111 	{
       
   112 	iR.Close();
       
   113 	iS.Close();
       
   114 	}
       
   115 
       
   116 EXPORT_C CDSASignature::CDSASignature()
       
   117 	{
       
   118 	}
       
   119 
       
   120 EXPORT_C CDSASignature::CDSASignature(RInteger& aR, RInteger& aS) 
       
   121 	: iR(aR), iS(aS)
       
   122 	{
       
   123 	}
       
   124