Class FMSigProvider

  • All Implemented Interfaces:
    SigProvider

    public final class FMSigProvider
    extends Object
    implements SigProvider
    FMSigProvider is an class for signing and verifying XML documents, it implements SigProvider
    • Constructor Detail

      • FMSigProvider

        public FMSigProvider()
        Default Constructor
    • Method Detail

      • sign

        public 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.
        Specified by:
        sign in interface SigProvider
        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

        public boolean verify​(String xmlString,
                              String idValue,
                              Set<X509Certificate> verificationCerts)
                       throws SAML2Exception
        Description copied from interface: SigProvider
        Verify the signature of the xml document.
        Specified by:
        verify in interface SigProvider
        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.