001package co.codewizards.cloudstore.rest.client.ssl;
002
003import static co.codewizards.cloudstore.core.util.Util.*;
004
005import java.security.cert.X509Certificate;
006
007import co.codewizards.cloudstore.core.util.AssertUtil;
008
009public class CheckServerTrustedCertificateExceptionContext {
010
011        private X509Certificate[] certificateChain;
012        private Throwable error;
013
014        protected CheckServerTrustedCertificateExceptionContext(X509Certificate[] certificateChain, Throwable certificateException) {
015                this.certificateChain = AssertUtil.assertNotNull(certificateChain, "certificateChain");
016                this.error = AssertUtil.assertNotNull(certificateException, "error");
017
018                if (certificateChain.length < 1)
019                        throw new IllegalArgumentException("certificateChain is empty!");
020        }
021
022        public X509Certificate[] getCertificateChain() {
023                return certificateChain;
024        }
025
026        public Throwable getError() {
027                return error;
028        }
029}