View Javadoc

1   /*
2    * Copyright [2007] [University Corporation for Advanced Internet Development, Inc.]
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.opensaml.xml.security.x509;
18  
19  import java.security.cert.X509CRL;
20  import java.security.cert.X509Certificate;
21  import java.util.Collection;
22  
23  /**
24   * Basic implementation of {@link PKIXValidationInformation}.
25   */
26  public class BasicPKIXValidationInformation implements PKIXValidationInformation {
27  
28      /** Certs used as the trust anchors. */
29      private Collection<X509Certificate> trustAnchors;
30  
31      /** CRLs used during validation. */
32      private Collection<X509CRL> trustedCRLs;
33  
34      /** Max verification depth during PKIX validation. */
35      private Integer verificationDepth;
36  
37      /**
38       * Constructor.
39       * 
40       * @param anchors certs used as trust anchors during validation
41       * @param crls CRLs used during validation
42       * @param depth max verification path depth
43       */
44      public BasicPKIXValidationInformation(Collection<X509Certificate> anchors, Collection<X509CRL> crls,
45              Integer depth) {
46          
47          trustAnchors = anchors;
48          trustedCRLs = crls;
49          verificationDepth = depth;
50      }
51  
52      /** {@inheritDoc} */
53      public Collection<X509CRL> getCRLs() {
54          return trustedCRLs;
55      }
56  
57      /** {@inheritDoc} */
58      public Collection<X509Certificate> getCertificates() {
59          return trustAnchors;
60      }
61  
62      /** {@inheritDoc} */
63      public Integer getVerificationDepth() {
64          return verificationDepth;
65      }
66  }