gluu
静的公開メンバ関数 | 非公開メンバ関数 | 静的非公開変数類 | 全メンバ一覧
org.xdi.oxauth.util.CertUtil クラス
org.xdi.oxauth.util.CertUtil 連携図
Collaboration graph

静的公開メンバ関数

static List< X509Certificate > loadX509CertificateFromFile (String filePath)
 
static X509Certificate x509CertificateFromBytes (byte[] cert)
 
static X509Certificate parsePem (String pem)
 

非公開メンバ関数

 CertUtil ()
 

静的非公開変数類

static final Logger log = LoggerFactory.getLogger(CertUtil.class)
 

詳解

著者
Yuriy Movchan
バージョン
March 11, 2016

構築子と解体子

◆ CertUtil()

org.xdi.oxauth.util.CertUtil.CertUtil ( )
inlineprivate
33 {}

関数詳解

◆ loadX509CertificateFromFile()

static List<X509Certificate> org.xdi.oxauth.util.CertUtil.loadX509CertificateFromFile ( String  filePath)
inlinestatic
36  {
37  if (StringHelper.isEmpty(filePath)) {
38  log.error("X509Certificate file path is empty");
39 
40  return null;
41  }
42 
43  InputStream is;
44  try {
45  is = FileUtils.openInputStream(new File(filePath));
46  } catch (IOException ex) {
47  log.error("Failed to read X.509 certificates from file: '" + filePath + "'", ex);
48  return null;
49  }
50 
51  List<X509Certificate> certificates = null;
52  try {
53  CertificateFactory cf = CertificateFactory.getInstance("X.509");
54  certificates = (List<X509Certificate>) cf.generateCertificates(is);
55  } catch (CertificateException ex) {
56  log.error("Failed to parse X.509 certificates from file: '" + filePath + "'", ex);
57  } finally {
58  IOUtils.closeQuietly(is);
59  }
60 
61  return certificates;
62  }
static final Logger log
Definition: CertUtil.java:31

◆ parsePem()

static X509Certificate org.xdi.oxauth.util.CertUtil.parsePem ( String  pem)
inlinestatic
77  {
78  try {
79  return CertificateParser.parsePem(pem);
80  } catch (CertificateException ex) {
81  log.error("Failed to parse PEM certificate", ex);
82  }
83 
84  return null;
85  }
static final Logger log
Definition: CertUtil.java:31

◆ x509CertificateFromBytes()

static X509Certificate org.xdi.oxauth.util.CertUtil.x509CertificateFromBytes ( byte []  cert)
inlinestatic
64  {
65  try {
66  CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
67  InputStream bais = new ByteArrayInputStream(cert);
68 
69  return (X509Certificate) certFactory.generateCertificate(bais);
70  } catch (CertificateException ex) {
71  log.error("Failed to parse X.509 certificates from bytes", ex);
72  }
73 
74  return null;
75  }
static final Logger log
Definition: CertUtil.java:31

メンバ詳解

◆ log

final Logger org.xdi.oxauth.util.CertUtil.log = LoggerFactory.getLogger(CertUtil.class)
staticprivate

このクラス詳解は次のファイルから抽出されました: