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.DERBitString; 24 import org.apache.geronimo.util.asn1.DERObject; 25 import org.apache.geronimo.util.asn1.DERSequence; 26 27 public class AttributeCertificate 28 extends ASN1Encodable 29 { 30 AttributeCertificateInfo acinfo; 31 AlgorithmIdentifier signatureAlgorithm; 32 DERBitString signatureValue; 33 34 38 public static AttributeCertificate getInstance(Object obj) 39 { 40 if (obj instanceof AttributeCertificate) 41 { 42 return (AttributeCertificate)obj; 43 } 44 else if (obj instanceof ASN1Sequence) 45 { 46 return new AttributeCertificate((ASN1Sequence)obj); 47 } 48 49 throw new IllegalArgumentException ("unknown object in factory"); 50 } 51 52 public AttributeCertificate( 53 AttributeCertificateInfo acinfo, 54 AlgorithmIdentifier signatureAlgorithm, 55 DERBitString signatureValue) 56 { 57 this.acinfo = acinfo; 58 this.signatureAlgorithm = signatureAlgorithm; 59 this.signatureValue = signatureValue; 60 } 61 62 public AttributeCertificate( 63 ASN1Sequence seq) 64 { 65 this.acinfo = AttributeCertificateInfo.getInstance(seq.getObjectAt(0)); 66 this.signatureAlgorithm = AlgorithmIdentifier.getInstance(seq.getObjectAt(1)); 67 this.signatureValue = DERBitString.getInstance(seq.getObjectAt(2)); 68 } 69 70 public AttributeCertificateInfo getAcinfo() 71 { 72 return acinfo; 73 } 74 75 public AlgorithmIdentifier getSignatureAlgorithm() 76 { 77 return signatureAlgorithm; 78 } 79 80 public DERBitString getSignatureValue() 81 { 82 return signatureValue; 83 } 84 85 95 public DERObject toASN1Object() 96 { 97 ASN1EncodableVector v = new ASN1EncodableVector(); 98 99 v.add(acinfo); 100 v.add(signatureAlgorithm); 101 v.add(signatureValue); 102 103 return new DERSequence(v); 104 } 105 } 106 | Popular Tags |