I am a newbie with Security in Android .. 
I am trying to get the sha1 of the signing certificate fingerprint of the android app ,
I wanna get the same result of the cmd :
 keytool -v -list -keystore  " PATH of key " -alias "alias of the key" -storpass " password"
I tried this code but it gave me a different result
    android.content.pm.Signature[] sigs;
        try {
            sigs = this.getPackageManager().getPackageInfo(this.getPackageName(),
                    PackageManager.GET_SIGNATURES).signatures;
            byte[] cert = sigs[0].toByteArray();
                 InputStream input
 = new ByteArrayInputStream(cert);
             CertificateFactory cf = null;
        try {
                cf = CertificateFactory.getInstance("X509");
            } catch (CertificateException e) {
                    e.printStackTrace();
            }
            X509Certificate c = null;
            try {
                    c = (X509Certificate) cf.generateCertificate(input);
                    Signature signature=null;
    signature = Signature.getInstance("SHA1withRSA");
                         signature.initVerify(c.getPublicKey());
                            signature.update(cert);
                           System.out.println("signature"+ signature.sign());