FileDocCategorySizeDatePackage
Utils.javaAPI DocExample878Mon Nov 25 08:50:08 GMT 2002ora.jwsnut.chapter7.util

Utils

public class Utils extends Object

Fields Summary
Constructors Summary
Methods Summary
public static javax.security.auth.x500.X500PrivateCredentialgetCredentials(java.lang.String file, java.lang.String alias, java.lang.String keyPassword, java.lang.String storePassword)

        KeyStore ks = KeyStore.getInstance("JKS");
        ks.load(new FileInputStream(file), storePassword.toCharArray());
        X509Certificate cert = (X509Certificate)ks.getCertificate(alias);
        PrivateKey key = (PrivateKey)ks.getKey(alias, keyPassword.toCharArray());
        return new X500PrivateCredential(cert, key, alias);