Interface PdfSignatureProvider


public interface PdfSignatureProvider

Supplies the key material of a PDF signature without exposing the key.

PdfDocument computes what has to be signed and calls [#sign(byte[])] exactly once while saving. On a device, PdfSigner.provider answers with the platform crypto bridge. On a Codename One server, implement it over com.codename1.backend.Crypto.sign (RS256 or ES256 with the PKCS#8 key), which runs on the JVM and compiled alike; a hardware security module fits the same shape, so the private key never leaves it.

  • Method Summary

    Modifier and Type
    Method
    Description
    byte[][]
    The DER X.509 certificates: the signer's first, then any intermediates a verifier needs to build the chain.
    The key algorithm, RSA or EC.
    byte[]
    sign(byte[] data)
    Signs data with SHA-256 and the private key.
  • Method Details

    • getKeyAlgorithm

      String getKeyAlgorithm()
      The key algorithm, RSA or EC. The signature is SHA-256 with that key (SHA256withRSA or SHA256withECDSA).
    • getCertificateChain

      byte[][] getCertificateChain()
      The DER X.509 certificates: the signer's first, then any intermediates a verifier needs to build the chain.
    • sign

      byte[] sign(byte[] data) throws IOException
      Signs data with SHA-256 and the private key. ECDSA signatures are returned DER encoded (ECDSA-Sig-Value), as every Codename One port and the backend's Crypto.sign produce them.
      Throws:
      IOException - when the key cannot sign: a hardware key that is locked, a remote signing service that cannot be reached. The save that asked fails with it.