Class DigestDocument

  • All Implemented Interfaces:
    DSSDocument, Serializable

    public class DigestDocument
    extends CommonDocument
    Digest representation of a DSSDocument. It can be used to handle a large file to be signed. The computation of the digest associated to the file can be done externally.
    See Also:
    Serialized Form
    • Constructor Detail

      • DigestDocument

        public DigestDocument()
        Creates DigestDocument with an empty digest map. Initial algorithm and digest must be specified in order to use the object
      • DigestDocument

        public DigestDocument​(DigestAlgorithm digestAlgorithm,
                              String base64EncodeDigest)
        Creates DigestDocument.
        Parameters:
        digestAlgorithm - DigestAlgorithm
        base64EncodeDigest - the corresponding base 64 encoded digest value
      • DigestDocument

        public DigestDocument​(DigestAlgorithm digestAlgorithm,
                              String base64EncodeDigest,
                              String name)
        Creates DigestDocument.
        Parameters:
        digestAlgorithm - DigestAlgorithm
        base64EncodeDigest - the corresponding base 64 encoded digest value
        name - the name of the document
    • Method Detail

      • addDigest

        public void addDigest​(DigestAlgorithm digestAlgorithm,
                              String base64EncodeDigest)
        This method allows to add a pair: DigestAlgorithm and the corresponding digest value calculated externally on the encapsulated file. The digest value is base 64 encoded.
        Parameters:
        digestAlgorithm - DigestAlgorithm
        base64EncodeDigest - the corresponding base 64 encoded digest value
      • getDigest

        public String getDigest​(DigestAlgorithm digestAlgorithm)
        Description copied from interface: DSSDocument
        This method returns the encoded digest value of the current DSSDocument using the base64 algorithm.
        Specified by:
        getDigest in interface DSSDocument
        Overrides:
        getDigest in class CommonDocument
        Parameters:
        digestAlgorithm - DigestAlgorithm
        Returns:
        base64 encoded String
      • getExistingDigest

        public Digest getExistingDigest()
      • openStream

        public InputStream openStream()
        Description copied from interface: DSSDocument
        Opens a InputStream on the DSSDocument contents. The type of the InputStream depends on the type of the DSSDocument.
        Returns:
        an InputStream