new implementation using libssl