Interface SignatureProviderSPI

  • All Known Implementing Classes:
    FSSignatureProvider

    public interface SignatureProviderSPI
    This is an interface to be implemented to sign and verify signature.
    • Method Detail

      • initialize

        void initialize​(KeyProvider keyProvider)
        Initializes the key provider.
        Parameters:
        keyProvider - KeyProvider object
      • signBuffer

        byte[] signBuffer​(String data,
                          String certAlias)
                   throws FSSignatureException
        Signs a string using enveloped signatures and default signature algorithm.
        Parameters:
        data - string that needs to be signed
        certAlias - Signer's certificate alias name
        Returns:
        byte array which contains signature Element object
        Throws:
        FSSignatureException - if an error occurred during the signing process
      • signBuffer

        byte[] signBuffer​(String data,
                          String certAlias,
                          String algorithm)
                   throws FSSignatureException
        Signs a string using enveloped signatures.
        Parameters:
        data - string that needs to be signed
        certAlias - Signer's certificate alias name
        algorithm - signing algorithm
        Returns:
        byte array which contains signature Element object
        Throws:
        FSSignatureException - if an error occurred during the signing process
      • verifySignature

        boolean verifySignature​(String data,
                                byte[] signature,
                                String algorithm,
                                X509Certificate cert)
                         throws FSSignatureException
        Verifies the signature of a signed string.
        Parameters:
        data - string whose signature to be verified
        signature - signature in byte array
        algorithm - signing algorithm
        cert - certificate for Signer's certificate.
        Returns:
        true if the xml signature is verified; false otherwise
        Throws:
        FSSignatureException - if problem occurs during verification
      • getKeyProvider

        KeyProvider getKeyProvider()
        Returns the key provider.
        Returns:
        KeyProvider instance