Examples of PKCS12


Examples of iaik.pkcs.pkcs12.PKCS12

     * Process PKCS12 input stream into the private key and certificate chain.
     */
    public void load(InputStream is, String pword)
        throws IOException, PKCSException, CertificateException
    {
        PKCS12 p12 = new PKCS12(is);
        is.close();

        p12.decrypt(pword.toCharArray());

        KeyBag keyBag = p12.getKeyBag();

        if (null == keyBag)
        {
            throw new PKCSException("No private key found");
        }

        byte[] keyBagLocalKeyId = keyBag.getLocalKeyID();

        this.key = keyBag.getPrivateKey();

        CertificateBag[] certBags = p12.getCertificateBags();
        if ((null == certBags) || (certBags.length == 0))
        {
            throw new PKCSException("No certificates found");
        }

View Full Code Here

Examples of iaik.pkcs.pkcs12.PKCS12

    /**
     * Process PKCS12 input stream into the private key and certificate chain.
     */
    public void load(InputStream is, String pword)
    throws IOException, PKCSException, CertificateException {
        PKCS12 p12 = new PKCS12(is);
        is.close();

        p12.decrypt(pword.toCharArray());

        KeyBag keyBag = p12.getKeyBag();

        if (null == keyBag) {
            throw new PKCSException("No private key found");
        }

        byte[] keyBagLocalKeyId = keyBag.getLocalKeyID();

        this.key = keyBag.getPrivateKey();

        CertificateBag[] certBags = p12.getCertificateBags();
        if ((null == certBags) || (certBags.length == 0)) {
            throw new PKCSException("No certificates found");
        }

        this.alias = new String(keyBagLocalKeyId);
View Full Code Here

Examples of iaik.pkcs.pkcs12.PKCS12

    /**
     * Process PKCS12 input stream into the private key and certificate chain.
     */
    public void load(InputStream is, String pword)
    throws IOException, PKCSException, CertificateException {
        PKCS12 p12 = new PKCS12(is);
        is.close();

        p12.decrypt(pword.toCharArray());

        KeyBag keyBag = p12.getKeyBag();

        if (null == keyBag) {
            throw new PKCSException("No private key found");
        }

        byte[] keyBagLocalKeyId = keyBag.getLocalKeyID();

        this.key = keyBag.getPrivateKey();

        CertificateBag[] certBags = p12.getCertificateBags();
        if ((null == certBags) || (certBags.length == 0)) {
            throw new PKCSException("No certificates found");
        }

        this.alias = new String(keyBagLocalKeyId);
View Full Code Here

Examples of iaik.pkcs.pkcs12.PKCS12

     * Process PKCS12 input stream into the private key and certificate chain.
     */
    public void load(InputStream is, String pword)
        throws IOException, PKCSException, CertificateException
    {
        PKCS12 p12 = new PKCS12(is);
        is.close();

        p12.decrypt(pword.toCharArray());

        KeyBag keyBag = p12.getKeyBag();

        if (null == keyBag)
        {
            throw new PKCSException("No private key found");
        }

        byte[] keyBagLocalKeyId = keyBag.getLocalKeyID();

        this.key = keyBag.getPrivateKey();

        CertificateBag[] certBags = p12.getCertificateBags();
        if ((null == certBags) || (certBags.length == 0))
        {
            throw new PKCSException("No certificates found");
        }

View Full Code Here

Examples of jp.go.aist.sot.client.security.PKCS12

    }

    private void importUserCert() {
        Log.debug(CLASS_NAME, "ImportUserCert=>certName=" + filePath);
        PKCS12 pkcs12 = null;

        try {
            if (userCerts == null) {
                userCerts = new KeyStore(FileBaseUtil.getUserKeyStorePath(),
                        storePW);
                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) {
View Full Code Here

Examples of jp.go.aist.sot.client.security.PKCS12

            }
            if (uks == null || uks.size() == 0) {
                throw new SignOnException(mh.getMessage("invalid_passphrase"));
            }
           
            PKCS12 pkcs12 = jp.go.aist.sot.client.security.KeyStore.convertKeyStoreToPKCS12(
                    ks, cn, passphrase.toCharArray());

            mgr.setPKCS12(pkcs12);

            SSLContextFactory factory = new SSLContextFactory(caks, uks,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.