Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.security.cert.CertPathValidatorException;

import java.util.Iterator;

import java.util.Set;

public class Main {
    protected static void checkPermittedEmail(Set permitted, String email) throws CertPathValidatorException {
        if (permitted.isEmpty()) {
            return;
        }

        String sub = email.substring(email.indexOf('@') + 1);
        Iterator it = permitted.iterator();

        while (it.hasNext()) {
            String str = (String) it.next();

            if (sub.endsWith(str)) {
                return;
            }
        }

        throw new CertPathValidatorException("Subject email address is not from a permitted subtree");
    }
}