Class CPDFSignature

java.lang.Object
com.compdfkit.core.signature.CPDFSignature

public class CPDFSignature extends Object
  • Field Details

    • lockObj

      public static Object lockObj
  • Constructor Details

  • 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

      public RectF getBounds()
      Get the rectangular area where the signature form is located.
      Returns:
      Returns rectangular area.
    • getName

      public String 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

      public String getDate()
      Get the time signing the document.
      Returns:
      Returns the time signing the document.
    • getFilter

      public String getFilter()
      Get filter of the signature.
      Returns:
      Returns filter of the signature.
    • getSubFilter

      public String getSubFilter()
      Get sub filter of the signature.
      Returns:
      Returns sub filter of the signature.
    • getLocation

      public String 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

      public boolean verify(CPDFDocument document)
      Verify whether the signature is valid.
      Parameters:
      document - The CPDFDocument
      Returns:
      true:the signature is valid, false:invalid
    • verifyDocument

      public boolean verifyDocument(CPDFDocument doc)
      Verify the document modification permissions.
      Parameters:
      doc - The CPDFDocument object of the file to be verified.
      Returns:
      Returns true:Succeed, false:Fail.
    • verifyTimestamp

      public boolean verifyTimestamp(String capath)
      Verify the timestamps on the timestamps signature.
      Parameters:
      capath - Certificate folder directory, excluding certificate name.
      Returns:
      Returns true:Succeed, false:Fail.
    • getSignerArr

      public CPDFSigner[] 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

      public int getPageIndex(CPDFDocument doc)
      Get page index of the signature.
      Parameters:
      doc - CPDFDocument object.
      Returns:
      Returns page index of the signature.
    • getFieldName

      public String getFieldName()
      Get the field name of signature form widget.
      Returns:
      Returns field name.
    • getReason

      public String 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

      public static CPDFX509 getX509ByPKCS12Cert(String p12_path, String password)
      Get certificate object.
      Parameters:
      p12_path - Certificate file path.
      password - Certificate file password.
      Returns:
      Returns CPDFX509 object.
    • removeCertFromPath

      public static boolean removeCertFromPath(String path, CPDFX509 cpdfx509)
      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

      public static boolean checkPKCS12Password(String p12Path, String password)
      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

      public CPDFDocument.PDFDocMdpP 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.