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.math.BigInteger; 20 21 import javax.security.auth.x500.X500Principal; 22 23 import org.opensaml.xml.security.Criteria; 24 25 /** 26 * An implementation of {@link Criteria} which specifies criteria based on 27 * X.509 certificate issuer name and serial number. 28 */ 29 public final class X509IssuerSerialCriteria implements Criteria { 30 31 /** X.509 certificate issuer name. */ 32 private X500Principal issuerName; 33 34 /** X.509 certificate serial number. */ 35 private BigInteger serialNumber; 36 37 /** 38 * Constructor. 39 * 40 * @param issuer certificate issuer name 41 * @param serial certificate serial number 42 */ 43 public X509IssuerSerialCriteria(X500Principal issuer, BigInteger serial) { 44 setIssuerName(issuer); 45 setSerialNumber(serial); 46 } 47 48 /** Get the issuer name. 49 * 50 * @return Returns the issuer name. 51 */ 52 public X500Principal getIssuerName() { 53 return issuerName; 54 } 55 56 /** 57 * Set the issuer name. 58 * 59 * @param issuer The issuer name to set. 60 */ 61 public void setIssuerName(X500Principal issuer) { 62 if (issuer == null) { 63 throw new IllegalArgumentException("Issuer principal criteria value may not be null"); 64 } 65 this.issuerName = issuer; 66 } 67 68 /** 69 * Get the serial number. 70 * 71 * @return Returns the serial number. 72 */ 73 public BigInteger getSerialNumber() { 74 return serialNumber; 75 } 76 77 /** 78 * Set the serial number. 79 * 80 * @param serial The serial number to set. 81 */ 82 public void setSerialNumber(BigInteger serial) { 83 if (serial == null) { 84 throw new IllegalArgumentException("Serial number criteria value may not be null"); 85 } 86 this.serialNumber = serial; 87 } 88 89 }