If you use assign rather than set1 I think you don't need to be careful to keep the rsacdata alive because EVPFree will clean it up for you? Looks like you got it right but was there a reason you went with set1 instead?