Search in sources :

Example 1 with DbCryptCallback

use of org.firebirdsql.gds.ng.dbcrypt.DbCryptCallback in project jaybird by FirebirdSQL.

the class StaticValueDbCryptCallbackSpiTest method fixedResponseWithBase64Config.

@Test
public void fixedResponseWithBase64Config() {
    final DbCryptCallback dbCryptCallback = new StaticValueDbCryptCallbackSpi().createDbCryptCallback("base64:ZWFzdXJlLg==");
    DbCryptData dbCryptData = dbCryptCallback.handleCallback(DbCryptData.EMPTY_DATA);
    assertArrayEquals("easure.".getBytes(StandardCharsets.US_ASCII), dbCryptData.getPluginData());
}
Also used : DbCryptData(org.firebirdsql.gds.ng.dbcrypt.DbCryptData) DbCryptCallback(org.firebirdsql.gds.ng.dbcrypt.DbCryptCallback) Test(org.junit.Test)

Example 2 with DbCryptCallback

use of org.firebirdsql.gds.ng.dbcrypt.DbCryptCallback in project jaybird by FirebirdSQL.

the class StaticValueDbCryptCallbackSpiTest method fixedResponseWithStringConfig.

@Test
public void fixedResponseWithStringConfig() {
    final String dbCryptConfig = "abc\u02a5\u0b2c\u1d38\u213b";
    final DbCryptCallback dbCryptCallback = new StaticValueDbCryptCallbackSpi().createDbCryptCallback(dbCryptConfig);
    DbCryptData dbCryptData = dbCryptCallback.handleCallback(DbCryptData.EMPTY_DATA);
    assertArrayEquals(dbCryptConfig.getBytes(StandardCharsets.UTF_8), dbCryptData.getPluginData());
}
Also used : DbCryptData(org.firebirdsql.gds.ng.dbcrypt.DbCryptData) DbCryptCallback(org.firebirdsql.gds.ng.dbcrypt.DbCryptCallback) Test(org.junit.Test)

Example 3 with DbCryptCallback

use of org.firebirdsql.gds.ng.dbcrypt.DbCryptCallback in project jaybird by FirebirdSQL.

the class StaticValueDbCryptCallbackTest method returnsReplyWithFixedResponseValue_nonNull.

@Test
public void returnsReplyWithFixedResponseValue_nonNull() {
    final byte[] responseData = { 2, 3, 4, 5, 6 };
    DbCryptCallback callback = new StaticValueDbCryptCallback(responseData);
    DbCryptData dbCryptData = callback.handleCallback(DbCryptData.EMPTY_DATA);
    assertSame("pluginData", responseData, dbCryptData.getPluginData());
    assertEquals("replySize", 0, dbCryptData.getReplySize());
}
Also used : DbCryptData(org.firebirdsql.gds.ng.dbcrypt.DbCryptData) DbCryptCallback(org.firebirdsql.gds.ng.dbcrypt.DbCryptCallback) Test(org.junit.Test)

Example 4 with DbCryptCallback

use of org.firebirdsql.gds.ng.dbcrypt.DbCryptCallback in project jaybird by FirebirdSQL.

the class V10Database method authReceiveResponse.

@Override
public final void authReceiveResponse(AcceptPacket acceptPacket) throws IOException, SQLException {
    final DbCryptCallback dbCryptCallback = connection.createDbCryptCallback();
    wireOperations.authReceiveResponse(acceptPacket, dbCryptCallback, new FbWireOperations.ProcessAttachCallback() {

        @Override
        public void processAttachResponse(GenericResponse response) {
            processAttachOrCreateResponse(response);
        }
    });
}
Also used : DbCryptCallback(org.firebirdsql.gds.ng.dbcrypt.DbCryptCallback)

Example 5 with DbCryptCallback

use of org.firebirdsql.gds.ng.dbcrypt.DbCryptCallback in project jaybird by FirebirdSQL.

the class V10Service method authReceiveResponse.

@Override
public final void authReceiveResponse(AcceptPacket acceptPacket) throws IOException, SQLException {
    final DbCryptCallback dbCryptCallback = connection.createDbCryptCallback();
    wireOperations.authReceiveResponse(acceptPacket, dbCryptCallback, new FbWireOperations.ProcessAttachCallback() {

        @Override
        public void processAttachResponse(GenericResponse response) {
            V10Service.this.processAttachResponse(response);
        }
    });
}
Also used : DbCryptCallback(org.firebirdsql.gds.ng.dbcrypt.DbCryptCallback)

Aggregations

DbCryptCallback (org.firebirdsql.gds.ng.dbcrypt.DbCryptCallback)9 DbCryptData (org.firebirdsql.gds.ng.dbcrypt.DbCryptData)6 Test (org.junit.Test)6 IOException (java.io.IOException)1 SQLException (java.sql.SQLException)1 SQLTimeoutException (java.sql.SQLTimeoutException)1 XdrInputStream (org.firebirdsql.gds.impl.wire.XdrInputStream)1 XdrOutputStream (org.firebirdsql.gds.impl.wire.XdrOutputStream)1 FbExceptionBuilder (org.firebirdsql.gds.ng.FbExceptionBuilder)1