<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
- <dependency>
- <groupId>jakarta.xml.bind</groupId>
- <artifactId>jakarta.xml.bind-api</artifactId>
- </dependency>
</dependencies>
<build>
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
-import javax.xml.bind.DatatypeConverter;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
LOG.error("Failed to encrypt data.", e);
return data;
}
- return DatatypeConverter.printBase64Binary(cryptobytes);
+ return Base64.getEncoder().encodeToString(cryptobytes);
}
@Override
LOG.warn("String {} was not decrypted.", encryptedData);
return encryptedData;
}
+
+ final byte[] cryptobytes = Base64.getDecoder().decode(encryptedData);
+ final byte[] clearbytes;
try {
- byte[] cryptobytes = DatatypeConverter.parseBase64Binary(encryptedData);
- byte[] clearbytes = decryptCipher.doFinal(cryptobytes);
- return new String(clearbytes, Charset.defaultCharset());
+ clearbytes = decryptCipher.doFinal(cryptobytes);
} catch (IllegalBlockSizeException | BadPaddingException e) {
LOG.error("Failed to decrypt encoded data", e);
+ return encryptedData;
}
- return encryptedData;
+ return new String(clearbytes, Charset.defaultCharset());
}
@Override
</dependencyManagement>
<dependencies>
- <dependency>
- <groupId>org.opendaylight.odlparent</groupId>
- <artifactId>odl-jakarta-activation-api</artifactId>
- <type>xml</type>
- <classifier>features</classifier>
- </dependency>
-
<!-- MD-SAL -->
<dependency>
<groupId>org.opendaylight.controller</groupId>
-->
<features name="odl-aaa-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0">
<feature name="odl-aaa-encryption-service" version="${project.version}">
- <feature version="[9,10)">odl-jakarta-activation-api</feature>
<feature version="[4,5)">odl-mdsal-broker</feature>
<configfile finalname="etc/opendaylight/datastore/initial/config/aaa-encrypt-service-config.xml">
mvn:org.opendaylight.aaa/aaa-encrypt-service-impl/${project.version}/xml/config