All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.nemerosa.ontrack.model.security.EncryptionService Maven / Gradle / Ivy

There is a newer version: 4.4.5
Show newest version
package net.nemerosa.ontrack.model.security;

/**
 * Service to decrypt and encrypt secrets.
 */
public interface EncryptionService {

    /**
     * Encrypts a secret, given in its plain form, and returns a string suitable for secure storage.
     *
     * @param plain Secret to encode
     * @return Encrypted secret
     */
    String encrypt(String plain);

    /**
     * Decrypts a secret into a plain form from its encrypted version.
     *
     * @param crypted Encrypted secret
     * @return Plain secret
     */
    String decrypt(String crypted);

    /**
     * Gets the encryption key.
     *
     * @return Key encoded as Base64
     * @throws EncryptionException If the key cannot be exported
     */
    String exportKey();

    /**
     * Imports the encryption key.
     *
     * @param key Key encoded as Base64
     * @throws EncryptionException If the key cannot be imported
     */
    void importKey(String key);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy