Skip to content

ChangingAlgorithms

Luís Gonçalves edited this page Feb 19, 2022 · 2 revisions

The different algorithms that are used in signature production - the signature algorithm itself, the digest algorithm for Reference elements and for properties, the canonicalization algorithm, etc. - can be configured via the SignatureAlgorithms class.

The default set of algorithms is:

  • Signature: RSA(RSA_SHA256), DSA(DSA_SHA1), EC(ECDSA_SHA256)
  • Canonicalization: Canonical XML 1.0 withouth comments
  • Digest: SHA256

To change any of those, configure a new instance of SignatureAlgorithms is the signing profile. For example, to change teh signature algorithm:

XadesSigningProfile profile = new XadesCSigningProfile(...)
    .withSignatureAlgorithms(new SignatureAlgorithms()
        .withSignatureAlgorithm("RSA", ALGO_ID_SIGNATURE_RSA_SHA512));

The Algorithm class is a representation of an algorithm, which may include parameters. The xades4j.algorithms package includes several subclasses for specific algorithms as well as a class for generic use (such as algorithms that don't take any parameter). Some of the classes on the package are also used for data object transforms.