Java Key Create getKeyStore(Certificate[] certificateChain, PrivateKey privateKey, char[] password)

Here you can find the source of getKeyStore(Certificate[] certificateChain, PrivateKey privateKey, char[] password)

Description

get Key Store

License

Open Source License

Declaration

private static KeyStore getKeyStore(Certificate[] certificateChain, PrivateKey privateKey, char[] password)
            throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException 

Method Source Code

//package com.java2s;
/*/* ww  w.j a v  a  2 s  . com*/
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License;
 * you may not use this file except in compliance with the Elastic License.
 */

import java.io.IOException;

import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;

import java.security.cert.Certificate;
import java.security.cert.CertificateException;

public class Main {
    private static KeyStore getKeyStore(Certificate[] certificateChain, PrivateKey privateKey, char[] password)
            throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {
        KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
        keyStore.load(null, null);
        // password must be non-null for keystore...
        keyStore.setKeyEntry("key", privateKey, password, certificateChain);
        return keyStore;
    }
}

Related

  1. getKeySize(final Key key)
  2. getKeySize(PrivateKey key)
  3. getKeyStore()
  4. getKeyStore()
  5. getKeyStore(byte[] bytes, char[] password)
  6. getKeyStore(char[] password)
  7. getKeyStore(File file, char[] storePass)
  8. getKeyStore(File keystore)
  9. getKeyStore(File keyStore)