FileDocCategorySizeDatePackage
LDSSecurityObject.javaAPI DocAndroid 1.5 API3763Wed May 06 22:41:06 BST 2009org.bouncycastle.asn1.icao

LDSSecurityObject

public class LDSSecurityObject extends org.bouncycastle.asn1.ASN1Encodable implements ICAOObjectIdentifiers
The LDSSecurityObject object.
LDSSecurityObject ::= SEQUENCE {
version LDSSecurityObjectVersion,
hashAlgorithm DigestAlgorithmIdentifier,
dataGroupHashValues SEQUENCE SIZE (2..ub-DataGroups) OF DataHashGroup}

DigestAlgorithmIdentifier ::= AlgorithmIdentifier,

LDSSecurityObjectVersion :: INTEGER {V0(0)}

Fields Summary
public static final int
ub_DataGroups
org.bouncycastle.asn1.DERInteger
version
org.bouncycastle.asn1.x509.AlgorithmIdentifier
digestAlgorithmIdentifier
DataGroupHash[]
datagroupHash
Constructors Summary
public LDSSecurityObject(org.bouncycastle.asn1.ASN1Sequence seq)

        if (seq == null || seq.size() == 0)
        {
            throw new IllegalArgumentException("null or empty sequence passed.");
        }
        
        Enumeration e = seq.getObjects();

        // version
        version = DERInteger.getInstance(e.nextElement());
        // digestAlgorithmIdentifier
        digestAlgorithmIdentifier = AlgorithmIdentifier.getInstance(e.nextElement());
      
        ASN1Sequence datagroupHashSeq = ASN1Sequence.getInstance(e.nextElement());

        checkDatagroupHashSeqSize(datagroupHashSeq.size());        
        
        datagroupHash = new DataGroupHash[datagroupHashSeq.size()];
        for (int i= 0; i< datagroupHashSeq.size();i++)
        {
            datagroupHash[i] = DataGroupHash.getInstance(datagroupHashSeq.getObjectAt(i));
        } 
        
    
public LDSSecurityObject(org.bouncycastle.asn1.x509.AlgorithmIdentifier digestAlgorithmIdentifier, DataGroupHash[] datagroupHash)

        this.digestAlgorithmIdentifier = digestAlgorithmIdentifier;
        this.datagroupHash = datagroupHash;
        
        checkDatagroupHashSeqSize(datagroupHash.length);                      
    
Methods Summary
private voidcheckDatagroupHashSeqSize(int size)

        if ((size < 2) || (size > ub_DataGroups))
        {
               throw new IllegalArgumentException("wrong size in DataGroupHashValues : not in (2.."+ ub_DataGroups +")");
        }
    
public DataGroupHash[]getDatagroupHash()

        return datagroupHash;
    
public org.bouncycastle.asn1.x509.AlgorithmIdentifiergetDigestAlgorithmIdentifier()

        return digestAlgorithmIdentifier;
    
public static org.bouncycastle.asn1.icao.LDSSecurityObjectgetInstance(java.lang.Object obj)

            

       
         
    
        if (obj == null || obj instanceof LDSSecurityObject)
        {
            return (LDSSecurityObject)obj;
        }

        if (obj instanceof ASN1Sequence)
        {
            return new LDSSecurityObject(ASN1Sequence.getInstance(obj));            
        }
        
        throw new IllegalArgumentException("unknown object in getInstance");
    
public org.bouncycastle.asn1.DERObjecttoASN1Object()

        ASN1EncodableVector seq = new ASN1EncodableVector();
        
        seq.add(version);
        seq.add(digestAlgorithmIdentifier);
                
        ASN1EncodableVector seqname = new ASN1EncodableVector();
        for (int i = 0; i < datagroupHash.length; i++) 
        {
            seqname.add(datagroupHash[i]);
        }            
        seq.add(new DERSequence(seqname));                   
        
        return new DERSequence(seq);