rooted out the obvious bugs. Now the program can encrypt and decrypt correctly, using both AES 128 CBC and CTR mode. Still may have some minor defects.