public static int calculateVersion(OriginatorInfo origInfo)
    {
        if (origInfo == null)
        {
            return 0;
        }
        else
        {
            int ver = 0;

            for (Enumeration e = origInfo.getCertificates().getObjects(); e.hasMoreElements();)
            {
                Object obj = e.nextElement();

                if (obj instanceof ASN1TaggedObject)
                {
                    ASN1TaggedObject tag = (ASN1TaggedObject)obj;

                    if (tag.getTagNo() == 2)
                    {
                        ver = 1;
                    }
                    else if (tag.getTagNo() == 3)
                    {
                        ver = 3;
                        break;
                    }
                }
            }

            if (origInfo.getCRLs() != null)
            {
                for (Enumeration e = origInfo.getCRLs().getObjects(); e.hasMoreElements();)
                {
                    Object obj = e.nextElement();

                    if (obj instanceof ASN1TaggedObject)
                    {
                        ASN1TaggedObject tag = (ASN1TaggedObject)obj;

                        if (tag.getTagNo() == 1)
                        {
                            ver = 3;
                            break;
                        }
                    }
                }
            }

            return ver;
        }
    }