Package org.firebirdsql.gds.ng.dbcrypt.simple

## Class StaticValueDbCryptCallbackSpi

- java.lang.Object
- - org.firebirdsql.gds.ng.dbcrypt.simple.StaticValueDbCryptCallbackSpi

- All Implemented Interfaces:
    `DbCryptCallbackSpi`

      public final class StaticValueDbCryptCallbackSpi
      extends java.lang.Object
      implements DbCryptCallbackSpi

  Provider for a static value response database encryption callback.

  This provider takes the `dbCryptConfig` value to determine the static value of the response:

  - value is `null`: empty response
  - value starts with `"base64:"`: rest of the value is decoded to bytes using base64
  - all other values are encoded to bytes using UTF-8
  Since:
    3.0.4
  Author:
    Mark Rotteveel

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `StaticValueDbCryptCallbackSpi()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `DbCryptCallback` | `createDbCryptCallback​(java.lang.String dbCryptConfig)` | Creates the database encryption callback with a configuration string.
    `java.lang.String` | `getDbCryptCallbackName()` | Name of the database encryption callback.

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

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

- - ### Constructor Detail

    - #### StaticValueDbCryptCallbackSpi

          public StaticValueDbCryptCallbackSpi()

  - ### Method Detail

    - #### getDbCryptCallbackName

          public java.lang.String getDbCryptCallbackName()

      Description copied from interface: `DbCryptCallbackSpi`
      Name of the database encryption callback.

      This name is for identification and selection purposes. As the name will be used in connection properties, we suggest to use relatively simple/short names, but make sure it is unique enough to prevent name conflicts. Consider using something like `<company-or-author>.<name>`.

      Specified by:
        `getDbCryptCallbackName` in interface `DbCryptCallbackSpi`
      Returns:
        Name for identifying this callback within Jaybird.

    - #### createDbCryptCallback

          public DbCryptCallback createDbCryptCallback​(java.lang.String dbCryptConfig)

      Description copied from interface: `DbCryptCallbackSpi`
      Creates the database encryption callback with a configuration string.

      The configuration string of the `dbCryptConfig` connection property is plugin specific, but we suggest the following conventions:

      - For binary data, use prefix `base64:` to indicate the rest of the string is base64-encoded
      - Avoid use of `&`, `;` or `:`, or 'hide' this by using base64 encoding; this is necessary to avoid existing limitations in the parsing of connection properties that are added directly to the URL (we hope to address this in the future), and to allow support for other prefixes similar to `base64:`
      Specified by:
        `createDbCryptCallback` in interface `DbCryptCallbackSpi`
      Parameters:
        `dbCryptConfig` - Configuration string from connection properties, or `null` if absent
      Returns:
        Database encryption callback