Please see my post here. You have to specify the program you are using to encrypt the file. Otherwise it’s almost impossible to help you to build a macro.
See the hints given here. You have said “I know how to attach files in KM Mail”. So, what is the specific problem?
Just an idea: Build a macro along the lines you think it should work out. Post it here for review.