List of usage examples for org.bouncycastle.asn1 DERSequence DERSequence
public DERSequence(ASN1Encodable[] elements)
From source file:net.ripe.rpki.commons.crypto.rfc3779.ResourceExtensionEncoder.java
License:BSD License
/** * ASIdentifiers ::= SEQUENCE { asnum [0] EXPLICIT ASIdentifierChoice * OPTIONAL, rdi [1] EXPLICIT ASIdentifierChoice OPTIONAL} *///www .j ava 2 s . c o m ASN1Object asIdentifiersToDer(boolean inheritAsn, IpResourceSet asnResources, boolean inheritRdi, IpResourceSet rdiResources) { List<ASN1Encodable> seq = new ArrayList<ASN1Encodable>(2); if (inheritAsn || asnResources.containsType(IpResourceType.ASN)) { seq.add(new DERTaggedObject(0, asIdentifierChoiceToDer(inheritAsn, asnResources))); } if (inheritRdi || rdiResources.containsType(IpResourceType.ASN)) { seq.add(new DERTaggedObject(1, asIdentifierChoiceToDer(inheritRdi, rdiResources))); } return new DERSequence(seq.toArray(new ASN1Encodable[seq.size()])); }
From source file:net.ripe.rpki.commons.crypto.rfc3779.ResourceExtensionEncoder.java
License:BSD License
/** * asIdsOrRanges ::= SEQUENCE OF ASIdOrRange *//*www . j a v a 2 s.c o m*/ DERSequence asIdsOrRangesToDer(IpResourceSet resources) { List<ASN1Encodable> seq = new ArrayList<ASN1Encodable>(); for (IpResource resource : resources) { if (IpResourceType.ASN == resource.getType()) { seq.add(asIdOrRangeToDer(IpResourceRange.range(resource.getStart(), resource.getEnd()))); } } return new DERSequence(seq.toArray(new ASN1Encodable[seq.size()])); }
From source file:net.ripe.rpki.commons.crypto.rfc3779.ResourceExtensionEncoder.java
License:BSD License
/** * ASRange ::= SEQUENCE { min ASId, max ASId } *//* w w w. ja v a2 s . c om*/ DERSequence asRangeToDer(IpResourceRange range) { ASN1Encodable[] seq = { asIdToDer((Asn) range.getStart()), asIdToDer((Asn) range.getEnd()) }; return new DERSequence(seq); }
From source file:net.ripe.rpki.commons.crypto.rfc3779.ResourceExtensionEncoder.java
License:BSD License
/** * IPAddrBlocks ::= SEQUENCE OF IPAddressFamily *///from w ww. j a v a 2 s .c o m ASN1Object ipAddressBlocksToDer(SortedMap<AddressFamily, IpResourceSet> resources) { List<ASN1Encodable> seq = new ArrayList<ASN1Encodable>(2); for (AddressFamily addressFamily : resources.keySet()) { seq.add(ipAddressFamilyToDer(addressFamily, resources.get(addressFamily))); } return new DERSequence(seq.toArray(new ASN1Encodable[seq.size()])); }
From source file:net.ripe.rpki.commons.crypto.rfc3779.ResourceExtensionEncoder.java
License:BSD License
/** * IPAddressFamily ::= SEQUENCE { -- AFI & opt SAFI -- addressFamily OCTET * STRING (SIZE (2..3)), ipAddressChoice IPAddressChoice } *///from ww w .jav a2 s . c o m ASN1Object ipAddressFamilyToDer(AddressFamily addressFamily, IpResourceSet resources) { IpResourceType type = addressFamily.toIpResourceType(); ASN1Encodable[] seq = new ASN1Encodable[2]; seq[0] = addressFamily.toDer(); seq[1] = ipAddressChoiceToDer(type, resources); return new DERSequence(seq); }
From source file:net.ripe.rpki.commons.crypto.rfc3779.ResourceExtensionEncoder.java
License:BSD License
/** * IPAddressChoice ::= CHOICE { inherit NULL, -- inherit from issuer -- * addressesOrRanges SEQUENCE OF IPAddressOrRange } *//* ww w . j a v a 2 s. com*/ ASN1Encodable ipAddressChoiceToDer(IpResourceType type, IpResourceSet resources) { if (resources == null) { return DERNull.INSTANCE; } List<ASN1Encodable> addressesOrRanges = new ArrayList<ASN1Encodable>(); for (IpResource resource : resources) { if (resource.getType() == type) { addressesOrRanges.add(ipAddressOrRangeToDer(asRange(resource))); } } Validate.notEmpty(addressesOrRanges, "no resources of type " + type + " in set"); return new DERSequence(addressesOrRanges.toArray(new ASN1Encodable[addressesOrRanges.size()])); }
From source file:net.ripe.rpki.commons.crypto.rfc3779.ResourceExtensionEncoder.java
License:BSD License
/** * IPAddressRange ::= SEQUENCE { min IPAddress, max IPAddress } *//*ww w. j av a 2 s .c o m*/ DERSequence ipRangeToDer(IpRange range) { ASN1Encodable[] encodables = { startIpAddressToDer((IpAddress) range.getStart()), endIpAddressToDer((IpAddress) range.getEnd()) }; return new DERSequence(encodables); }
From source file:net.ripe.rpki.commons.crypto.x509cert.X509CertificateBuilderHelper.java
License:BSD License
private void addAIA(X509v3CertificateBuilder generator) throws CertIOException { generator.addExtension(X509Extension.authorityInfoAccess, false, AuthorityInformationAccess.getInstance(new DERSequence(authorityInformationAccess))); }
From source file:net.ripe.rpki.commons.crypto.x509cert.X509CertificateBuilderHelper.java
License:BSD License
private void addSIA(X509v3CertificateBuilder generator) throws CertIOException { generator.addExtension(X509Extension.subjectInfoAccess, false, AuthorityInformationAccess.getInstance(new DERSequence(subjectInformationAccess))); }
From source file:net.ripe.rpki.commons.crypto.x509cert.X509CertificateBuilderHelper.java
License:BSD License
private void addPolicies(X509v3CertificateBuilder generator) throws CertIOException { generator.addExtension(X509Extension.certificatePolicies, true, new DERSequence(policies)); }