#. X509Certificate 얻기 from a Base54 encoded String
/**
* *
* @param encodedCertificate
* @return
*/
public static X509Certificate getCertificateObject(String encodedCertificate) {
X509Certificate x509Certificate = null;
try{
// PEM encoding -> DER certificat + making InputStream
InputStream inputStream = new ByteArrayInputStream(Base64.decode(encodedCertificate.getBytes()));
CertificateFactory certificatFactory = CertificateFactory.getInstance("X.509");
x509Certificate = (X509Certificate)certificatFactory.generateCertificate(inputStream);
} catch(Exception e){
System.out.println("########## ");
e.printStackTrace();
}
return x509Certificate;
}
#. PublicKey 얻기 from a Base54 encoded String
/**
* Extract a PublicKey from PEM Certificat
*
* @param encodedCertificate
* @return
*/
public static PublicKey publicKeyFromCertificate(String encodedCertificate) {
PublicKey publicKey = null;
try{
// PEM encoding -> DER certificat + making InputStream
InputStream inputStream = new ByteArrayInputStream(Base64.decode(encodedCertificate.getBytes()));
CertificateFactory certificatFactory = CertificateFactory.getInstance("X.509");
X509Certificate x509Certificate = (X509Certificate)certificatFactory.generateCertificate(inputStream);
publicKey = x509Certificate.getPublicKey();
} catch(Exception e){
System.out.println("########## ");
e.printStackTrace();
}
return publicKey;
}
'Dev > Orvercome 3sec memory' 카테고리의 다른 글
입력 Form을 위한 몇 가지 Validation check (0) | 2013.01.23 |
---|---|
IE9으로 테이블 표시할 때 칸(Cell) 밀림 현상 해결 (0) | 2013.01.03 |
Facebook "Like"버튼 별 & "Share" 기능의 내보낸 글 구성의 차이점 (1) | 2011.10.07 |
Default Locale setting of HttpServletRequest (0) | 2011.04.13 |
Window 7 Oracle Client 설치시 javaw 에러 (3) | 2011.01.31 |