com.sap.jpaas.service.securestore.password

## Interface PasswordStorage

-     public interface PasswordStorage

  This interface provides the ability to store passwords in a central storage. The passwords that are stored are related to Java KeyStore - either password of the keystore file or passwords of PrivateKey and SecretKey entries. Each password in the storage is identified by an "alias" string.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `deletePassword(String alias)` Deletes the password assigned to the given alias.
    `char[]` | `getPassword(String alias)` Returns the password associated with the given alias.
    `void` | `setPassword(String alias, char[] password)` Stores the given password assigned to the given alias.

- - ### Method Detail

    - #### setPassword

          void setPassword(String alias,
                         char[] password)
                           throws PasswordStorageException,
                                  IllegalArgumentException

      Stores the given password assigned to the given alias.
      Parameters:
        `alias` - the alias name. Alias may contain [a-zA-Z0-9], and "_" characters.
        `password` - the password to be stored assigned to the given alias. The password length should be not smaller than 6 characters and not bigger than 255 characters.
      Throws:
        `PasswordStorageException` - If there are errors while trying to set the password
        `IllegalArgumentException` - If alias or password is null. Or alias passed to the method contains unsupported characters.If password is smaller than 6 characters or bigger than 255.

    - #### getPassword

          char[] getPassword(String alias)
                             throws PasswordStorageException,
                                    IllegalArgumentException

      Returns the password associated with the given alias. The password must have been associated with the alias by call to setPassword. It is recommended to cache the obtained value, as reading of passwords is an expensive operation and involves several internal remote calls to central storage and audit infrastructure.
      Parameters:
        `alias` - the alias name. Alias may contain [a-zA-Z0-9], and "_" characters.
      Returns:
        the requested password, or null if the given alias does not exist or does not identify a password.
      Throws:
        `PasswordStorageException` - If there are errors while trying to get the password
        `IllegalArgumentException` - If alias is null. Or alias passed to the method contains unsupported characters.

    - #### deletePassword

          void deletePassword(String alias)
                              throws PasswordStorageException,
                                     IllegalArgumentException

      Deletes the password assigned to the given alias.
      Parameters:
        `alias` - the alias name. Alias may contain [a-zA-Z0-9], and "_" characters.
      Throws:
        `PasswordStorageException` - If there are errors while trying to delete the password
        `IllegalArgumentException` - If alias is null.

Copyright © 2018 SAP. All Rights Reserved.