Use a TlsFatalAlert to ensure the alert description is available
import org.bouncycastle.tls.SignatureAlgorithm;
import org.bouncycastle.tls.TlsFatalAlert;
import org.bouncycastle.tls.crypto.TlsCertificate;
-import org.bouncycastle.tls.crypto.TlsCryptoException;
import org.bouncycastle.tls.crypto.TlsVerifier;
import org.bouncycastle.tls.crypto.impl.RSAUtil;
import org.bouncycastle.util.Arrays;
@@ -56,7 +55,7 @@ public static Certificate parseCertificate(byte[] encoding)
}
catch (IllegalArgumentException e)
{
- throw new TlsCryptoException("unable to decode certificate: " + e.getMessage(), e);
+ throw new TlsFatalAlert(AlertDescription.bad_certificate, e);
}
}
