Skip to content
KitploitKITPLOIT
ToolsBlog
Log in
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
perl-XML-Sig — XML::Sig - A Perl toolkit to help sign and verify XML Digital Signatures. | Kitploit
Tools/GitHubGitHub/perl-net-saml2/perl-xml-sig
Defensive ToolsIdentity ManagementWeb SecurityCryptographyUtilities & FrameworksAuthentication
GitHubperl-net-saml2/perl-xml-sig

perl-XML-Sig

XML::Sig - A Perl toolkit to help sign and verify XML Digital Signatures.

View Repository
128h 27m agoNot yet reviewed
Share
Website

NAME XML::Sig - XML::Sig - A toolkit to help sign and verify XML Digital Signatures

VERSION version 0.74

SYNOPSIS my $xml = '123'; my $signer = XML::Sig->new({ key => 'path/to/private.key', });

   # create a signature
   my $signed = $signer->sign($xml);
   print "Signed XML: $signed\n";

   # verify a signature
   $signer->verify($signed)
     or die "Signature Invalid.";
   print "Signature valid.\n";

DESCRIPTION This perl module provides two primary capabilities: given an XML string, create and insert digital signatures, or if one is already present in the string verify it -- all in accordance with the W3C standard governing XML signatures.

NAME XML::Sig - A toolkit to help sign and verify XML Digital Signatures.

PREREQUISITES * Digest::SHA

*   XML::LibXML

*   MIME::Base64

*   Crypt::OpenSSL::X509

*   Crypt::OpenSSL::Bignum

*   Crypt::PK::RSA

*   Crypt::OpenSSL::DSA (>= 0.20 Optional - required for DSA signatures)

*   Crypt::PK::ECC

USAGE SUPPORTED ALGORITHMS & TRANSFORMS This module supports the following signature methods:

*   DSA

*   RSA

*   RSA encoded as x509

*   ECDSA

*   ECDSA encoded as x509

*   HMAC

This module supports the following canonicalization methods and
transforms:

*   Enveloped Signature

*   REC-xml-c14n-20010315#

*   REC-xml-c14n-20010315#WithComments

*   REC-xml-c14n11-20080502

*   REC-xml-c14n11-20080502#WithComments

*   xml-exc-c14n#

*   xml-exc-c14n#WithComments

OPTIONS Each of the following options are also accessors on the main XML::Sig object. TODO Not strictly correct rewrite

key The path to a file containing the contents of a private key. This
    option is used only when generating signatures.

cert
    The path to a file containing a PEM-formatted X509 certificate. This
    option is used only when generating signatures with the "x509"
    option. This certificate will be embedded in the signed document,
    and should match the private key used for the signature.

cert_text
    A string containing a PEM-formatted X509 certificate. This option is
    used only when generating signatures with the "x509" option. This
    certificate will be embedded in the signed document, and should
    match the private key used for the signature.

x509
    Takes a true (1) or false (0) value and indicates how you want the
    signature to be encoded. When true, the X509 certificate supplied
    will be encoded in the signature. Otherwise the native encoding
    format for RSA, DSA and ECDSA will be used.

sig_hash
    Passing sig_hash to new allows you to specify the SignatureMethod
    hashing algorithm used when signing the SignedInfo. RSA and ECDSA
    supports the hashes specified sha1, sha224, sha256, sha384 and
    sha512

    DSA supports only sha1 and sha256 (but you really should not sign
    anything with DSA anyway). This is over-ridden by the key's
    signature size which is related to the key size. 1024-bit keys
    require sha1, 2048-bit and 3072-bit keys require sha256.

digest_hash
    Passing digest_hash to new allows you to specify the DigestMethod
    hashing algorithm used when calculating the hash of the XML being
    signed. Supported hashes can be specified sha1, sha224, sha256,
    sha384, sha512, ripemd160

hmac_key
    Base64 encoded hmac_key

key_name
    The name of the key that should be referenced. In the case of xmlsec
    the --keys-file (ex. t/xmlsec-keys.xml) holds keys with a KeyName
    that is referenced by this name.

