15#include <rtl/strbuf.hxx>
16#include <rtl/ustring.hxx>
18#include <com/sun/star/uno/Reference.hxx>
35#define MAX_SIGNATURE_CONTENT_LENGTH 50000
52 Signing(css::uno::Reference<css::security::XCertificate> xCertificate) :
53 m_xCertificate(
std::move(xCertificate))
65 void SetSignTSA(
const OUString& tsa) { m_aSignTSA = tsa; }
70 bool Sign(OStringBuffer& rCMSHexBuffer);
73 static bool Verify(
const std::vector<unsigned char>& aData,
74 const bool bNonDetached,
75 const std::vector<unsigned char>& aSignature,
79 static bool Verify(
SvStream& rStream,
80 const std::vector<std::pair<size_t, size_t>>& aByteRanges,
81 const bool bNonDetached,
82 const std::vector<unsigned char>& aSignature,
Helper to cryptographically sign and verify arbitrary data blocks.
void SetSignPassword(const OUString &password)
Signing(css::uno::Reference< css::security::XCertificate > xCertificate)
const css::uno::Reference< css::security::XCertificate > m_xCertificate
The certificate to use for signing.
void AddDataRange(const void *pData, sal_Int32 size)
Add a range to sign.
void SetSignTSA(const OUString &tsa)
std::vector< std::pair< const void *, sal_Int32 > > m_dataBlocks
Data blocks (pointer-size pairs).
std::unique_ptr< sal_Int32[]> pData
std::vector< unsigned char > DecodeHexString(std::string_view rHex)
Converts a hex-encoded string into a byte array.