Software


Apps


API/SDK


package com.papsign;

import java.awt.image.BufferedImage;
import java.util.Map;

public class Client {

  /**
   * @param content the user data, usually the information you wish to protect, Objects must be strings, can be byte[] for future uses
   * @param keyPair user generated keypair, must be >= 1024 and <= 3072, only 2048+ is ANSSI and NIST compliant, we provide smaller sizes for convenience, use 'com.papsign.KeyPair.generate(size);'
   * @param certificate Certificate optained from the API api.papsign.com
   * @return A buffered image of the DataMatrix
   */
  public static BufferedImage encode(Map<String, Object> content, KeyPair keyPair, byte[] certificate) {
    return Signature.encode(
      content,
      certificate,
      keyPair.getPrivate(), // Private key complementary to the public one of the certificate
      BufferedImage.class // can be byte[], android.graphics.Bitmap, java.awt.image.BufferedImage
    );
  }

  /**
   * @param img Buffered image result from encode, included decoder is extremely primitive, contact us for a better one.
   * @return The decoded signature, including Identity and data
   */
  public static Signature decode(BufferedImage img) {
    return Signature.decode(img);
  }
  /**
   * @param data Decoded Datamatrix data, can contain \0 so don't use string only datamatrix readers, contact us if you need a decoder.
   * @return The decoded signature, including Identity and data
   */
  public static Signature decode(byte[] data) {
    return Signature.decode(data);
  }
}