Hi, The problem is that the order of passwords is swapped. See http://h2database.com/html/features.html#file_encryption : "filepwd userpwd", so in your case that's "a<space>" instead of "<space>a".
Regards, Thomas On Wed, Jul 16, 2014 at 4:57 PM, Thomas Förster <[email protected]> wrote: > Hi! > > In a Java programm I am importing a database from a script into an > unencrypted file. Next I want to encrypt it using the ChangeFileEncryption > class: > > > public static void main(String[] args) throws Exception { >> org.h2.Driver.load(); >> >> try (Connection conn = >> DriverManager.getConnection("jdbc:h2:D:/temp/database", "sa", ""); >> Statement stmt = conn.createStatement()) { >> stmt.execute("RUNSCRIPT FROM 'D:/temp/db.ddl'"); >> } >> >> ChangeFileEncryption.execute("D:/temp/", "database", "AES", null, >> "a".toCharArray(), true); >> >> Connection conn = >> DriverManager.getConnection("jdbc:h2:D:/temp/database;CIPHER=AES", "sa", " >> a"); >> System.out.println(conn); >> >> } >> > > This throws a "Encryption error in file "D:/TEMP/database.h2.db" > [90049-174]". What is wrong here? According to the source code of > ChangeFileEncryptionit should be possible to encrypt an unencrypted file > (setting key=null). How can I solve this problem? > > Regards > > Thomas > > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/h2-database. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
