Class AbstractInitLetter

java.lang.Object
org.kopi.ebics.letter.AbstractInitLetter
All Implemented Interfaces:
InitLetter
Direct Known Subclasses:
A005Letter, E002Letter, X002Letter

public abstract class AbstractInitLetter extends Object implements InitLetter
  • Field Details

  • Constructor Details

    • AbstractInitLetter

      protected AbstractInitLetter(Locale locale)
      Constructs a new initialization letter.
      Parameters:
      locale - the application locale
  • Method Details

    • writeTo

      public void writeTo(OutputStream output) throws IOException
      Description copied from interface: InitLetter
      Saves the InitLetter to the given output stream.
      Specified by:
      writeTo in interface InitLetter
      Parameters:
      output - the output stream.
      Throws:
      IOException - Save error.
    • build

      protected void build(String hostId, String bankName, String userId, String username, String partnerId, String version, String certTitle, byte[] certificate, String hashTitle, byte[] hash) throws IOException
      Builds an initialization letter.
      Parameters:
      hostId - the host ID
      bankName - the bank name
      userId - the user ID
      username - the user name
      partnerId - the partner ID
      version - the signature version
      certTitle - the certificate title
      certificate - the certificate content
      hashTitle - the hash title
      hash - the hash value
      Throws:
      IOException
    • getString

      protected String getString(String key)
      Returns the value of the property key.
      Parameters:
      key - the property key
      Returns:
      the property value
    • getHash

      protected byte[] getHash(byte[] certificate) throws GeneralSecurityException
      Returns the SHA-256 hash of the DER-encoded certificate.
      Parameters:
      certificate - the DER-encoded certificate
      Returns:
      the certificate hash
      Throws:
      GeneralSecurityException
    • chunkedBase64

      protected static byte[] chunkedBase64(byte[] data)
      Encodes data as MIME Base64 (76-character lines separated by CRLF) with a trailing CRLF, matching the historical commons-codec Base64.encodeBase64(data, true) byte-for-byte so PEM-style blocks in the letter keep the -----END CERTIFICATE----- marker on its own line.