本文整理汇总了Java中java.security.cert.CertificateEncodingException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java CertificateEncodingException.printStackTrace方法的具体用法?Java CertificateEncodingException.printStackTrace怎么用?Java CertificateEncodingException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.security.cert.CertificateEncodingException
的用法示例。
在下文中一共展示了CertificateEncodingException.printStackTrace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSigningKey
import java.security.cert.CertificateEncodingException; //导入方法依赖的package包/类
/**
* Returns the private key signature on JBMR2+ or else null.
*/
public static String getSigningKey(String alias) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
Certificate cert = getPrivateKeyEntry(alias).getCertificate();
if (cert == null) {
return null;
}
try {
return Base64.encodeToString(cert.getEncoded(), Base64.NO_WRAP);
} catch (CertificateEncodingException e) {
e.printStackTrace();
return null;
}
} else {
return null;
}
}
示例2: v
import java.security.cert.CertificateEncodingException; //导入方法依赖的package包/类
public static String v(Context context) {
PackageInfo packageInfo;
String str = null;
try {
packageInfo = context.getPackageManager().getPackageInfo(u(context), 64);
} catch (NameNotFoundException e) {
e.printStackTrace();
Object obj = str;
}
InputStream byteArrayInputStream = new ByteArrayInputStream(packageInfo.signatures[0].toByteArray());
try {
CertificateFactory instance = CertificateFactory.getInstance("X509");
} catch (CertificateException e2) {
e2.printStackTrace();
obj = str;
}
try {
X509Certificate x509Certificate = (X509Certificate) instance.generateCertificate(byteArrayInputStream);
} catch (CertificateException e22) {
e22.printStackTrace();
obj = str;
}
try {
str = a(MessageDigest.getInstance(CommonUtils.MD5_INSTANCE).digest(x509Certificate.getEncoded()));
} catch (NoSuchAlgorithmException e3) {
e3.printStackTrace();
} catch (CertificateEncodingException e4) {
e4.printStackTrace();
}
return str;
}
示例3: w
import java.security.cert.CertificateEncodingException; //导入方法依赖的package包/类
public static String w(Context context) {
PackageInfo packageInfo;
String str = null;
try {
packageInfo = context.getPackageManager().getPackageInfo(v(context), 64);
} catch (NameNotFoundException e) {
e.printStackTrace();
Object obj = str;
}
InputStream byteArrayInputStream = new ByteArrayInputStream(packageInfo.signatures[0].toByteArray());
try {
CertificateFactory instance = CertificateFactory.getInstance("X509");
} catch (CertificateException e2) {
e2.printStackTrace();
obj = str;
}
try {
X509Certificate x509Certificate = (X509Certificate) instance.generateCertificate(byteArrayInputStream);
} catch (CertificateException e22) {
e22.printStackTrace();
obj = str;
}
try {
str = a(MessageDigest.getInstance(Coder.KEY_MD5).digest(x509Certificate.getEncoded()));
} catch (NoSuchAlgorithmException e3) {
e3.printStackTrace();
} catch (CertificateEncodingException e4) {
e4.printStackTrace();
}
return str;
}