com.microfocus.zserver.zexplorer.internal

## Class ZServerPasswordEncrypter

- java.lang.Object
- - com.microfocus.zserver.zexplorer.internal.ZServerPasswordEncrypter

-     public class ZServerPasswordEncrypter
      extends java.lang.Object

  Encrypts and decrypts strings zServer conform.

  Class exists in two projects/packages:

  - com.microfocus.zserver.communicator.internal
  - com.microfocus.zserver.zexplorer.internal
  Author:
    Micro Focus

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `CODEPAGE` Code page used for encryption.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ZServerPasswordEncrypter()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `decrypt(java.lang.String pEncrypted)` Decrypts a String that has been encrypted by `encrypt(String)` or the zServer
    `static java.lang.String` | `decrypt(java.lang.String pEncrypted, java.lang.String pCustomKey)` Decrypts an encrypted String using a custom key.
    `static java.lang.String` | `encrypt(java.lang.String pMsg)` Encrypts a String with DES (ECB).
    `static java.lang.String` | `encrypt(java.lang.String pMsg, byte[] pKey)` Encrypts a String with DES (ECB) by using the given key.

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

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

- - ### Field Detail

    - #### CODEPAGE

          public static final java.lang.String CODEPAGE

      Code page used for encryption.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ZServerPasswordEncrypter

          public ZServerPasswordEncrypter()

  - ### Method Detail

    - #### encrypt

          public static java.lang.String encrypt(java.lang.String pMsg)
                                          throws java.security.GeneralSecurityException

      Encrypts a String with DES (ECB).
      Parameters:
        `pMsg` - The message to encrypt
      Returns:
        the encrypted message in a byte array (hex)
      Throws:
        `java.security.GeneralSecurityException` - security exception with the used `Cipher`

    - #### encrypt

          public static java.lang.String encrypt(java.lang.String pMsg,
                                                 byte[] pKey)
                                          throws java.security.GeneralSecurityException

      Encrypts a String with DES (ECB) by using the given key.
      Parameters:
        `pMsg` - The message to encrypt
        `pKey` - the key used for encryption
      Returns:
        the encrypted message in a byte array (hex)
      Throws:
        `java.security.GeneralSecurityException` - security exception with the used `Cipher`

    - #### decrypt

          public static java.lang.String decrypt(java.lang.String pEncrypted)
                                          throws java.security.GeneralSecurityException

      Decrypts a String that has been encrypted by `encrypt(String)` or the zServer
      Parameters:
        `pEncrypted` - the encrypted String
      Returns:
        the decrypted String
      Throws:
        `java.security.GeneralSecurityException` - security exception with the used `Cipher`

    - #### decrypt

          public static java.lang.String decrypt(java.lang.String pEncrypted,
                                                 java.lang.String pCustomKey)
                                          throws java.security.GeneralSecurityException

      Decrypts an encrypted String using a custom key.
      Parameters:
        `pEncrypted` - the encrypted String
        `pCustomKey` - key to be used for decryption
      Returns:
        the decrypted String
      Throws:
        `java.security.GeneralSecurityException` - security exception with the used `Cipher`

Copyright © 2015 Micro Focus GmbH. All rights reserved.