public void save ( final SecretKey key ) throws IOException { final File keyFile = getKeyPath ( key ) ; keyFile . getParentFile ( ) . mkdirs ( ) ; // make directories if they do not exist try ( OutputStream fos = Files . newOutputStream ( keyFile . toPath ( ) ) ; ObjectOutputStream oout = new ObjectOutputStream ( fos ) ) { oout . writeObject ( key ) ; } }
Saves a secret key .