Search in sources :

Example 1 with NexusLdapPasswords

use of org.platformlayer.service.nexus.utils.NexusLdapPasswords in project platformlayer by platformlayer.

the class NexusBootstrap method encryptNexusPassword.

private String encryptNexusPassword(String ldapPassword) throws OpsException {
    NexusLdapPasswords nexusLdapPasswords = new NexusLdapPasswords();
    nexusLdapPasswords.addEscapeCharacters = false;
    try {
        return nexusLdapPasswords.encrypt(ldapPassword);
    } catch (Exception e) {
        ExceptionUtils.handleInterrupted(e);
        throw new OpsException("Error encrypting password", e);
    }
}
Also used : OpsException(org.platformlayer.ops.OpsException) NexusLdapPasswords(org.platformlayer.service.nexus.utils.NexusLdapPasswords) OpsException(org.platformlayer.ops.OpsException) IOException(java.io.IOException)

Example 2 with NexusLdapPasswords

use of org.platformlayer.service.nexus.utils.NexusLdapPasswords in project platformlayer by platformlayer.

the class NexusLdapPasswordsTest method testDecryption.

@Test
public void testDecryption() throws Exception {
    NexusLdapPasswords passwords = new NexusLdapPasswords();
    String plaintext = "adminsecret";
    String ciphertext = "CIj2qAUHmLHvrlRXsW9Z2dfsGm0=";
    assertStructure(ciphertext);
    String decrypted = passwords.decrypt(ciphertext);
    assertEquals(plaintext, decrypted);
}
Also used : NexusLdapPasswords(org.platformlayer.service.nexus.utils.NexusLdapPasswords) Test(org.junit.Test)

Example 3 with NexusLdapPasswords

use of org.platformlayer.service.nexus.utils.NexusLdapPasswords in project platformlayer by platformlayer.

the class NexusLdapPasswordsTest method testEncryption.

@Test
public void testEncryption() throws Exception {
    NexusLdapPasswords passwords = new NexusLdapPasswords();
    String plaintext = "adminsecret";
    String ciphertext = passwords.encrypt(plaintext);
    System.out.println("ciphertext = " + ciphertext);
    assertStructure(ciphertext);
    String decrypted = passwords.decrypt(ciphertext);
    assertEquals(plaintext, decrypted);
}
Also used : NexusLdapPasswords(org.platformlayer.service.nexus.utils.NexusLdapPasswords) Test(org.junit.Test)

Aggregations

NexusLdapPasswords (org.platformlayer.service.nexus.utils.NexusLdapPasswords)3 Test (org.junit.Test)2 IOException (java.io.IOException)1 OpsException (org.platformlayer.ops.OpsException)1