Move fetching of revocation data, guess size of signature
This commit is contained in:
14
sign/sign.go
14
sign/sign.go
@@ -73,6 +73,7 @@ type SignContext struct {
|
||||
ByteRangeStartByte int64
|
||||
SignatureContentsStartByte int64
|
||||
ByteRangeValues []int64
|
||||
SignatureMaxLength uint32
|
||||
}
|
||||
|
||||
func SignFile(input string, output string, sign_data SignData) error {
|
||||
@@ -143,6 +144,19 @@ func (context *SignContext) SignPDF() error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Base size for signature.
|
||||
context.SignatureMaxLength = 100000
|
||||
|
||||
// Add estimated size for TSA.
|
||||
// We can't kow actual size of TSA until after signing.
|
||||
if context.SignData.TSA.URL != "" {
|
||||
context.SignatureMaxLength += 10000
|
||||
}
|
||||
|
||||
// Fetch revocation data before adding signature placeholder.
|
||||
// Revocation data can be quite large and we need to create enough space in the placeholder.
|
||||
context.fetchRevocationData()
|
||||
|
||||
visual_signature, err := context.createVisualSignature()
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user