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.
25 #ifndef __DHKEYPAIRSHIM_H__
26 #define __DHKEYPAIRSHIM_H__
28 #include "asymmetrickeys.h"
32 * This class is capable of generating a Diffie-Hellman (DH) public/private key pair using the new crypto SPI interface.
34 NONSHARABLE_CLASS(CDHKeyPairShim) : public CDHKeyPair
38 * Creates a new DH key pair from a random large integer,
39 * and a specified large prime and generator.
41 * The returned pointer is put onto the cleanup stack.
43 * @param aN The DH parameter, n (a large prime)
44 * @param aG The DH parameter, g (the generator)
45 * @return A pointer to a CDHKeyPairShim instance
47 * @leave KErrArgument If aG is out of bounds
49 static CDHKeyPairShim* NewLC(RInteger& aN, RInteger& aG);
52 * Creates a new DH key pair from a specified
53 * large prime, generator, and random large integer.
55 * The returned pointer is put onto the cleanup stack.
57 * @param aN The DH parameter, n (a large prime)
58 * @param aG The DH parameter, g (the generator)
59 * @param ax The DH value, x (a random large integer)
60 * @return A pointer to a CDHKeyPairShim instance
62 * @leave KErrArgument If either aG or ax are out of bounds
64 static CDHKeyPairShim* NewLC(RInteger& aN, RInteger& aG, RInteger& ax);
66 /** The destructor frees all resources owned by the object, prior to its destruction. */
67 ~CDHKeyPairShim(void);
69 /** Default constructor */
75 * @param aN The DH parameter, n (a large prime)
76 * @param aG The DH parameter, g (the generator)
78 void ConstructL(RInteger& aN, RInteger& aG);
83 * @param aN The DH parameter, n (a large prime)
84 * @param aG The DH parameter, g (the generator)
85 * @param ax The DH value, x (a random large integer)
87 void ConstructL(RInteger& aN, RInteger& aG, RInteger& ax);
90 Creates the DH keypair from the given parameters
91 @param aN The DH parameter, n (a large prime)
92 @param aG The DH parameter, g (the generator)
93 @param ax The DH value, x (a random large integer)
94 @param xIncluded if the x is included or not.
96 void KeyConstructorL(RInteger& aN, RInteger& aG, RInteger& ax, TBool xIncluded);
99 CDHKeyPairShim(const CDHKeyPairShim&);
100 CDHKeyPairShim& operator=(const CDHKeyPairShim&);
103 #endif // __DHKEYPAIRSHIM_H__