java.lang.Object
se.swedenconnect.opensaml.xmlsec.signature.support.provider.padding.SCPSSPadding

public class SCPSSPadding extends Object
Implements the RSA-PSS padding algorithm in accordance with PKCS#1 v2.1.
Author:
Stefan Santesson (stefan@idsec.se), Martin Lindström (martin@idsec.se)
  • Constructor Details

    • SCPSSPadding

      public SCPSSPadding(MessageDigest messageDigest, int modulusBits)
      Constructor for the PSS padding generator. This padding generator uses the default parameter structure of RSA-PSS where message digest equals MGF hash function and where salt length equals hash length and finally where the final byte is set to 0xBC.
      Parameters:
      messageDigest - Message digest function
      modulusBits - number of modulus bits of the RSA key
  • Method Details

    • setSalt

      public void setSalt(byte[] salt)
      Inject a predefined salt value
      Parameters:
      salt - predefined salt value;
    • getPaddingFromMessage

      public byte[] getPaddingFromMessage(byte[] message)
      Generates RSA-PSS encoded message (EM) for a given message.
      Parameters:
      message - message
      Returns:
      encoded message (EM) for RSA PSS
    • getPadding

      public byte[] getPadding(byte[] messageHash) throws IllegalArgumentException
      Calculates the padding for a message hash.
      Parameters:
      messageHash - message hash
      Returns:
      encoded message (EM) for RSA PSS
      Throws:
      IllegalArgumentException - if specified modulus is to short