package org.bouncycastle.asn1;

public class ASN1ObjectIdentifier
    extends DERObjectIdentifier
{
    public ASN1ObjectIdentifier(String identifier)
    {
        super(identifier);
    }

    ASN1ObjectIdentifier(byte[] bytes)
    {
        super(bytes);
    }

    /**
     * Return an OID that creates a branch under the current one.
     *
     * @param branchID node numbers for the new branch.
     * @return
     */
    public ASN1ObjectIdentifier branch(String branchID)
    {
        return new ASN1ObjectIdentifier(getId() + "." + branchID);
    }

    /**
     * Return  true if this oid is an extension of the passed in branch, stem.
     * @param stem the arc or branch that is a possible parent.
     * @return  true if the branch is on the passed in stem, false otherwise.
     */
    public boolean on(ASN1ObjectIdentifier stem)
    {
        return this.getId().startsWith(stem.getId());
    }
}

@@ -858,27 +858,139 @@
     
-return this.getId()
+String id = getId(), stemId = stem.getId();%0A        return id.length() %3E stemId.length() && id.charAt(stemId.length()) == '.' && id
 .sta
@@ -1001,24 +1001,18 @@
 ith(stem
-.getId()
+Id
 );%0A    %7D

Improve check in method "on"