no_xml_declaration
    Some applications such as Net::SAML2 expect to sign a fragment of
    the full XML document so is this is true (1) it will not include the
    XML Declaration at the beginning of the signed XML. False (0) or
    undefined returns an XML document starting with the XML Declaration.

The following options act similar to "xmlsec --id-attr:ID
<node-namespace-uri>:<name>"

ns  A HashRef to namespaces you want to define to select the correct
    attribute ID on

id_attr
    The xpath string you want to sign your XML message on.

METHODS new(...) Constructor; see OPTIONS above.

sign($xml) When given a string of XML, it will return the same string with a signature generated from the key provided when the XML::Sig object was initialized.

This method will sign all elements in your XML with an ID (case
sensitive) attribute. Each element with an ID attribute will be the
basis for a seperate signature. It will correspond to the URI attribute
in the Reference element that will be contained by the signature. If no
ID attribute can be found on an element, the signature will not be
created.

The elements are signed in reverse order currently assuming (possibly
incorrectly) that the lower element in the tree may need to be signed
inclusive of its Signature because it is a child of the higher element.

Arguments: $xml: string XML string

Returns: string Signed XML

verify($xml) Returns true or false based upon whether the signature is valid or not.

When using XML::Sig exclusively to verify a signature, no key needs to
be specified during initialization given that the public key should be
transmitted with the signature.

XML::Sig checks all signature in the provided xml and will fail should
any signature pointing to an existing ID in the XML fail to verify.

Should there be a Signature included that does not point to an existing
node in the XML it is ignored and other Signaures are checked. If there
are no other Signatures it will return false.

Arguments: $xml: string XML string

Returns: string Signed XML

signer_cert() Following a successful verify with an X509 certificate, returns the signer's certificate as embedded in the XML document for verification against a CA certificate. The certificate is returned as a Crypt::OpenSSL::X509 object.

Arguments: none

Returns: Crypt::OpenSSL::X509: Certificate used to sign the XML

verified_ids() Following a successful verify, returns an ARRAY reference of the ID attribute values that were covered by a verified signature - that is, the Reference URIs whose digests were checked and matched.

Callers that extract a specific element from a verified document (for
example "//saml:Assertion") should confirm that the element's ID appears
in this list. Without that check the element acted on may not be the
element that was signed, which is the basis of the XML Signature
Wrapping (XSW) attack class.

    if ($sig->verify($xml)) {
        my %signed = map { $_ => 1 } @{ $sig->verified_ids };
        die "element was not signed"
            unless $signed{ $element->getAttribute('ID') };
    }

Arguments: none

Returns: ARRAY reference of ID strings. Empty after a failed verify or
before verify is called.

verified_elements() Following a successful verify, returns an ARRAY reference of the XML::LibXML::Element objects that were covered by a verified signature, in the order the signatures were processed.

This is the safer counterpart to verified_ids(): rather than
re-extracting an element from the document and checking its ID, work
directly from the elements returned here and no re-extraction step
exists to get wrong.

    if ($sig->verify($xml)) {
        for my $el (@{ $sig->verified_elements }) {
            my @attrs = $el->findnodes('.//saml:Attribute');
        }
    }
Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    905
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    881
  • 3

    wifit3

    derv82/wifit3

    Wifite but USB-only & cross-platform.

    673
  • 4

    jumpserver

    jumpserver/jumpserver

    JumpServer is an open-source Privileged Access Management (PAM) platform that provides DevOps and IT teams with on-demand and secure access to SSH, RDP, Kubernetes, Database and RemoteApp endpoints through a web browser.

    454
  • 5

    SafeLine

    chaitin/safeline

    Self-hosted WAF and reverse proxy that filters malicious HTTP traffic, blocks SQL injection, XSS, and bot attacks, with rate limiting and dynamic HTML/JS encryption.

    402
  • 6

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    397

Explore all tools

Browse our collection of tools

View all tools →