Interface SigProvider

  • All Known Implementing Classes:
    FMSigProvider

    public interface SigProvider
    SigProvider is an interface for signing and verifying XML documents
    • Method Detail

      • sign

        Element sign​(String xmlString,
                     String idValue,
                     PrivateKey privateKey,
                     X509Certificate cert)
              throws SAML2Exception
        Sign the xml document node whose identifying attribute value is as supplied, using enveloped signatures and use exclusive xml canonicalization. The resulting signature is inserted after the first child node (normally Issuer element for SAML2) of the node to be signed.
        Parameters:
        xmlString - String representing an XML document to be signed
        idValue - id attribute value of the root node to be signed
        privateKey - Signing key
        cert - Certificate which contain the public key correlated to the signing key; It if is not null, then the signature will include the certificate; Otherwise, the signature will not include any certificate
        Returns:
        Element representing the signature element
        Throws:
        SAML2Exception - if the document could not be signed
      • verify

        boolean verify​(String xmlString,
                       String idValue,
                       Set<X509Certificate> verificationCerts)
                throws SAML2Exception
        Verify the signature of the xml document.
        Parameters:
        xmlString - String representing an signed XML document.
        idValue - id attribute value of the node whose signature is to be verified.
        verificationCerts - Certificates containing the public keys which may be used for signature verification; This certificate may also may be used to check against the certificate included in the signature.
        Returns:
        true if the xml signature is verified, false otherwise.
        Throws:
        SAML2Exception - if problem occurs during verification.