org.apache.synapse.securevault

## Class BaseCipher

- java.lang.Object
- - org.apache.synapse.securevault.BaseCipher

- All Implemented Interfaces:
    DecryptionProvider, EncryptionProvider
  Direct Known Subclasses:
    AsymmetricCipher, SymmetricCipher

      public abstract class BaseCipher
      extends Object
      implements EncryptionProvider, DecryptionProvider

  Wraps the cipher and expose abstraction need for synapse ciphering

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected KeyStoreWrapper` | `keyStoreWrapper`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `BaseCipher(CipherInformation cipherInformation, Key key)`
    `protected` | `BaseCipher(CipherInformation cipherInformation, KeyStoreInformation keystoreInformation)`
    `protected` | `BaseCipher(CipherInformation cipherInformation, KeyStoreWrapper keyStoreWrapper)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `decrypt(byte[] cipherText)` Decrypts input cipher bytes
    `byte[]` | `encrypt(byte[] plainText)` Encrypts a plain text
    `CipherInformation` | `getCipherInformation()`
    `abstract Key` | `getKey(CipherOperationMode operationMode)` Returns the correct key for correct operation
    `KeyStoreInformation` | `getKeyStoreInformation()`

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

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

- - ### Field Detail

    - #### keyStoreWrapper

          protected KeyStoreWrapper keyStoreWrapper

  - ### Constructor Detail

    - #### BaseCipher

          protected BaseCipher(CipherInformation cipherInformation,
                               KeyStoreInformation keystoreInformation)

    - #### BaseCipher

          protected BaseCipher(CipherInformation cipherInformation,
                               KeyStoreWrapper keyStoreWrapper)

    - #### BaseCipher

          protected BaseCipher(CipherInformation cipherInformation,
                               Key key)

  - ### Method Detail

    - #### getCipherInformation

          public CipherInformation getCipherInformation()

    - #### getKeyStoreInformation

          public KeyStoreInformation getKeyStoreInformation()

    - #### getKey

          public abstract Key getKey(CipherOperationMode operationMode)

      Returns the correct key for correct operation
      Parameters:
        `operationMode` - Ciper operation
      Returns:
        A key

    - #### encrypt

          public byte[] encrypt(byte[] plainText)

      Description copied from interface: `EncryptionProvider`
      Encrypts a plain text
      Specified by:
        `encrypt` in interface `EncryptionProvider`
      Parameters:
        `plainText` - as a byte array
      Returns:
        cipher text as a byte array

    - #### decrypt

          public byte[] decrypt(byte[] cipherText)

      Description copied from interface: `DecryptionProvider`
      Decrypts input cipher bytes
      Specified by:
        `decrypt` in interface `DecryptionProvider`
      Parameters:
        `cipherText` - as a byte array
      Returns:
        plain text as byte array

Copyright © 2005–2020 Apache Software Foundation. All rights reserved.