Package java.security

Examples of java.security.KeyStoreException


                keyStore = KeyStore.getInstance(type, provider);
            }
            keyStore.load(input, (keyStorePassword == null || keyStorePassword.length() == 0) ? new char[0] : keyStorePassword.toCharArray());
            return keyStore;
        } catch (IOException e) {
            throw new KeyStoreException(e);
        } catch (GeneralSecurityException e) {
            throw new KeyStoreException(e);
        } catch (Exception e) {
            throw new KeyStoreException(e);
        } finally {
            if (input != null) {
                try { input.close(); } catch (Exception ignore) {}
            }
        }
View Full Code Here


        PKCS10CertificationRequest csr = new PKCS10CertificationRequest(sigalg,
                subject, publicKey, attributes, signingKey);

        if (!csr.verify()) {
            throw new KeyStoreException("CSR verification failed");
        }

        ByteArrayOutputStream os = new ByteArrayOutputStream();
        DEROutputStream deros = new DEROutputStream(os);
        deros.writeObject(csr.getDERObject());
View Full Code Here

        } else if (this.keystore.isKeyEntry(alias)) {
            // private key entry
            info = new KeyEntryInfo(alias, "private key", keystore
                    .getCreationDate(alias));
        } else {
            throw new KeyStoreException("invalid key entry type");
        }
        return info;
    }
View Full Code Here

            certs = new Certificate[1];
            certs[0] = cert;
        } else if (keystore.isKeyEntry(alias)) {
            certs = keystore.getCertificateChain(alias);
        } else if (keystore.containsAlias(alias)) {
            throw new KeyStoreException("Unsupported key-store-entry, alias = "
                    + alias);
        } else {
            throw new KeyStoreException(
                    "Key-store-entry alias not found, alias = " + alias);
        }

        return certs;
    }
View Full Code Here

        PKCS10CertificationRequest csr = new PKCS10CertificationRequest(sigalg,
                subject, publicKey, attributes, signingKey);

        if (!csr.verify()) {
            throw new KeyStoreException("CSR verification failed");
        }

        ByteArrayOutputStream os = new ByteArrayOutputStream();
        DEROutputStream deros = new DEROutputStream(os);
        deros.writeObject(csr.getDERObject());
View Full Code Here

        PKCS10CertificationRequest csr = new PKCS10CertificationRequest(sigalg,
                subject, publicKey, attributes, signingKey);

        if (!csr.verify()) {
            throw new KeyStoreException("CSR verification failed");
        }

        ByteArrayOutputStream os = new ByteArrayOutputStream();
        DEROutputStream deros = new DEROutputStream(os);
        deros.writeObject(csr.getDERObject());
View Full Code Here

            new CertificateElement(this._doc, alias, cert);

         this._constructionElement.appendChild(certificateElement.getElement());
         XMLUtils.addReturnToElement(this);
      } catch (XMLSecurityException ex) {
         throw new KeyStoreException(ex.getMessage());
      }
   }
View Full Code Here

         KeyElement keyElement = new KeyElement(this._doc, alias, key, chain);

         this._constructionElement.appendChild(keyElement.getElement());
         XMLUtils.addReturnToElement(this);
      } catch (XMLSecurityException ex) {
         throw new KeyStoreException(ex.getMessage());
      }
   }
View Full Code Here

                                                chain);

         this._constructionElement.appendChild(keyElement.getElement());
         XMLUtils.addReturnToElement(this);
      } catch (XMLSecurityException ex) {
         throw new KeyStoreException(ex.getMessage());
      }
   }
View Full Code Here

        {
            alias = aliases.nextElement();
        }
        else
        {
            throw new KeyStoreException("Keystore is empty");
        }
        privateKey = (PrivateKey) keystore.getKey(alias, password);
        certificateChain = keystore.getCertificateChain(alias);
    }
View Full Code Here

TOP

Related Classes of java.security.KeyStoreException

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.