move PKCS1 code over from tls lib