Package iaik.pkcs

Examples of iaik.pkcs.PKCSException


        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);
        X509Certificate myCert = null;

        for (int i = 0; i < certBags.length; i++)
        {
            byte[] certBagLocalKeyId = certBags[i].getLocalKeyID();
            if ((null != keyBagLocalKeyId) && (null != certBagLocalKeyId))
            {
                if (Arrays.equals(certBagLocalKeyId, keyBagLocalKeyId))
                {
                    myCert = certBags[i].getCertificate();
                    break;
                }
            }
        }

        if (null == myCert)
        {
            throw new PKCSException("No owner certificate found");
        }

        iaik.x509.X509Certificate[] certChain =
            CertificateBag.getCertificates(certBags);
        this.certChain = Util.arrangeCertificateChain(certChain, false);
View Full Code Here


        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);
        X509Certificate myCert = null;

        for( int i=0; i < certBags.length; i++) {
            byte[] certBagLocalKeyId = certBags[i].getLocalKeyID();
            if ((null != keyBagLocalKeyId) && (null != certBagLocalKeyId)) {
                if (Arrays.equals(certBagLocalKeyId, keyBagLocalKeyId)) {
                    myCert = certBags[i].getCertificate();
                    break;
                }
            }
        }

        if (null == myCert) {
            throw new PKCSException("No owner certificate found");
        }

        iaik.x509.X509Certificate[] certChain = CertificateBag.getCertificates(certBags);
        this.certChain = Util.arrangeCertificateChain(certChain, false);
    }
View Full Code Here

        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);
        X509Certificate myCert = null;

        for( int i=0; i < certBags.length; i++) {
            byte[] certBagLocalKeyId = certBags[i].getLocalKeyID();
            if ((null != keyBagLocalKeyId) && (null != certBagLocalKeyId)) {
                if (Arrays.equals(certBagLocalKeyId, keyBagLocalKeyId)) {
                    myCert = certBags[i].getCertificate();
                    break;
                }
            }
        }

        if (null == myCert) {
            throw new PKCSException("No owner certificate found");
        }

        iaik.x509.X509Certificate[] certChain = CertificateBag.getCertificates(certBags);
        this.certChain = Util.arrangeCertificateChain(certChain, false);
    }
View Full Code Here

        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);
        X509Certificate myCert = null;

        for (int i = 0; i < certBags.length; i++)
        {
            byte[] certBagLocalKeyId = certBags[i].getLocalKeyID();
            if ((null != keyBagLocalKeyId) && (null != certBagLocalKeyId))
            {
                if (Arrays.equals(certBagLocalKeyId, keyBagLocalKeyId))
                {
                    myCert = certBags[i].getCertificate();
                    break;
                }
            }
        }

        if (null == myCert)
        {
            throw new PKCSException("No owner certificate found");
        }

        iaik.x509.X509Certificate[] certChain =
            CertificateBag.getCertificates(certBags);
        this.certChain = Util.arrangeCertificateChain(certChain, false);
View Full Code Here

TOP

Related Classes of iaik.pkcs.PKCSException

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.