Hi. I have a code to execute encryption via SQL prepared statement.
The code fragment is below. I am doing it right ?
public byte[] encrypt(byte[] keyBytes, byte[] data){
try {
PreparedStatement pstmt = getConn().prepareStatement("CALL
ENCRYPT('AES', ?, STRINGTOUTF8(?))");
pstmt.setBytes(1, keyBytes);
pstmt.setBytes(2, data);
ResultSet rs = pstmt.executeQuery();
return rs.getBytes(0); //What should it return ?
} catch (SQLException ex) {
Logger.getLogger(SQLManager.class.getName()).log
(Level.SEVERE, null, ex); //Logging
return null;
}
}
What does it return in the ResultSet ? Do I rs.getBytes(0); or what is
the column name I should get ?
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.