Пример #1
0
EXPORT_C void REncryptStream::OpenL(RWriteStream& aHost,const CPBEncryptionBase& aKey)
/**
Open an encrypting write stream over aHost.
Prepares the target stream owned by the specified write stream interface object for 
writing through an encrypting filter.
@publishedPartner
@leave KErrNoMemory
@param aHost The write stream interface object for the target stream. The function does not take ownership of the target stream.
@param aKey A Password Based Encryption object for encryption handling.
*/
	{
	CPBEncryptor* encryptor = aKey.NewEncryptLC();
	iFilter.SetL(aHost.Sink(),encryptor,iFilter.EWrite);
	CleanupStack::Pop(encryptor);
	RWriteStream::Attach(&iFilter);
    }
Пример #2
0
EXPORT_C void REncryptStream::AttachLC(RWriteStream& aHost,const CPBEncryptionBase& aKey)
/**
Attach an encrypting write stream to aHost.
Takes ownership of the target stream owned by the specified write stream interface object, 
prepares the stream for writing through an encrypting filter, and puts a cleanup item onto the cleanup stack.
@publishedPartner
@leave KErrNoMemory
@param aHost The write stream interface object for the target stream
@param aKey A Password Based Encryption object for encryption handling.
*/
	{
	MStreamBuf* host=aHost.Sink();
	aHost=RWriteStream();
	RWriteStream::Attach(host);		// initial cleanup via this
	PushL();

	CPBEncryptor* encryptor = aKey.NewEncryptLC();
	iFilter.SetL(host,encryptor,iFilter.EWrite|iFilter.EAttached);
	CleanupStack::Pop(encryptor);
	
	RWriteStream::Attach(&iFilter);
	}