Actual shortcomings are:
pseudo-device vnd 4
The good news is that this exact line is included in the configuration file for GENERIC, the default OpenBSD kernel, so you may well be able to move forward here without having to stop and rebuild your kernel.
The tool used to configure these encrypted virtual filesystems is vnconfig(8). Other than reading the man page/s (of course), the only real trick is that you have to use the svnd ("safe" vnd) devices introduced in OpenBSD 2.1 rather than the regular vnd devices. The main difference between the two is that access via svnd devices goes through the buffercache while access via vnd devices bypasses it. And since cache-coherency is needed for disk[-like] access, the svnd variety must be used here.
When using a file as a disk, the file needs to be of static size. One way to create a file of a specific size is to use the dd(1) command to put as many empty bytes into it as required in order to reach the desired size. Using 1024 byte blocks for simplicity, here is an example.
# dd if=/dev/zero of=/lame/secrets/cryptfile \
bs=1024 count=51200
This command will create an empty (or, more precisely, a sparse) 50 Meg file called cryptfile in the /lame/secrets directory. Since a mount point will be needed in order to use it like a disk, we should go ahead and make this as well, something like so ...
# mkdir /lame/secrets/cryptmnt
Now, the vnconfig command is used to associate the file, cryptfile with an svnd device like so ...
# /usr/sbin/vnconfig -ck \
-v /dev/svnd0c /lame/secrets/cryptfile
This command will prompt for a password to be given to this encrypted virtual filesystem. Enter something good.
Now, the disklabel(8) command can be used to partition this file up as desired (just as if it were a real disk) or, if it's full size will be used as a single filesystem (the usual case for such a file), you may as well not bother with disklabel since it's full size will be available as partition c by default anyway.
Now, the newfs(8) command must be used to make filesystems on any partitions that will be used since they will need filesystems on them (again, just like a real disk) in order to be used as virtual filesystems.
Once the foregoing is done, the partition/s of the cryptfile virtual disk can be mounted for use like any normal filesystem. The password will have to be provided, of course, upon each mount attempt in order to successfully make the mount. And upon unmounting, all that will be left for prying eyes is the encrypted file, cryptfile. :-)
Now, for the sake of simplicity, let's assume we left all the space in file, cryptfile, in the one big partition, c, which can now be mounted like so ...
# /sbin/mount /dev/svnd0c /lame/secrets/cryptmnt
That's all there is to it. Now you can just cd to /lame/secrets/cryptmnt and write whatever top secret manifestos you have in mind there. When done, simply unmount the file and unconfigure the previously configured cryptfile<-->svnd association for it as follows...
# /sbin/umount /lame/secrets/cryptmnt # /usr/sbin/vnconfig -u -v /dev/svnd0c
Good Luck,
-- Kyle Amon
BackWatcher, Inc.
Information Security Solutions
http://www.backwatcher.com/
813-655-8056
support@backwatcher.com