Package jp.go.aist.sot.client.common

Examples of jp.go.aist.sot.client.common.SignOnException


    public static String printDetails(X509Certificate cert)
        throws SignOnException {

        if (cert == null) {
            throw new SignOnException("cert is null");
        }
        try {
            return mh.getMessage("details_format",
                    new Object[] {
                cert.getSubjectDN().toString(), cert.getIssuerDN().toString(),
                cert.getSerialNumber().toString(16),
                String.valueOf(cert.getVersion()),
                cert.getNotBefore().toString(), cert.getNotAfter().toString(),
                getCertFingerPrint("MD5", cert),
                getCertFingerPrint("SHA1", cert) });
        } catch (Exception e) {
            throw new SignOnException(e);
        }
    }
View Full Code Here


    public void begin() {
        try {
            caCerts = new KeyStore(FileBaseUtil.getCAKeyStorePath(), null);
            caCertsSystem = new KeyStore(FileBaseUtil.getCASystemKeyStorePath(), null);
            if (!caCerts.exists() && !caCertsSystem.exists()) {
                throw new SignOnException(
                        "System err: check your " + FileBaseUtil.getCAKeyStorePath() + " and/or " + FileBaseUtil.getCASystemKeyStorePath());
            }
            openCAKeyStore();

            userCerts = new KeyStore(FileBaseUtil.getUserKeyStorePath(), null);
View Full Code Here

        }
        minHours = CertTermUtil.getMinHours();
        maxHours = CertTermUtil.getMaxHours();

        if ((minHours < 0) && (maxHours < 0)) {
            throw new SignOnException(
                    "System error: Invalid value minHours(" + minHours
                    + ") or maxHours(" + maxHours + ")");
        }

        Log.debug(CLASS_NAME,
View Full Code Here

            }
            // check x509 certificate
            X509Certificate cert = CertificateUtil.getCetificate(filePath);

            if (cert == null) {
                throw new SignOnException(mh.getMessage("invalid_cert"));
            }

            // make alias name.
            String alias = CertificateNameUtil.makeAliasName(cert);

            if (alias == null) {
                throw new SignOnException(
                        mh.getMessage("system_error",
                        new Object[] { "Failure making entry name."}));
            }
            // add ks
            caCerts.setCertificateEntry(alias, cert);
            caCerts.store();

            SubjectName dn = new SubjectName(alias, null);

            if (controller == null) {
                throw new SignOnException(
                        mh.getMessage("system_error",
                        new Object[] { "controller is null"}));
            }
            controller.addCACert(dn);
            importPW = null;
View Full Code Here

                userCerts.initialize();
            }
            // check pkcs12 certificate
            pkcs12 = CertificateUtil.getPKCS12Certificate(filePath, importPW);
            if (pkcs12 == null) {
                throw new SignOnException(
                        mh.getMessage("failure_opening_pkcs12"));
            }
            // make alias name.
            X509Certificate cert = (X509Certificate) pkcs12.getCertificate();
            String alias = CertificateNameUtil.makeAliasName(cert);

            // add ks
            userCerts.setKeyEntry(alias, pkcs12.getKey(), importPW,
                    pkcs12.getCertificateChain());
            userCerts.store();
            String cn = CertificateNameUtil.getCommonName(cert);
            SubjectName dn = new SubjectName(alias, cn);

            if (controller == null) {
                throw new SignOnException(
                        mh.getMessage("system_error",
                        new Object[] { "controller is null"}));
            }
            controller.addUserCert(dn);
            fireStorageChange();
View Full Code Here

        long millisec = -1L;

        try {
            if (dayStr == null || dayStr.equals("") || hourStr == null
                    || hourStr.equals("")) {
                throw new SignOnException(mh.getMessage("null_term"));
            }

            days = Integer.parseInt(dayStr);
            hours = Integer.parseInt(hourStr);
            certTerm = CertTermUtil.calcHours(days, hours);
            if (certTerm > maxHours) {
                throw new SignOnException(mh.getMessage("shorter_term"));
            } else if ((0 <= certTerm) && (certTerm <= minHours)) {
                throw new SignOnException(mh.getMessage("longer_term"));
            } else if (certTerm < 0) {
                throw new SignOnException(mh.getMessage("invalid_term"));
            }
            millisec = CertTermUtil.calcMillisec(days, hours);

        } catch (SignOnException e) {
            throw new SignOnException(
                    mh.getMessage("invalidterm_message",
                    new Object[] {
                e.getMessage(), new Integer(maxHours / 24),
                new Integer(maxHours % 24), new Integer(minHours) }));
        }
View Full Code Here

    }

    private void removeCACert() {
        try {
            if (caCerts == null) {
                throw new SignOnException(
                        mh.getMessage("system_error",
                        new Object[] { "caCerts is null"}));
            }
            if (aliasName == null) {
                throw new SignOnException(
                        mh.getMessage("system_error",
                        new Object[] { "aliasName is null"}));
            }
            caCerts.deleteEntry(aliasName);
            caCerts.store();
            if (controller == null) {
                throw new SignOnException(
                        mh.getMessage("system_error",
                        new Object[] { "controller is null"}));
            }
            controller.removeCACert(new SubjectName(aliasName, null));
        } catch (SignOnException e) {
View Full Code Here

    }

    private void removeUserCert() {
        try {
            if (userCerts == null) {
                throw new SignOnException(
                        mh.getMessage("system_error",
                        new Object[] { "caCerts is null"}));
            }
            if (aliasName == null) {
                throw new SignOnException(
                        mh.getMessage("system_error",
                        new Object[] { "aliasName is null"}));
            }
            userCerts.deleteEntry(aliasName);
            userCerts.store();
            if (controller == null) {
                throw new SignOnException(
                        mh.getMessage("system_error",
                        new Object[] { "controller is null"}));
            }
            controller.removeUserCert(new SubjectName(aliasName, null));
            fireStorageChange();
View Full Code Here

            ConfigWindowController windowController)
        throws SignOnException {

        if (mgr == null || propertyController == null
                || windowController == null) {
            throw new SignOnException("inivalid parameter");
        }
        this.propertyController = propertyController;
        this.mgr = mgr;
        this.windowController = windowController;
       
View Full Code Here

            UserPropertyController propertyController,
            CertificateStorage storage)
        throws SignOnException {

        if (mgr == null || propertyController == null || storage == null) {
            throw new SignOnException("inivalid parameter");
        }

        this.mgr = mgr;
        this.propertyController = propertyController;
        this.storage = storage;
View Full Code Here

TOP

Related Classes of jp.go.aist.sot.client.common.SignOnException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.