os/security/contentmgmt/cafstreamingsupport/inc/keystreamsink.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/contentmgmt/cafstreamingsupport/inc/keystreamsink.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,111 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +/**
    1.20 + @file
    1.21 + @publishedPartner
    1.22 + @released
    1.23 +*/
    1.24 +
    1.25 +#ifndef KEYSTREAMSINK_H
    1.26 +#define KEYSTREAMSINK_H
    1.27 +
    1.28 +#include <e32base.h>
    1.29 +#include <caf/streaming/keyassociation.h>
    1.30 +
    1.31 +class RWriteStream;
    1.32 +
    1.33 +namespace StreamAccess
    1.34 +	{
    1.35 +	enum TEncryptionAlgorithm
    1.36 +		{
    1.37 +		ENoEncryption = 0,
    1.38 +		EAES_128_CBC,
    1.39 +		EAES_128_CTR
    1.40 +		};
    1.41 +	
    1.42 +	enum TAuthenticationAlgorithm
    1.43 +		{
    1.44 +		ENoAuthentication = 0,
    1.45 +		EHMAC_SHA1		 
    1.46 +		};
    1.47 +	/**
    1.48 + 	Defines the key stream sink abstraction. Key stream sink is used for applying keys decrypted by the CAF streaming agent
    1.49 +	to their correct destination.
    1.50 + 
    1.51 + 	Typical implementations would be CIpSecKeyStreamSink, CSrtpKeyStreamSink etc.
    1.52 + 	*/
    1.53 +	class CKeyStreamSink : public CBase
    1.54 +		{
    1.55 +	public:
    1.56 +
    1.57 +		/**  Clone the key stream sink. Required to support copying of key stream sinks without knowing their runtime type. 
    1.58 +		*/
    1.59 +		virtual CKeyStreamSink *CloneLC() const = 0;
    1.60 +
    1.61 +		/**  Push a decrypted key association to its sink. This function should be called only by CAgentKeyStreamDecoder
    1.62 +		instances. Please note that this interface is synchronous, i.e. the function returns when the key is implemented.
    1.63 +						 
    1.64 +		@see CAgentKeyStreamDecoder
    1.65 +
    1.66 +		@param aKeyAssociation The key association extracted from the short-term key message. 
    1.67 +		@leave One of the system-wide error codes.
    1.68 +		*/
    1.69 +		virtual void ProcessNewKeyAssociationL(const CKeyAssociation& aKeyAssociation) = 0;
    1.70 +		 
    1.71 +		/**  Set the encryption algorithm. If encryption is used, the encryption algorithm must be set before processing any key associations. 
    1.72 +		Please note that changing the encryption algorithm once key associations have been processed is not supported. 
    1.73 +		 
    1.74 +		@param aEncryptionAlgorithm The encryption algorithm
    1.75 +		@leave One of the system-wide error codes.
    1.76 +		*/		 
    1.77 +		virtual void SetEncryptionAlgorithmL(const TEncryptionAlgorithm& aEncryptionAlgorithm) = 0;
    1.78 +		 
    1.79 +		/**  Set the authentication algorithm. If authentication is used, the authetication algorithm must be set before processing any key associations. 
    1.80 +		Please note that changing the authentication algorithm once key associations have been processed is not supported. 
    1.81 +		 
    1.82 +		@param aAuthenticationAlgorithm The authentication algorithm
    1.83 +		@leave One of the system-wide error codes.
    1.84 +		*/		 		 
    1.85 +		virtual void SetAuthenticationAlgorithmL(const TAuthenticationAlgorithm& aAuthenticationAlgorithm) = 0;
    1.86 +
    1.87 +		/**  Externalize the key stream sink to a buffer. Leaves the allocated buffer on the cleanup stack.
    1.88 +		 
    1.89 +		@return Pointer to the buffer
    1.90 +		@leave One of the system-wide error codes.
    1.91 +		*/		 		 
    1.92 +		IMPORT_C TPtr8 ExternalizeLC() const;
    1.93 +
    1.94 +		/**  Internalize the key stream sink from a buffer. Leaves the allocated key stream sink on the cleanup stack.
    1.95 +		
    1.96 +		@param aBuf Buffer with the externalized key stream sink
    1.97 +		@return Pointer to the key stream sink
    1.98 +		@leave One of the system-wide error codes.
    1.99 +		*/		 		 
   1.100 +		IMPORT_C static CKeyStreamSink *InternalizeLC(const TDesC8 &aBuf);
   1.101 +		 
   1.102 +		virtual ~CKeyStreamSink() {}
   1.103 +	protected:
   1.104 +		virtual void DoExternalizeL(RWriteStream &aStream) const = 0;
   1.105 +	protected:
   1.106 +		// Used for serialization
   1.107 +		enum TSinksEnum
   1.108 +			{
   1.109 +			EIpSecSinkId = 1
   1.110 +			};
   1.111 +		};
   1.112 +	} // namespace StreamAccess
   1.113 +#endif // KEYSTREAMSINK_H
   1.114 +