use of org.firebirdsql.gds.ng.dbcrypt.DbCryptData in project jaybird by FirebirdSQL.
the class V13WireOperations method readCryptKeyCallback.
/**
* Reads the database encryption callback data from the connection.
*
* @return Database encryption callback data received from server
* @throws IOException
* For errors reading data from the socket
* @throws SQLException
* For database errors
*/
protected DbCryptData readCryptKeyCallback() throws IOException, SQLException {
final XdrInputStream xdrIn = getXdrIn();
// p_cc_data
final byte[] pluginData = xdrIn.readBuffer();
try {
return new DbCryptData(pluginData, Integer.MIN_VALUE);
} catch (RuntimeException e) {
throw new FbExceptionBuilder().nonTransientConnectionException(JaybirdErrorCodes.jb_dbCryptDataError).cause(e).toSQLException();
}
}
use of org.firebirdsql.gds.ng.dbcrypt.DbCryptData in project jaybird by FirebirdSQL.
the class StaticValueDbCryptCallbackTest method returnsReplyWithFixedResponseValue_null.
@Test
public void returnsReplyWithFixedResponseValue_null() {
DbCryptCallback callback = new StaticValueDbCryptCallback(null);
DbCryptData dbCryptData = callback.handleCallback(DbCryptData.EMPTY_DATA);
assertNull("pluginData", dbCryptData.getPluginData());
assertEquals("replySize", 0, dbCryptData.getReplySize());
}
use of org.firebirdsql.gds.ng.dbcrypt.DbCryptData in project jaybird by FirebirdSQL.
the class StaticValueDbCryptCallbackSpiTest method fixedResponseWithBase64urlConfig.
@Test
public void fixedResponseWithBase64urlConfig() {
final DbCryptCallback dbCryptCallback = new StaticValueDbCryptCallbackSpi().createDbCryptCallback("base64url:PDw_Pz8-Pg==");
DbCryptData dbCryptData = dbCryptCallback.handleCallback(DbCryptData.EMPTY_DATA);
assertArrayEquals("<<???>>".getBytes(StandardCharsets.US_ASCII), dbCryptData.getPluginData());
}
use of org.firebirdsql.gds.ng.dbcrypt.DbCryptData in project jaybird by FirebirdSQL.
the class StaticValueDbCryptCallbackSpiTest method fixedResponseWithNullConfig.
@Test
public void fixedResponseWithNullConfig() {
final DbCryptCallback dbCryptCallback = new StaticValueDbCryptCallbackSpi().createDbCryptCallback(null);
DbCryptData dbCryptData = dbCryptCallback.handleCallback(DbCryptData.EMPTY_DATA);
assertNull(dbCryptData.getPluginData());
}
Aggregations