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 org.opensaml.xml.security.Criteria;
20
21 /**
22 * An implementation of {@link Criteria} which specifies criteria based on
23 * X.509 certificate subject key identifier.
24 */
25 public final class X509SubjectKeyIdentifierCriteria implements Criteria {
26
27 /** X.509 certificate subject key identifier. */
28 private byte[] subjectKeyIdentifier;
29
30 /**
31 * Constructor.
32 *
33 * @param ski certificate subject key identifier
34 */
35 public X509SubjectKeyIdentifierCriteria(byte[] ski) {
36 setSubjectKeyIdentifier(ski);
37 }
38
39 /**
40 * Get the subject key identifier.
41 *
42 * @return Returns the subject key identifier
43 */
44 public byte[] getSubjectKeyIdentifier() {
45 return subjectKeyIdentifier;
46 }
47
48 /**
49 * Set the subject key identifier.
50 *
51 * @param ski The subject key identifier to set.
52 */
53 public void setSubjectKeyIdentifier(byte[] ski) {
54 if (ski == null || ski.length == 0) {
55 throw new IllegalArgumentException("Subject key identifier criteria value must be non-null and non-empty");
56 }
57 subjectKeyIdentifier = ski;
58 }
59
60
61
62
63 }