I need to test a parser of PEM formatted certificates. Thus, I need to generate many variations including variations that are invalid for various reasons. Obviously I can use openssl or a library like Bouncy Castle to create valid certificates, but what about forcing errors? Can anyone point me to tools that can help?
More specifically, the kinds of errors I want to be able to generate are primarily valid PEM files that parse to the DER structure, but the DER is invalid in some way. Such as bad length values, undefined tag values, incorrect version, invalid signature, etc... Of secondary interest to me (at least right now) are corrupted PEM files and PEM files of something that isn't a DER cert.