NativeCrypto: throw exception on invalid DNS altname

When we receive an invalid DNS alt name (e.g., contains characters
outside of the ASCII printable range), we should throw an exception to
match the previous behavior. This is not validated this against the RI
since the tests currently don't work, but it brings the behavior back to
what it was previously.

Also amend the previous ASN.1 string check to use
ASN1_PRINTABLE_type(...) which actually scans the string to check its
contents. This is what was meant in the last patch.

Bug: 8398461
Change-Id: I260f045a2e144fb9ded7e1d3aa46592da8f63272
2 files changed