9 #ifndef _RMS_LIB_PROTECTEDFILESTREAM_H_
10 #define _RMS_LIB_PROTECTEDFILESTREAM_H_
12 #include <CryptoAPI.h>
13 #include "UserPolicy.h"
14 #include "ModernAPIExport.h"
15 #include "CacheControl.h"
23 class ProtectedFileStream;
31 GetUserPolicyResultStatus m_status;
32 std::shared_ptr<std::string> m_referrer;
33 std::shared_ptr<ProtectedFileStream> m_stream;
36 std::shared_ptr<std::string> referrer,
37 std::shared_ptr<ProtectedFileStream> stream);
60 virtual std::shared_future<int64_t> ReadAsync(uint8_t *pbBuffer,
63 std::launch launchType)
74 virtual std::shared_future<int64_t> WriteAsync(
const uint8_t *cpbBuffer,
77 std::launch launchType)
86 virtual std::future<bool> FlushAsync(std::launch launchType)
override;
94 virtual int64_t Read(uint8_t *pbBuffer,
104 virtual int64_t Write(
const uint8_t *cpbBuffer,
114 virtual bool Flush()
override;
123 virtual rmscrypto::api::SharedStream Clone()
override;
129 virtual void Seek(uint64_t u64Position)
override;
135 virtual bool CanRead()
const override;
141 virtual bool CanWrite()
const override;
147 virtual uint64_t Position()
override;
153 virtual uint64_t Size()
override;
159 virtual void Size(uint64_t u64Value)
override;
178 static std::shared_ptr<GetProtectedFileStreamResult> Acquire(
179 rmscrypto::api::SharedStream stream,
180 const std::string & userId,
183 PolicyAcquisitionOptions options,
184 ResponseCacheFlags cacheMask
185 = static_cast<ResponseCacheFlags>(RESPONSE_CACHE_INMEMORY |
186 RESPONSE_CACHE_ONDISK |
187 RESPONSE_CACHE_ENCRYPTED));
201 static std::shared_ptr<ProtectedFileStream> Create(
202 std::shared_ptr<UserPolicy> policy,
203 rmscrypto::api::SharedStream stream,
204 const std::string & originalFileExtension);
206 std::shared_ptr<UserPolicy> Policy() {
return m_policy; }
208 std::string OriginalFileExtension() {
return m_originalFileExtension; }
213 std::shared_ptr<UserPolicy> policy,
214 const std::string & originalFileExtension);
218 std::shared_ptr<UserPolicy> policy,
219 rmscrypto::api::SharedStream stream,
220 std::shared_ptr<pfile::PfileHeader> header);
224 std::shared_ptr<UserPolicy> m_policy;
225 std::string m_originalFileExtension;
226 std::shared_ptr<IStream> m_pImpl;
231 #endif // _RMS_LIB_PROTECTEDFILESTREAM_H_
Base interface for protected streams.
Definition: IStream.h:34
Definition: AuthenticationCallbackImpl.h:16
Implement this interface to provide an approach for getting an OAuth access token.
Definition: IAuthenticationCallback.h:25
Wraps a std::iostream to provide transparent encryption and decryption on read and write...
Definition: ProtectedFileStream.h:47
The result of the ProtectedFileStream::Acquire operation.
Definition: ProtectedFileStream.h:29
Callback to be provided by library user to notify app user of actions to be taken and request their c...
Definition: IConsentCallback.h:24