org.firebirdsql.gds.ng.dbcrypt

## Class DbCryptData

- java.lang.Object
- - org.firebirdsql.gds.ng.dbcrypt.DbCryptData

-     public final class DbCryptData
      extends java.lang.Object

  Data of a database encryption key callback (or reply).
  Since:
    3.0.4
  Author:
    Mark Rotteveel

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static DbCryptData` | `EMPTY_DATA`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DbCryptData(byte[] pluginData, int replySize)` Initializes `DbCryptData` instance.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static DbCryptData` | `createReply(byte[] pluginData)` Creates a reply with plugin data and expected reply size of `0`.
    `byte[]` | `getPluginData()`
    `int` | `getReplySize()` Returns the expected reply size.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### EMPTY_DATA

          public static final DbCryptData EMPTY_DATA

  - ### Constructor Detail

    - #### DbCryptData

          public DbCryptData(byte[] pluginData,
                             int replySize)

      Initializes `DbCryptData` instance.
      Parameters:
        `pluginData` - Data for/from plugin (can be `null`)
        `replySize` - Expected reply size (normally use `0` for a reply)
      Throws:
        `java.lang.IllegalArgumentException` - when plugin data exceeds maximum length of 32767 bytes

  - ### Method Detail

    - #### getPluginData

          public byte[] getPluginData()

      Returns:
        Plugin data (can be `null`)

    - #### getReplySize

          public int getReplySize()

      Returns the expected reply size.

      For a protocol version 13 callback, the value will be `Integer.MIN_VALUE` as the protocol does not include this information.

      In the case of a callback, this value is as received from Firebird. Judging by the code in Firebird for protocol v14 and higher, this value may be negative, and should then be considered equivalent to `1`.

      Plugins can use the value as a hint to the expected size of their reply. However smaller (or larger) replies will work.

      Returns:
        Expected reply size

    - #### createReply

          public static DbCryptData createReply(byte[] pluginData)

      Creates a reply with plugin data and expected reply size of `0`.
      Parameters:
        `pluginData` - Plugin response data
      Returns:
        Crypt data

Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.