Code example for DSAPrivateKeySpec

0
        notes = "", 
        method = "setKeyEntry", 
        args = {java.lang.String.class, java.security.Key.class, char[].class, java.security.cert.Certificate[].class}
    ) 
    public void test_setKeyEntryLjava_lang_StringLjava_security_Key$C$Ljava_security_cert_Certificate() 
            throws Exception { 
 
        // Test for method void 
        // java.security.KeyStore.setKeyEntry(java.lang.String, 
        // java.security.Key, char [], java.security.cert.Certificate []) 
 
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        X509Certificate cert[] = new X509Certificate[2];
        cert[0] = (X509Certificate) cf.generateCertificate(certArray);
        cert[1] = (X509Certificate) cf.generateCertificate(certArray2);
        KeyStore keyTest = KeyStore.getInstance(KeyStore.getDefaultType());
         
        try { 
            keyTest.setKeyEntry("alias3", privateKey, pssWord, cert);
            fail("expected KeyStoreException");
        } catch (KeyStoreException e) {