Class DefaultCryptoHandler

java.lang.Object
com.seclore.fs.helper.crypto.DefaultCryptoHandler
All Implemented Interfaces:
com.seclore.fs.ws.client.pscp.CryptoHandler

public class DefaultCryptoHandler extends Object implements com.seclore.fs.ws.client.pscp.CryptoHandler
  • Constructor Details

    • DefaultCryptoHandler

      public DefaultCryptoHandler(String pKeyXML, int pKeyLength, String pKeyID, String pChainingMode, String pPadding) throws FSHelperException
      Creates the object of CryptoHandler. This is the default implementation for the Crypto Handler. This implementation supports RSA based Encryption, with PKCS1Padding, as a ECB chaining Mode
      Parameters:
      pKeyXML - Private key in xml. The components should be in hexadecimal format.
      pKeyLength - Length of the private Key. Example - 256
      pKeyID - A unique Id which is mapped to the public key part on Policy Server.
      pChainingMode - Chaining mode to be used for encrypt or decrypt. Example - ECB
      pPadding - Padding to be used for encrypt or decrypt. Example - PKCS1Padding
      Throws:
      FSHelperException - if values is not valid.
  • Method Details

    • encryptWithPrivateKey

      public byte[] encryptWithPrivateKey(byte[] pPlainData) throws com.seclore.fs.ws.client.exception.WSClientException
      Description copied from interface: com.seclore.fs.ws.client.pscp.CryptoHandler
      This method encrypts data using private key
      Specified by:
      encryptWithPrivateKey in interface com.seclore.fs.ws.client.pscp.CryptoHandler
      Returns:
      encrypted data
      Throws:
      com.seclore.fs.ws.client.exception.WSClientException
    • decryptWithPrivateKey

      public byte[] decryptWithPrivateKey(byte[] pCipherData) throws com.seclore.fs.ws.client.exception.WSClientException
      Description copied from interface: com.seclore.fs.ws.client.pscp.CryptoHandler
      This method decrypts data using private key
      Specified by:
      decryptWithPrivateKey in interface com.seclore.fs.ws.client.pscp.CryptoHandler
      Parameters:
      pCipherData - - The data byte array to be decrypted
      Returns:
      decrypted data
      Throws:
      com.seclore.fs.ws.client.exception.WSClientException
    • getKeyID

      public String getKeyID()
      Description copied from interface: com.seclore.fs.ws.client.pscp.CryptoHandler
      Gets the Key ID for the implemented Handler
      Specified by:
      getKeyID in interface com.seclore.fs.ws.client.pscp.CryptoHandler
      Returns:
      key id