Random number generator secure seeding
- Last Updated: May 23, 2024
- 2 minute read
- DataDirect Connectors
- JDBC
- Documentation
Db2 uses a random number generator for secure seeding of data encrypted with
the Advanced Encryption Standard (AES) algorithm. If you have enabled AES encryption
with the AuthenticationMethod connection property, you should consider how best to
implement secure seeding in your environment. The driver supports random number
generator implementations by way of the RandomGenerator and SecureRandomAlgorithm
connection properties. The RandomGenerator connection property allows you to specify
the type of random number generator the database uses for secure seeding. If you
select a cryptographically strong number generation algorithm, you can then use the
SecureRandomAlgorithm connection property to specify any number generation algorithm
included in the JDK packaged with your system.
Note: When establishing
a connection with a connection string, RandomGenerator and SecureRandomAlgorithm
should precede the User and Password connection properties in the connection
URL. When using a data source connection, RandomGenerator and
SecureRandomAlgorithm should be set before making calls to
setUser(), setPassword(), or setNewPassword().The following steps outline how to configure a random number generator for secure seeding.
The following examples show the connection information required to connect to a Db2 for Linux, UNIX, and Windows database using user ID/password authentication and AES encryption.
Connection URL
Connection conn = DriverManager.getConnection
("jdbc:datadirect:db2://myserver:50000;DatabaseName=payroll;
AuthenticationMethod=encryptedUIDPasswordAES;RandomGenerator=random;
SecureRandomAlgorithm=SHA1PRNG;User=test;Password=secret);
Data Source
Db2DataSource mds = new Db2DataSource();
mds.setDescription("My Db2 Data Source");
mds.setServerName("myserver");
mds.setPortNumber("50000");
mds.setDatabaseName("payroll");
mds.setAuthenticationMethod("encryptedUIDPasswordAES");
mds.setRandomGenerator("random");
mds.setSecureRandomAlgorithm("SHA1PRNG");
mds.setUser("jsmith");
mds.setPassword("secret");
Note: The User and Password properties are not
required to be stored in the connection string. They can also be passed separately
by the application.