Package com.compdfkit.core.signature
Class CPDFSignature
java.lang.Object
com.compdfkit.core.signature.CPDFSignature
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enum -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCPDFSignature(long ptr) CPDFSignature(long ptr, String fieldName, RectF bounds, String name, String date, String filter, String subFilter, String reason, String location) -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckPKCS12Password(String p12Path, String password) Check whether the password of the certificate file is correct.static booleangeneratePKCS12Cert(CPDFOwnerInfo ownerInfo, String password, String save_path, CPDFSignature.CertUsage flag, boolean is_2048) Create a pkcs12 certificate.Get the rectangular area where the signature form is located.getDate()Get the time signing the document.Get the field name of signature form widget.Get filter of the signature.Get the CPU host name or physical location of the signing.getName()The name of the person or authority signing the document.intgetPageIndex(CPDFDocument doc) Get page index of the signature.Get the permission type of the signed document.Get singature reason.longGet the signature pointer.Get all signers of the signature.Get sub filter of the signature.static CPDFX509getX509ByPKCS12Cert(String p12_path, String password) Get certificate object.booleanWhether it is a digital signature.booleanisValid()Whether the signature is valid.voidrelease()Release the signature.static booleanremoveCertFromPath(String path, CPDFX509 cpdfx509) Remove certificate from the certificate storage directory.booleanverify(CPDFDocument document) Verify whether the signature is valid.booleanVerify the document modification permissions.booleanverifyTimestamp(String capath) Verify the timestamps on the timestamps signature.
-
Field Details
-
lockObj
-
-
Constructor Details
-
CPDFSignature
-
CPDFSignature
public CPDFSignature(long ptr)
-
-
Method Details
-
isValid
public boolean isValid()Whether the signature is valid.- Returns:
- Returns true:signature is valid, false:not valid.
-
getSignaturePtr
public long getSignaturePtr()Get the signature pointer.- Returns:
- Returns the signature pointer.
-
getBounds
Get the rectangular area where the signature form is located.- Returns:
- Returns rectangular area.
-
getName
The name of the person or authority signing the document. This value should be used only when it is not possible to extract the name from the signature.- Returns:
- Returns name of the person or authority signing the document.
-
getDate
Get the time signing the document.- Returns:
- Returns the time signing the document.
-
getFilter
Get filter of the signature.- Returns:
- Returns filter of the signature.
-
getSubFilter
Get sub filter of the signature.- Returns:
- Returns sub filter of the signature.
-
getLocation
Get the CPU host name or physical location of the signing.- Returns:
- Returns the CPU host name or physical location of the signing.
-
verify
Verify whether the signature is valid.- Parameters:
document- The CPDFDocument- Returns:
- true:the signature is valid, false:invalid
-
verifyDocument
Verify the document modification permissions.- Parameters:
doc- The CPDFDocument object of the file to be verified.- Returns:
- Returns true:Succeed, false:Fail.
-
verifyTimestamp
Verify the timestamps on the timestamps signature.- Parameters:
capath- Certificate folder directory, excluding certificate name.- Returns:
- Returns true:Succeed, false:Fail.
-
getSignerArr
Get all signers of the signature. Currently you should only use the first signer.- Returns:
- Returns all signers of the signature.
-
isDigitalSigned
public boolean isDigitalSigned()Whether it is a digital signature.- Returns:
- Returns true:is digital signature, false : not.
-
getPageIndex
Get page index of the signature.- Parameters:
doc- CPDFDocument object.- Returns:
- Returns page index of the signature.
-
getFieldName
Get the field name of signature form widget.- Returns:
- Returns field name.
-
getReason
Get singature reason.- Returns:
- Returns singature reason.
-
generatePKCS12Cert
public static boolean generatePKCS12Cert(CPDFOwnerInfo ownerInfo, String password, String save_path, CPDFSignature.CertUsage flag, boolean is_2048) Create a pkcs12 certificate. C(国家);ST(省);L(地区);O(组织);OU(组织单位);CN(通用名);emailAddress(邮箱) info: "/C=cn/ST=bj/L=bj/O=hd/OU=dev/CN=hello/[email protected]"- Parameters:
ownerInfo- CPDFOwnerInfo object.password- Certificate file password.save_path- Certificate file save path.flag- The certificate use type.- Returns:
- Returns true:succeed, false:fail.
-
getX509ByPKCS12Cert
Get certificate object.- Parameters:
p12_path- Certificate file path.password- Certificate file password.- Returns:
- Returns CPDFX509 object.
-
removeCertFromPath
Remove certificate from the certificate storage directory.- Parameters:
path- Certificate storage directory.cpdfx509- Certificate to remove.- Returns:
- Returns true:succeed to remove, false:fail
-
checkPKCS12Password
Check whether the password of the certificate file is correct.- Parameters:
p12Path- The certificate file path.password- The password of the certificate file.- Returns:
- Return true:password correct, false:password wrong.
-
getPermissionType
Get the permission type of the signed document.- Returns:
- Returns : 1: No changes to the document shall be permitted; any change to the document shall invalidate the signature. 2: Permitted changes shall be filling in forms, instantiating page templates, and signing; other changes shall invalidate the signature. 3: Permitted changes shall be the same as for 2, as well as annotation creation, deletion, and modification; other changes shall invalidate the signature. Default value: 2.
-
release
public void release()Release the signature.
-