• API Overview
  • EBICS API
  • FinTS API
  • XS2A API
  • SEPA API
Search Results for

    Interface IFinCipherAlgorithm

    Provides the cipher algorithm to the Encrypt(Byte[], IFinCipherAlgorithm) and Decrypt(Byte[], IFinCipherAlgorithm) methods.

    Namespace: Subsembly.FinTS
    Assembly: Subsembly.FinTS.Core.dll
    Syntax
    public interface IFinCipherAlgorithm

    Methods

    Decrypt(Byte[], Byte[], Int32, Int32)

    Decrypts the entire data buffer in place.

    Declaration
    int Decrypt(byte[] vbSessionKey, byte[] vbData, int nOffset, int nLength)
    Parameters
    Type Name Description
    System.Byte[] vbSessionKey

    Session key to be used for decrypting the data. Must not be null.

    System.Byte[] vbData

    Data buffer that contains encrypted data to be decrypted. The data in this buffer will be replaced by the decrypted data. Must not be null.

    System.Int32 nOffset

    Offset of first byte in buffer to be decrypted.

    System.Int32 nLength

    Byte length of data starting at nOffset in vbData.

    Returns
    Type Description
    System.Int32

    Returns the original unpadded byte length of the decrypted data.

    Remarks

    The data buffer is assumed to contain the encrypted data including its padding. After decrypting the data, the return value provides the original unpadded byte length of the data.

    Exceptions
    Type Condition
    System.ArgumentNullException

    Either parameter was null.

    System.ArgumentOutOfRangeException

    The offset, or the length were outside the provided buffer.

    FinSecurityException

    If the aSessionKey has the wrong size or is unacceptable for other reasons, then a FinSecurityException with code BadSessionKey is thrown. Such exception probably indicates that the session key was not decrypted successfully.

    If the provided data is not of appropriate length, or the resulting decrypted data is garbage, then a FinSecurityException with code DecryptFailure is thrown. Note that the absence of such exception does not mean that the data was indeed decrypted successfully!

    Encrypt(Byte[], Byte[], Int32, Int32)

    Encrypts the entire data buffer in place.

    Declaration
    int Encrypt(byte[] vbSessionKey, byte[] vbData, int nOffset, int nLength)
    Parameters
    Type Name Description
    System.Byte[] vbSessionKey

    Session key to be used for encrypting the data. Must not be null.

    System.Byte[] vbData

    Data buffer that contains plain data to be encrypted. The data in this buffer will be replaced by the padded and encrypted data. Must not be null. The buffer must be large enough to hold the PaddedLength(Int32) of the given data length.

    System.Int32 nOffset

    Offset of first byte in buffer to be encrypted.

    System.Int32 nLength

    Unpadded byte length of data starting at nOffset in vbData.

    Returns
    Type Description
    System.Int32
    Remarks

    The provided buffer will be used beyond the given nLength in order to accomodate any padding required by the cipher algorithm. Therefore, the caller must use PaddedLength(Int32) in order to create a buffer with sufficient capacity.

    Exceptions
    Type Condition
    System.ArgumentNullException

    Either parameter was null.

    System.ArgumentOutOfRangeException

    The offset, the length or padded length were outside the provided buffer.

    FinSecurityException

    If the aSessionKey has the wrong size or is unacceptable for other reasons, then a FinSecurityException with code BadSessionKey is thrown. Such exception usually means that the caller did not provide a session key originally created by GenerateSessionKey().

    GenerateSessionKey()

    Generates a new session key suitable for subsequent encryption.

    Declaration
    byte[] GenerateSessionKey()
    Returns
    Type Description
    System.Byte[]

    The generated session key.

    PaddedLength(Int32)

    Computes the padded length of the encrypted data based on the plain data length.

    Declaration
    int PaddedLength(int nLength)
    Parameters
    Type Name Description
    System.Int32 nLength

    Plain unencrypted byte length of the data that shall be encrypted.

    Returns
    Type Description
    System.Int32

    The byte length that is required in order to hold the padded and encrypted data of the given length.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    The given nLength was negative.

    In This Article
    Back to top Copyright 2009-2025 Subsembly GmbH