Skip to content

Commit f87dfc0

Browse files
authored
Merge pull request #162 from ApryseSDK/pre_release
Updates master to Apryse SDK 11.5.
2 parents 9729c45 + 481df6c commit f87dfc0

28 files changed

+302
-226
lines changed

PDFNetPHP/PDFNetPHP.i

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@
3939
}
4040
}
4141

42+
/**
43+
* Fix ambiguous overloaded methods
44+
*/
45+
%ignore pdftron::Crypto::ObjectIdentifier::ObjectIdentifier(const DigestAlgorithm::Type);
46+
%ignore pdftron::Crypto::AlgorithmIdentifier::AlgorithmIdentifier(const DigestAlgorithm::Type);
47+
%ignore pdftron::Crypto::AlgorithmIdentifier::AlgorithmIdentifier(const ObjectIdentifier::Predefined, const AlgorithmParams&);
48+
4249
/**
4350
* Text enclosed in the following %{...%} block is not processed by the SWIG preprocessor
4451
* They are copied directly to the .c/.cxx file generated.
@@ -1168,3 +1175,11 @@ namespace pdftron {
11681175
//#define Redaction Redaction
11691176
%include "PDF/Redactor.h"
11701177
//#undef Redaction
1178+
1179+
// Create a static methods for ambiguous overloaded constructors
1180+
%extend pdftron::Crypto::ObjectIdentifier {
1181+
public:
1182+
static pdftron::Crypto::ObjectIdentifier* CreateFromDigestAlgorithm(const DigestAlgorithm::Type in_digest_algorithm) {
1183+
return new pdftron::Crypto::ObjectIdentifier(in_digest_algorithm);
1184+
}
1185+
}

PDFNetPython/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ endif ()
4747
message(STATUS "-- ${DOXYGEN}")
4848

4949
execute_process(
50-
COMMAND ${SWIG_EXECUTABLE} -c++ -python ${DOXYGEN} ${SWIG_DEFINE} -DSWIGHIDDEN_SIG -I${PDFNetC_Include_Dir} -outdir ${PDFNetPython_SourcesDir} -o ${PDFNetPython_SourcesDir}/PDFNetPython.cpp -oh ${PDFNetPython_SourcesDir}/PDFNetPython.hpp PDFNetPython.i
50+
COMMAND ${SWIG_EXECUTABLE} -c++ -python ${DOXYGEN} ${SWIG_DEFINE} -DPy_LIMITED_API=0x03040000 -DSWIGHIDDEN_SIG -I${PDFNetC_Include_Dir} -outdir ${PDFNetPython_SourcesDir} -o ${PDFNetPython_SourcesDir}/PDFNetPython.cpp -oh ${PDFNetPython_SourcesDir}/PDFNetPython.hpp PDFNetPython.i
5151
RESULT_VARIABLE SOURCE_GEN_RESULT
5252
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
5353
)

PDFNetPython/PDFNetPython.i

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@
4141

4242
}
4343

44+
/**
45+
* Fix ambiguous overloaded methods.
46+
*/
47+
%ignore pdftron::Crypto::ObjectIdentifier::ObjectIdentifier(const DigestAlgorithm::Type);
48+
%ignore pdftron::Crypto::AlgorithmIdentifier::AlgorithmIdentifier(const DigestAlgorithm::Type);
49+
%ignore pdftron::Crypto::AlgorithmIdentifier::AlgorithmIdentifier(const ObjectIdentifier::Predefined, const AlgorithmParams&);
50+
4451
/**
4552
* Text enclosed in the following %{...%} block is not processed by the SWIG preprocessor
4653
* They are copied directly to the .c/.cxx file generated.
@@ -1008,3 +1015,10 @@ namespace pdftron {
10081015
%include "PDF/Redactor.h"
10091016
//#undef Redaction
10101017

1018+
// Create a static methods for ambiguous overloaded constructors
1019+
%extend pdftron::Crypto::ObjectIdentifier {
1020+
public:
1021+
static pdftron::Crypto::ObjectIdentifier* CreateFromDigestAlgorithm(const DigestAlgorithm::Type in_digest_algorithm) {
1022+
return new pdftron::Crypto::ObjectIdentifier(in_digest_algorithm);
1023+
}
1024+
}

PDFNetRuby/PDFNetRuby.i

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@
3232
}
3333
}
3434

35+
/**
36+
* Fix ambiguous overloaded methods
37+
*/
38+
%ignore pdftron::Crypto::ObjectIdentifier::ObjectIdentifier(const DigestAlgorithm::Type);
39+
%ignore pdftron::Crypto::AlgorithmIdentifier::AlgorithmIdentifier(const DigestAlgorithm::Type);
40+
%ignore pdftron::Crypto::AlgorithmIdentifier::AlgorithmIdentifier(const ObjectIdentifier::Predefined, const AlgorithmParams&);
41+
3542
/**
3643
* Text enclosed in the following %{...%} block is not processed by the SWIG preprocessor
3744
* They are copied directly to the .c/.cxx file generated.
@@ -931,3 +938,10 @@ namespace pdftron {
931938
%include "PDF/TextSearch.h"
932939
%include "PDF/Redactor.h"
933940

941+
// Create a static methods for ambiguous overloaded constructors
942+
%extend pdftron::Crypto::ObjectIdentifier {
943+
public:
944+
static pdftron::Crypto::ObjectIdentifier* CreateFromDigestAlgorithm(const DigestAlgorithm::Type in_digest_algorithm) {
945+
return new pdftron::Crypto::ObjectIdentifier(in_digest_algorithm);
946+
}
947+
}

Samples/DigitalSignaturesTest/GO/DigitalSignatures_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ func TestDigitalSignatures(t *testing.T){
604604
//////////////////////////////////////// TEST 1: certify a PDF.
605605
CertifyPDF(inputPath + "waiver_withApprovalField.pdf",
606606
"PDFTronCertificationSig",
607-
inputPath + "pdftron.pfx",
607+
inputPath + "apryse.pfx",
608608
"password",
609609
inputPath + "pdftron.bmp",
610610
outputPath + "waiver_withApprovalField_certified_output.pdf")
@@ -613,7 +613,7 @@ func TestDigitalSignatures(t *testing.T){
613613
//////////////////////////////////////// TEST 2: approval-sign an existing, unsigned signature field in a PDF that already has a certified signature field.
614614
SignPDF(inputPath + "waiver_withApprovalField_certified.pdf",
615615
"PDFTronApprovalSig",
616-
inputPath + "pdftron.pfx",
616+
inputPath + "apryse.pfx",
617617
"password",
618618
inputPath + "signature.jpg",
619619
outputPath + "waiver_withApprovalField_certified_approved_output.pdf")
@@ -626,12 +626,12 @@ func TestDigitalSignatures(t *testing.T){
626626
PrintSignaturesInfo(outputPath + "waiver_withApprovalField_certified_approved_certcleared_output.pdf")
627627

628628
//////////////////////////////////////// TEST 4: Verify a document's digital signatures.
629-
if !VerifyAllAndPrint(inputPath + "waiver_withApprovalField_certified_approved.pdf", inputPath + "pdftron.cer"){
629+
if !VerifyAllAndPrint(inputPath + "waiver_withApprovalField_certified_approved.pdf", inputPath + "apryse.cer"){
630630
result = false
631631
}
632632

633633
//////////////////////////////////////// TEST 5: Verify a document's digital signatures in a simple fashion using the document API.
634-
if !VerifySimple(inputPath + "waiver_withApprovalField_certified_approved.pdf", inputPath + "pdftron.cer"){
634+
if !VerifySimple(inputPath + "waiver_withApprovalField_certified_approved.pdf", inputPath + "apryse.cer"){
635635
result = false
636636
}
637637

@@ -643,9 +643,9 @@ func TestDigitalSignatures(t *testing.T){
643643
// to system keystores, etc.
644644
CustomSigningAPI(inputPath + "waiver.pdf",
645645
"PDFTronApprovalSig",
646-
inputPath + "pdftron.pfx",
646+
inputPath + "apryse.pfx",
647647
"password",
648-
inputPath + "pdftron.cer",
648+
inputPath + "apryse.cer",
649649
inputPath + "signature.jpg",
650650
DigestAlgorithmE_SHA256,
651651
true,

Samples/DigitalSignaturesTest/PHP/DigitalSignaturesTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ function CustomSigningAPI($doc_path,
564564

565565
// Then, create ObjectIdentifiers for the algorithms you have used.
566566
// Here we use digest_algorithm_type (SHA256) for hashing, and RSAES-PKCS1-v1_5 (specified in the private key) for signing.
567-
$digest_algorithm_oid = new ObjectIdentifier(ObjectIdentifier::e_SHA256);
567+
$digest_algorithm_oid = ObjectIdentifier::CreateFromDigestAlgorithm($digest_algorithm_type);
568568
$signature_algorithm_oid = new ObjectIdentifier(ObjectIdentifier::e_RSA_encryption_PKCS1);
569569

570570
// Then, put the CMS signature components together.
@@ -680,7 +680,7 @@ function main()
680680
{
681681
CertifyPDF($input_path.'waiver_withApprovalField.pdf',
682682
'PDFTronCertificationSig',
683-
$input_path.'pdftron.pfx',
683+
$input_path.'apryse.pfx',
684684
'password',
685685
$input_path.'pdftron.bmp',
686686
$output_path.'waiver_withApprovalField_certified_output.pdf');
@@ -697,7 +697,7 @@ function main()
697697
{
698698
SignPDF($input_path.'waiver_withApprovalField_certified.pdf',
699699
'PDFTronApprovalSig',
700-
$input_path.'pdftron.pfx',
700+
$input_path.'apryse.pfx',
701701
'password',
702702
$input_path.'signature.jpg',
703703
$output_path.'waiver_withApprovalField_certified_approved_output.pdf');
@@ -726,7 +726,7 @@ function main()
726726
//////////////////// TEST 4: Verify a document's digital signatures.
727727
try
728728
{
729-
if (!VerifyAllAndPrint($input_path.'waiver_withApprovalField_certified_approved.pdf', $input_path.'pdftron.cer'))
729+
if (!VerifyAllAndPrint($input_path.'waiver_withApprovalField_certified_approved.pdf', $input_path.'apryse.cer'))
730730
{
731731
$result = false;
732732
}
@@ -740,7 +740,7 @@ function main()
740740
//////////////////// TEST 5: Verify a document's digital signatures in a simple fashion using the document API.
741741
try
742742
{
743-
if (!VerifySimple($input_path.'waiver_withApprovalField_certified_approved.pdf', $input_path.'pdftron.cer'))
743+
if (!VerifySimple($input_path.'waiver_withApprovalField_certified_approved.pdf', $input_path.'apryse.cer'))
744744
{
745745
$result = false;
746746
}
@@ -762,9 +762,9 @@ function main()
762762
{
763763
CustomSigningAPI($input_path.'waiver.pdf',
764764
'PDFTronApprovalSig',
765-
$input_path.'pdftron.pfx',
765+
$input_path.'apryse.pfx',
766766
'password',
767-
$input_path.'pdftron.cer',
767+
$input_path.'apryse.cer',
768768
$input_path.'signature.jpg',
769769
DigestAlgorithm::e_SHA256,
770770
true,

Samples/DigitalSignaturesTest/PYTHON/DigitalSignaturesTest.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ def CustomSigningAPI(doc_path,
467467

468468
# Then, create ObjectIdentifiers for the algorithms you have used.
469469
# Here we use digest_algorithm_type (SHA256) for hashing, and RSAES-PKCS1-v1_5 (specified in the private key) for signing.
470-
digest_algorithm_oid = ObjectIdentifier(ObjectIdentifier.e_SHA256)
470+
digest_algorithm_oid = ObjectIdentifier.CreateFromDigestAlgorithm(digest_algorithm_type)
471471
signature_algorithm_oid = ObjectIdentifier(ObjectIdentifier.e_RSA_encryption_PKCS1)
472472

473473
# Then, put the CMS signature components together.
@@ -568,7 +568,7 @@ def main():
568568
try:
569569
CertifyPDF(input_path + 'waiver_withApprovalField.pdf',
570570
'PDFTronCertificationSig',
571-
input_path + 'pdftron.pfx',
571+
input_path + 'apryse.pfx',
572572
'password',
573573
input_path + 'pdftron.bmp',
574574
output_path + 'waiver_withApprovalField_certified_output.pdf')
@@ -580,7 +580,7 @@ def main():
580580
try:
581581
SignPDF(input_path + 'waiver_withApprovalField_certified.pdf',
582582
'PDFTronApprovalSig',
583-
input_path + 'pdftron.pfx',
583+
input_path + 'apryse.pfx',
584584
'password',
585585
input_path + 'signature.jpg',
586586
output_path + 'waiver_withApprovalField_certified_approved_output.pdf')
@@ -600,15 +600,15 @@ def main():
600600

601601
#################### TEST 4: Verify a document's digital signatures.
602602
try:
603-
if not VerifyAllAndPrint(input_path + "waiver_withApprovalField_certified_approved.pdf", input_path + "pdftron.cer"):
603+
if not VerifyAllAndPrint(input_path + "waiver_withApprovalField_certified_approved.pdf", input_path + "apryse.cer"):
604604
result = False
605605
except Exception as e:
606606
print(e.args)
607607
result = False
608608

609609
#################### TEST 5: Verify a document's digital signatures in a simple fashion using the document API.
610610
try:
611-
if not VerifySimple(input_path + 'waiver_withApprovalField_certified_approved.pdf', input_path + 'pdftron.cer'):
611+
if not VerifySimple(input_path + 'waiver_withApprovalField_certified_approved.pdf', input_path + 'apryse.cer'):
612612
result = False
613613
except Exception as e:
614614
print(e.args)
@@ -623,9 +623,9 @@ def main():
623623
try:
624624
CustomSigningAPI(input_path + "waiver.pdf",
625625
"PDFTronApprovalSig",
626-
input_path + "pdftron.pfx",
626+
input_path + "apryse.pfx",
627627
"password",
628-
input_path + "pdftron.cer",
628+
input_path + "apryse.cer",
629629
input_path + "signature.jpg",
630630
DigestAlgorithm.e_SHA256,
631631
True,

Samples/DigitalSignaturesTest/RUBY/DigitalSignaturesTest.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def CustomSigningAPI(doc_path,
503503

504504
# Then, create ObjectIdentifiers for the algorithms you have used.
505505
# Here we use digest_algorithm_type (SHA256) for hashing, and RSAES-PKCS1-v1_5 (specified in the private key) for signing.
506-
digest_algorithm_oid = ObjectIdentifier.new(ObjectIdentifier::E_SHA256);
506+
digest_algorithm_oid = ObjectIdentifier.CreateFromDigestAlgorithm(digest_algorithm_type);
507507
signature_algorithm_oid = ObjectIdentifier.new(ObjectIdentifier::E_RSA_encryption_PKCS1);
508508

509509
# Then, put the CMS signature components together.
@@ -611,7 +611,7 @@ def main()
611611
begin
612612
CertifyPDF(input_path + 'waiver_withApprovalField.pdf',
613613
'PDFTronCertificationSig',
614-
input_path + 'pdftron.pfx',
614+
input_path + 'apryse.pfx',
615615
'password',
616616
input_path + 'pdftron.bmp',
617617
output_path + 'waiver_withApprovalField_certified_output.pdf');
@@ -625,7 +625,7 @@ def main()
625625
begin
626626
SignPDF(input_path + 'waiver_withApprovalField_certified.pdf',
627627
'PDFTronApprovalSig',
628-
input_path + 'pdftron.pfx',
628+
input_path + 'apryse.pfx',
629629
'password',
630630
input_path + 'signature.jpg',
631631
output_path + 'waiver_withApprovalField_certified_approved_output.pdf');
@@ -650,7 +650,7 @@ def main()
650650

651651
#################### TEST 4: Verify a document's digital signatures.
652652
begin
653-
if !VerifyAllAndPrint(input_path + "waiver_withApprovalField_certified_approved.pdf", input_path + "pdftron.cer")
653+
if !VerifyAllAndPrint(input_path + "waiver_withApprovalField_certified_approved.pdf", input_path + "apryse.cer")
654654
return false;
655655
end
656656
rescue Exception => e
@@ -660,7 +660,7 @@ def main()
660660

661661
#################### TEST 5: Verify a document's digital signatures in a simple fashion using the document API.
662662
begin
663-
if !VerifySimple(input_path + 'waiver_withApprovalField_certified_approved.pdf', input_path + 'pdftron.cer')
663+
if !VerifySimple(input_path + 'waiver_withApprovalField_certified_approved.pdf', input_path + 'apryse.cer')
664664
result = false;
665665
end
666666
rescue Exception => e
@@ -677,9 +677,9 @@ def main()
677677
begin
678678
CustomSigningAPI(input_path + "waiver.pdf",
679679
"PDFTronApprovalSig",
680-
input_path + "pdftron.pfx",
680+
input_path + "apryse.pfx",
681681
"password",
682-
input_path + "pdftron.cer",
682+
input_path + "apryse.cer",
683683
input_path + "signature.jpg",
684684
DigestAlgorithm::E_SHA256,
685685
true,

Samples/ImageExtractTest/GO/ImageExtract_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ func TestImageExtract(t *testing.T){
122122
// Process only images
123123
itr := obj.Find("Type")
124124

125-
if (!itr.HasNext()) || (itr.Value().GetName() != "XObject"){
125+
if (!itr.HasCurrent()) || (itr.Value().GetName() != "XObject"){
126126
i = i + 1
127127
continue
128128
}
129129
itr = obj.Find("Subtype")
130-
if (!itr.HasNext()) || (itr.Value().GetName() != "Image"){
130+
if (!itr.HasCurrent()) || (itr.Value().GetName() != "Image"){
131131
i = i + 1
132132
continue
133133
}

Samples/ImageExtractTest/PHP/ImageExtractTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ function ImageExtract($reader)
110110
{
111111
// Process only images
112112
$itr = $obj->Find("Type");
113-
if(!$itr->HasNext() || !($itr->Value()->GetName() == "XObject"))
113+
if(!$itr->HasCurrent() || !($itr->Value()->GetName() == "XObject"))
114114
{
115115
continue;
116116
}
117117

118118
$itr = $obj->Find("Subtype");
119-
if(!$itr->HasNext() || !($itr->Value()->GetName() == "Image"))
119+
if(!$itr->HasCurrent() || !($itr->Value()->GetName() == "Image"))
120120
{
121121
continue;
122122
}

0 commit comments

Comments
 (0)