[WAGON-452] RelaxedTrustStrategy does not handle multiple certificates
This closes #36
diff --git a/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/RelaxedTrustStrategy.java b/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/RelaxedTrustStrategy.java
index ca9bc9a..f611d12 100644
--- a/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/RelaxedTrustStrategy.java
+++ b/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/RelaxedTrustStrategy.java
@@ -45,24 +45,27 @@
public boolean isTrusted( X509Certificate[] certificates, String authType )
throws CertificateException
{
- if ( ( certificates != null ) && ( certificates.length == 1 ) )
+ if ( ( certificates != null ) && ( certificates.length > 0 ) )
{
- try
+ for ( X509Certificate currentCertificate : certificates )
{
- certificates[0].checkValidity();
- }
- catch ( CertificateExpiredException e )
- {
- if ( !ignoreSSLValidityDates )
+ try
{
- throw e;
+ currentCertificate.checkValidity();
}
- }
- catch ( CertificateNotYetValidException e )
- {
- if ( !ignoreSSLValidityDates )
+ catch ( CertificateExpiredException e )
{
- throw e;
+ if ( !ignoreSSLValidityDates )
+ {
+ throw e;
+ }
+ }
+ catch ( CertificateNotYetValidException e )
+ {
+ if ( !ignoreSSLValidityDates )
+ {
+ throw e;
+ }
}
}
return true;