Code example for PrivateKey

Methods: getAlgorithm

            BigInteger serial = certChain[0].getSerialNumber(); 
            String digestAlgorithm; 
            String signatureAlgorithm; 
            String keyAlgorithm = privateKey.getAlgorithm(); 
             * If no signature algorithm was specified, we choose a 
             * default that is compatible with the private key algorithm. 
            if (sigalg == null) { 
                if (keyAlgorithm.equalsIgnoreCase("DSA")) 
                    digestAlgorithm = "SHA1"; 
                else if (keyAlgorithm.equalsIgnoreCase("RSA")) 
                    digestAlgorithm = "SHA1"; 
                else { 
                    throw new RuntimeException( 
                            "private key is not a DSA or " + "RSA key"); 
Connect your IDE to all the code out there  Get Codota for Java