1package org.bouncycastle.asn1; 2 3public class ASN1ObjectIdentifier 4 extends DERObjectIdentifier 5{ 6 public ASN1ObjectIdentifier(String identifier) 7 { 8 super(identifier); 9 } 10 11 ASN1ObjectIdentifier(byte[] bytes) 12 { 13 super(bytes); 14 } 15 16 /** 17 * Return an OID that creates a branch under the current one. 18 * 19 * @param branchID node numbers for the new branch. 20 * @return the OID for the new created branch. 21 */ 22 public ASN1ObjectIdentifier branch(String branchID) 23 { 24 return new ASN1ObjectIdentifier(getId() + "." + branchID); 25 } 26 27 /** 28 * Return true if this oid is an extension of the passed in branch, stem. 29 * @param stem the arc or branch that is a possible parent. 30 * @return true if the branch is on the passed in stem, false otherwise. 31 */ 32 public boolean on(ASN1ObjectIdentifier stem) 33 { 34 String id = getId(), stemId = stem.getId(); 35 return id.length() > stemId.length() && id.charAt(stemId.length()) == '.' && id.startsWith(stemId); 36 } 37} 38