First public contribution.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
22 #ifndef KEYSTREAMSINK_H
23 #define KEYSTREAMSINK_H
26 #include <caf/streaming/keyassociation.h>
30 namespace StreamAccess
32 enum TEncryptionAlgorithm
39 enum TAuthenticationAlgorithm
41 ENoAuthentication = 0,
45 Defines the key stream sink abstraction. Key stream sink is used for applying keys decrypted by the CAF streaming agent
46 to their correct destination.
48 Typical implementations would be CIpSecKeyStreamSink, CSrtpKeyStreamSink etc.
50 class CKeyStreamSink : public CBase
54 /** Clone the key stream sink. Required to support copying of key stream sinks without knowing their runtime type.
56 virtual CKeyStreamSink *CloneLC() const = 0;
58 /** Push a decrypted key association to its sink. This function should be called only by CAgentKeyStreamDecoder
59 instances. Please note that this interface is synchronous, i.e. the function returns when the key is implemented.
61 @see CAgentKeyStreamDecoder
63 @param aKeyAssociation The key association extracted from the short-term key message.
64 @leave One of the system-wide error codes.
66 virtual void ProcessNewKeyAssociationL(const CKeyAssociation& aKeyAssociation) = 0;
68 /** Set the encryption algorithm. If encryption is used, the encryption algorithm must be set before processing any key associations.
69 Please note that changing the encryption algorithm once key associations have been processed is not supported.
71 @param aEncryptionAlgorithm The encryption algorithm
72 @leave One of the system-wide error codes.
74 virtual void SetEncryptionAlgorithmL(const TEncryptionAlgorithm& aEncryptionAlgorithm) = 0;
76 /** Set the authentication algorithm. If authentication is used, the authetication algorithm must be set before processing any key associations.
77 Please note that changing the authentication algorithm once key associations have been processed is not supported.
79 @param aAuthenticationAlgorithm The authentication algorithm
80 @leave One of the system-wide error codes.
82 virtual void SetAuthenticationAlgorithmL(const TAuthenticationAlgorithm& aAuthenticationAlgorithm) = 0;
84 /** Externalize the key stream sink to a buffer. Leaves the allocated buffer on the cleanup stack.
86 @return Pointer to the buffer
87 @leave One of the system-wide error codes.
89 IMPORT_C TPtr8 ExternalizeLC() const;
91 /** Internalize the key stream sink from a buffer. Leaves the allocated key stream sink on the cleanup stack.
93 @param aBuf Buffer with the externalized key stream sink
94 @return Pointer to the key stream sink
95 @leave One of the system-wide error codes.
97 IMPORT_C static CKeyStreamSink *InternalizeLC(const TDesC8 &aBuf);
99 virtual ~CKeyStreamSink() {}
101 virtual void DoExternalizeL(RWriteStream &aStream) const = 0;
103 // Used for serialization
109 } // namespace StreamAccess
110 #endif // KEYSTREAMSINK_H