Org.BouncyCastle.Asn1.DerObjectIdentifier.IsValidBranchID C# (CSharp) Метод

IsValidBranchID() приватный статический Метод

private static IsValidBranchID ( String branchID, int start ) : bool
branchID String
start int
Результат bool
        private static bool IsValidBranchID(
            String branchID, int start)
        {
            bool periodAllowed = false;

            int pos = branchID.Length;
            while (--pos >= start)
            {
                char ch = branchID[pos];

                // TODO Leading zeroes?
                if ('0' <= ch && ch <= '9')
                {
                    periodAllowed = true;
                    continue;
                }

                if (ch == '.')
                {
                    if (!periodAllowed)
                        return false;

                    periodAllowed = false;
                    continue;
                }

                return false;
            }

            return periodAllowed;
        }

Usage Example

Пример #1
0
 internal DerObjectIdentifier(DerObjectIdentifier oid, string branchID)
 {
     if (!DerObjectIdentifier.IsValidBranchID(branchID, 0))
     {
         throw new ArgumentException("string " + branchID + " not a valid OID branch", "branchID");
     }
     this.identifier = oid.Id + "." + branchID;
 }
All Usage Examples Of Org.BouncyCastle.Asn1.DerObjectIdentifier::IsValidBranchID