1 17 18 package org.apache.geronimo.util.asn1.x509; 19 20 import org.apache.geronimo.util.asn1.ASN1Encodable; 21 import org.apache.geronimo.util.asn1.ASN1EncodableVector; 22 import org.apache.geronimo.util.asn1.ASN1Sequence; 23 import org.apache.geronimo.util.asn1.DERGeneralizedTime; 24 import org.apache.geronimo.util.asn1.DERObject; 25 import org.apache.geronimo.util.asn1.DERSequence; 26 27 public class AttCertValidityPeriod 28 extends ASN1Encodable 29 { 30 DERGeneralizedTime notBeforeTime; 31 DERGeneralizedTime notAfterTime; 32 33 public static AttCertValidityPeriod getInstance( 34 Object obj) 35 { 36 if (obj instanceof AttCertValidityPeriod) 37 { 38 return (AttCertValidityPeriod)obj; 39 } 40 else if (obj instanceof ASN1Sequence) 41 { 42 return new AttCertValidityPeriod((ASN1Sequence)obj); 43 } 44 45 throw new IllegalArgumentException ("unknown object in factory"); 46 } 47 48 public AttCertValidityPeriod( 49 ASN1Sequence seq) 50 { 51 notBeforeTime = (DERGeneralizedTime)seq.getObjectAt(0); 52 notAfterTime = (DERGeneralizedTime)seq.getObjectAt(1); 53 } 54 55 59 public AttCertValidityPeriod( 60 DERGeneralizedTime notBeforeTime, 61 DERGeneralizedTime notAfterTime) 62 { 63 this.notBeforeTime = notBeforeTime; 64 this.notAfterTime = notAfterTime; 65 } 66 67 public DERGeneralizedTime getNotBeforeTime() 68 { 69 return notBeforeTime; 70 } 71 72 public DERGeneralizedTime getNotAfterTime() 73 { 74 return notAfterTime; 75 } 76 77 86 public DERObject toASN1Object() 87 { 88 ASN1EncodableVector v = new ASN1EncodableVector(); 89 90 v.add(notBeforeTime); 91 v.add(notAfterTime); 92 93 return new DERSequence(v); 94 } 95 } 96 | Popular Tags |