sl@0
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
/**
|
sl@0
|
17 |
@file
|
sl@0
|
18 |
@publishedPartner
|
sl@0
|
19 |
@released
|
sl@0
|
20 |
*/
|
sl@0
|
21 |
|
sl@0
|
22 |
#ifndef KEYSTREAMSINK_H
|
sl@0
|
23 |
#define KEYSTREAMSINK_H
|
sl@0
|
24 |
|
sl@0
|
25 |
#include <e32base.h>
|
sl@0
|
26 |
#include <caf/streaming/keyassociation.h>
|
sl@0
|
27 |
|
sl@0
|
28 |
class RWriteStream;
|
sl@0
|
29 |
|
sl@0
|
30 |
namespace StreamAccess
|
sl@0
|
31 |
{
|
sl@0
|
32 |
enum TEncryptionAlgorithm
|
sl@0
|
33 |
{
|
sl@0
|
34 |
ENoEncryption = 0,
|
sl@0
|
35 |
EAES_128_CBC,
|
sl@0
|
36 |
EAES_128_CTR
|
sl@0
|
37 |
};
|
sl@0
|
38 |
|
sl@0
|
39 |
enum TAuthenticationAlgorithm
|
sl@0
|
40 |
{
|
sl@0
|
41 |
ENoAuthentication = 0,
|
sl@0
|
42 |
EHMAC_SHA1
|
sl@0
|
43 |
};
|
sl@0
|
44 |
/**
|
sl@0
|
45 |
Defines the key stream sink abstraction. Key stream sink is used for applying keys decrypted by the CAF streaming agent
|
sl@0
|
46 |
to their correct destination.
|
sl@0
|
47 |
|
sl@0
|
48 |
Typical implementations would be CIpSecKeyStreamSink, CSrtpKeyStreamSink etc.
|
sl@0
|
49 |
*/
|
sl@0
|
50 |
class CKeyStreamSink : public CBase
|
sl@0
|
51 |
{
|
sl@0
|
52 |
public:
|
sl@0
|
53 |
|
sl@0
|
54 |
/** Clone the key stream sink. Required to support copying of key stream sinks without knowing their runtime type.
|
sl@0
|
55 |
*/
|
sl@0
|
56 |
virtual CKeyStreamSink *CloneLC() const = 0;
|
sl@0
|
57 |
|
sl@0
|
58 |
/** Push a decrypted key association to its sink. This function should be called only by CAgentKeyStreamDecoder
|
sl@0
|
59 |
instances. Please note that this interface is synchronous, i.e. the function returns when the key is implemented.
|
sl@0
|
60 |
|
sl@0
|
61 |
@see CAgentKeyStreamDecoder
|
sl@0
|
62 |
|
sl@0
|
63 |
@param aKeyAssociation The key association extracted from the short-term key message.
|
sl@0
|
64 |
@leave One of the system-wide error codes.
|
sl@0
|
65 |
*/
|
sl@0
|
66 |
virtual void ProcessNewKeyAssociationL(const CKeyAssociation& aKeyAssociation) = 0;
|
sl@0
|
67 |
|
sl@0
|
68 |
/** Set the encryption algorithm. If encryption is used, the encryption algorithm must be set before processing any key associations.
|
sl@0
|
69 |
Please note that changing the encryption algorithm once key associations have been processed is not supported.
|
sl@0
|
70 |
|
sl@0
|
71 |
@param aEncryptionAlgorithm The encryption algorithm
|
sl@0
|
72 |
@leave One of the system-wide error codes.
|
sl@0
|
73 |
*/
|
sl@0
|
74 |
virtual void SetEncryptionAlgorithmL(const TEncryptionAlgorithm& aEncryptionAlgorithm) = 0;
|
sl@0
|
75 |
|
sl@0
|
76 |
/** Set the authentication algorithm. If authentication is used, the authetication algorithm must be set before processing any key associations.
|
sl@0
|
77 |
Please note that changing the authentication algorithm once key associations have been processed is not supported.
|
sl@0
|
78 |
|
sl@0
|
79 |
@param aAuthenticationAlgorithm The authentication algorithm
|
sl@0
|
80 |
@leave One of the system-wide error codes.
|
sl@0
|
81 |
*/
|
sl@0
|
82 |
virtual void SetAuthenticationAlgorithmL(const TAuthenticationAlgorithm& aAuthenticationAlgorithm) = 0;
|
sl@0
|
83 |
|
sl@0
|
84 |
/** Externalize the key stream sink to a buffer. Leaves the allocated buffer on the cleanup stack.
|
sl@0
|
85 |
|
sl@0
|
86 |
@return Pointer to the buffer
|
sl@0
|
87 |
@leave One of the system-wide error codes.
|
sl@0
|
88 |
*/
|
sl@0
|
89 |
IMPORT_C TPtr8 ExternalizeLC() const;
|
sl@0
|
90 |
|
sl@0
|
91 |
/** Internalize the key stream sink from a buffer. Leaves the allocated key stream sink on the cleanup stack.
|
sl@0
|
92 |
|
sl@0
|
93 |
@param aBuf Buffer with the externalized key stream sink
|
sl@0
|
94 |
@return Pointer to the key stream sink
|
sl@0
|
95 |
@leave One of the system-wide error codes.
|
sl@0
|
96 |
*/
|
sl@0
|
97 |
IMPORT_C static CKeyStreamSink *InternalizeLC(const TDesC8 &aBuf);
|
sl@0
|
98 |
|
sl@0
|
99 |
virtual ~CKeyStreamSink() {}
|
sl@0
|
100 |
protected:
|
sl@0
|
101 |
virtual void DoExternalizeL(RWriteStream &aStream) const = 0;
|
sl@0
|
102 |
protected:
|
sl@0
|
103 |
// Used for serialization
|
sl@0
|
104 |
enum TSinksEnum
|
sl@0
|
105 |
{
|
sl@0
|
106 |
EIpSecSinkId = 1
|
sl@0
|
107 |
};
|
sl@0
|
108 |
};
|
sl@0
|
109 |
} // namespace StreamAccess
|
sl@0
|
110 |
#endif // KEYSTREAMSINK_H
|
sl@0
|
111 |
|