I think I wrote that: shame on me :-(
My primary idea was to extract a key coded as a BITSTRING out of an ASN1 element, but the whole switch case is completely messed up.
Lines 4015-4020 should be rewritten. Thanks for pulling my attention on it.