Casting away const-ness - not nice.  Does the function actually modify the data passed ?  If you're entirely sure it doesn't, perhaps we should patch the 3p library it's in so that its signature doesn't claim it modifies; otherwise, a comment here that the PEM function doesn't really modify its last param would be sensible.  (Of course, if the function's declaration actually does allow (const void*), go with that.)