(byte)0x06,(byte)0x03,(byte)0x00,(byte)0x01,(byte)0x02,
(byte)0xA0,(byte)0x03,1,1,(byte)0xff,
(byte)0x80,(byte)0x01,(byte)0x00
};
try {
new TrustAnchor(
(X509Certificate)ks.getCertificate(certAlias), encoding);
} catch (IllegalArgumentException failed) {
fail("valid encoding not accepted");
}
// now corrupt encoding: set OtherName value tag to 1 (must be 0)
encoding[13] = 1;
try {
new TrustAnchor(
(X509Certificate)ks.getCertificate(certAlias), encoding);
fail("invalid encoding accepted");
} catch (IllegalArgumentException ok) {
}
}