New tests for x509

Add tests for the cases that weren't covered for x509.