Search in sources :

Example 1 with KnownServerKey

use of org.firebirdsql.gds.ng.wire.crypt.KnownServerKey in project jaybird by FirebirdSQL.

the class WireConnection method addServerKeys.

void addServerKeys(byte[] serverKeys) throws SQLException {
    final ClumpletReader newKeys = new ClumpletReader(ClumpletReader.Kind.UnTagged, serverKeys);
    for (newKeys.rewind(); !newKeys.isEof(); newKeys.moveNext()) {
        if (newKeys.getClumpTag() == TAG_KNOWN_PLUGINS) {
            continue;
        }
        int currentTag = newKeys.getClumpTag();
        if (currentTag != TAG_KEY_TYPE) {
            throw new SQLException("Unexpected tag type: " + currentTag);
        }
        String keyType = newKeys.getString(StandardCharsets.US_ASCII);
        newKeys.moveNext();
        if (newKeys.isEof()) {
            break;
        }
        currentTag = newKeys.getClumpTag();
        if (currentTag != TAG_KEY_PLUGINS) {
            throw new SQLException("Unexpected tag type: " + currentTag);
        }
        String keyPlugins = newKeys.getString(StandardCharsets.US_ASCII);
        knownServerKeys.add(new KnownServerKey(keyType, keyPlugins));
    }
}
Also used : KnownServerKey(org.firebirdsql.gds.ng.wire.crypt.KnownServerKey) SQLException(java.sql.SQLException) ClumpletReader(org.firebirdsql.gds.ClumpletReader)

Aggregations

SQLException (java.sql.SQLException)1 ClumpletReader (org.firebirdsql.gds.ClumpletReader)1 KnownServerKey (org.firebirdsql.gds.ng.wire.crypt.KnownServerKey)1