gluu
公開メンバ関数 | 全メンバ一覧
org.xdi.oxauth.crypto.signature.SHA256withECDSASignatureVerification クラス
org.xdi.oxauth.crypto.signature.SHA256withECDSASignatureVerification の継承関係図
Inheritance graph
org.xdi.oxauth.crypto.signature.SHA256withECDSASignatureVerification 連携図
Collaboration graph

公開メンバ関数

boolean checkSignature (X509Certificate certificate, byte[] signedBytes, byte[] signature) throws SignatureException
 
boolean checkSignature (PublicKey publicKey, byte[] signedBytes, byte[] signature) throws SignatureException
 
PublicKey decodePublicKey (byte[] encodedPublicKey) throws SignatureException
 
byte [] hash (byte[] bytes)
 
byte [] hash (String str)
 

詳解

関数詳解

◆ checkSignature() [1/2]

boolean org.xdi.oxauth.crypto.signature.SHA256withECDSASignatureVerification.checkSignature ( X509Certificate  certificate,
byte []  signedBytes,
byte []  signature 
) throws SignatureException
inline

org.xdi.oxauth.crypto.signature.SignatureVerificationを実装しています。

30  {
31  return checkSignature(certificate.getPublicKey(), signedBytes, signature);
32  }
boolean checkSignature(X509Certificate certificate, byte[] signedBytes, byte[] signature)
Definition: SHA256withECDSASignatureVerification.java:30

◆ checkSignature() [2/2]

boolean org.xdi.oxauth.crypto.signature.SHA256withECDSASignatureVerification.checkSignature ( PublicKey  publicKey,
byte []  signedBytes,
byte []  signature 
) throws SignatureException
inline

org.xdi.oxauth.crypto.signature.SignatureVerificationを実装しています。

35  {
36  boolean isValid = false;
37  try {
38  Signature ecdsaSignature = Signature.getInstance("SHA256withECDSA", "BC");
39  ecdsaSignature.initVerify(publicKey);
40  ecdsaSignature.update(signedBytes);
41 
42  isValid = ecdsaSignature.verify(signature);
43  } catch (GeneralSecurityException ex) {
44  throw new SignatureException(ex);
45  }
46 
47  return isValid;
48  }

◆ decodePublicKey()

PublicKey org.xdi.oxauth.crypto.signature.SHA256withECDSASignatureVerification.decodePublicKey ( byte []  encodedPublicKey) throws SignatureException
inline

org.xdi.oxauth.crypto.signature.SignatureVerificationを実装しています。

51  {
52  X9ECParameters curve = SECNamedCurves.getByName("secp256r1");
53  ECPoint point = curve.getCurve().decodePoint(encodedPublicKey);
54 
55  try {
56  return KeyFactory.getInstance("ECDSA").generatePublic(
57  new ECPublicKeySpec(point,
58  new ECParameterSpec(
59  curve.getCurve(),
60  curve.getG(),
61  curve.getN(),
62  curve.getH()
63  )
64  )
65  );
66  } catch (GeneralSecurityException ex) {
67  throw new SignatureException(ex);
68  }
69  }

◆ hash() [1/2]

byte [] org.xdi.oxauth.crypto.signature.SHA256withECDSASignatureVerification.hash ( byte []  bytes)
inline

org.xdi.oxauth.crypto.signature.SignatureVerificationを実装しています。

72  {
73  try {
74  return MessageDigest.getInstance("SHA-256").digest(bytes);
75  } catch (NoSuchAlgorithmException e) {
76  throw new RuntimeException(e);
77  }
78  }

◆ hash() [2/2]

byte [] org.xdi.oxauth.crypto.signature.SHA256withECDSASignatureVerification.hash ( String  str)
inline

org.xdi.oxauth.crypto.signature.SignatureVerificationを実装しています。

81  {
82  return hash(str.getBytes());
83  }
byte [] hash(byte[] bytes)
Definition: SHA256withECDSASignatureVerification.java:72

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