Add FPDFSignatureObj_GetContents() API
This follows the same pattern as FPDFTextObj_GetFontName(), so the
client has to call this function twice, but allocation of the buffer
happens outside pdfium.
Change-Id: Iafc1a19dfcb81c9c7b34571ac17cc77f7d9b5da9
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/71470
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/public/fpdf_signature.h b/public/fpdf_signature.h
index df01a84..6902602 100644
--- a/public/fpdf_signature.h
+++ b/public/fpdf_signature.h
@@ -34,6 +34,25 @@
FPDF_EXPORT FPDF_SIGNATURE FPDF_CALLCONV
FPDF_GetSignatureObject(FPDF_DOCUMENT document, int index);
+// Experimental API.
+// Function: FPDFSignatureObj_GetContents
+// Get the contents of a signature object.
+// Parameters:
+// signature - Handle to the signature object. Returned by
+// FPDF_GetSignatureObject().
+// buffer - The address of a buffer that receives the contents.
+// length - The size, in bytes, of |buffer|.
+// Return value:
+// Returns the number of bytes in the contents on success, 0 on error.
+//
+// For public-key signatures, |buffer| is either a DER-encoded PKCS#1 binary or
+// a DER-encoded PKCS#7 binary. If |length| is less than the returned length, or
+// |buffer| is NULL, |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFSignatureObj_GetContents(FPDF_SIGNATURE signature,
+ void* buffer,
+ unsigned long length);
+
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus