keycloak
静的公開メンバ関数 | 静的関数 | 非公開メンバ関数 | 全メンバ一覧
org.keycloak.common.util.DerUtils クラス
org.keycloak.common.util.DerUtils 連携図
Collaboration graph

静的公開メンバ関数

static PrivateKey decodePrivateKey (InputStream is) throws Exception
 
static PublicKey decodePublicKey (byte[] der) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException
 
static X509Certificate decodeCertificate (InputStream is) throws Exception
 
static PrivateKey decodePrivateKey (byte[] der) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException
 

静的関数

 [static initializer]
 

非公開メンバ関数

 DerUtils ()
 

詳解

Extract PrivateKey, PublicKey, and X509Certificate from a DER encoded byte array or file. Usually generated from openssl

著者
Bill Burke
バージョン
Revision
1

構築子と解体子

◆ DerUtils()

org.keycloak.common.util.DerUtils.DerUtils ( )
inlineprivate
45  {
46  }

関数詳解

◆ [static initializer]()

org.keycloak.common.util.DerUtils.[static initializer] ( )
inlinestaticpackage

◆ decodeCertificate()

static X509Certificate org.keycloak.common.util.DerUtils.decodeCertificate ( InputStream  is) throws Exception
inlinestatic
69  {
70  CertificateFactory cf = CertificateFactory.getInstance("X.509", "BC");
71  X509Certificate cert = (X509Certificate) cf.generateCertificate(is);
72  is.close();
73  return cert;
74  }

◆ decodePrivateKey() [1/2]

static PrivateKey org.keycloak.common.util.DerUtils.decodePrivateKey ( InputStream  is) throws Exception
inlinestatic
49  {
50 
51  DataInputStream dis = new DataInputStream(is);
52  byte[] keyBytes = new byte[dis.available()];
53  dis.readFully(keyBytes);
54  dis.close();
55 
56  PKCS8EncodedKeySpec spec =
57  new PKCS8EncodedKeySpec(keyBytes);
58  KeyFactory kf = KeyFactory.getInstance("RSA", "BC");
59  return kf.generatePrivate(spec);
60  }

◆ decodePrivateKey() [2/2]

static PrivateKey org.keycloak.common.util.DerUtils.decodePrivateKey ( byte []  der) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException
inlinestatic
76  {
77  PKCS8EncodedKeySpec spec =
78  new PKCS8EncodedKeySpec(der);
79  KeyFactory kf = KeyFactory.getInstance("RSA", "BC");
80  return kf.generatePrivate(spec);
81  }

◆ decodePublicKey()

static PublicKey org.keycloak.common.util.DerUtils.decodePublicKey ( byte []  der) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException
inlinestatic
62  {
63  X509EncodedKeySpec spec =
64  new X509EncodedKeySpec(der);
65  KeyFactory kf = KeyFactory.getInstance("RSA", "BC");
66  return kf.generatePublic(spec);
67  }

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