gluu
公開メンバ関数 | 限定公開メンバ関数 | 非公開変数類 | 全メンバ一覧
org.xdi.oxauth.model.jwe.AbstractJweEncrypter クラスabstract
org.xdi.oxauth.model.jwe.AbstractJweEncrypter の継承関係図
Inheritance graph
org.xdi.oxauth.model.jwe.AbstractJweEncrypter 連携図
Collaboration graph

公開メンバ関数

KeyEncryptionAlgorithm getKeyEncryptionAlgorithm ()
 
BlockEncryptionAlgorithm getBlockEncryptionAlgorithm ()
 
Jwe encrypt (Jwe jwe) throws InvalidJweException
 
abstract String generateEncryptedKey (byte[] contentMasterKey) throws InvalidJweException
 
abstract Pair< String, String > generateCipherTextAndIntegrityValue (byte[] contentMasterKey, byte[] initializationVector, byte[] additionalAuthenticatedData, byte[] plainText) throws InvalidJweException
 

限定公開メンバ関数

 AbstractJweEncrypter (KeyEncryptionAlgorithm keyEncryptionAlgorithm, BlockEncryptionAlgorithm blockEncryptionAlgorithm)
 

非公開変数類

KeyEncryptionAlgorithm keyEncryptionAlgorithm
 
BlockEncryptionAlgorithm blockEncryptionAlgorithm
 

詳解

著者
Javier Rojas Blum
バージョン
July 31, 2016

構築子と解体子

◆ AbstractJweEncrypter()

org.xdi.oxauth.model.jwe.AbstractJweEncrypter.AbstractJweEncrypter ( KeyEncryptionAlgorithm  keyEncryptionAlgorithm,
BlockEncryptionAlgorithm  blockEncryptionAlgorithm 
)
inlineprotected
29  {
32  }
KeyEncryptionAlgorithm keyEncryptionAlgorithm
Definition: AbstractJweEncrypter.java:26
BlockEncryptionAlgorithm blockEncryptionAlgorithm
Definition: AbstractJweEncrypter.java:27

関数詳解

◆ encrypt()

Jwe org.xdi.oxauth.model.jwe.AbstractJweEncrypter.encrypt ( Jwe  jwe) throws InvalidJweException
inline

org.xdi.oxauth.model.jwe.JweEncrypterを実装しています。

43  {
44  try {
45  jwe.setEncodedHeader(jwe.getHeader().toBase64JsonObject());
46 
47  byte[] contentMasterKey = new byte[blockEncryptionAlgorithm.getCmkLength() / 8];
48  SecureRandom random = new SecureRandom();
49  random.nextBytes(contentMasterKey);
50 
51  String encodedEncryptedKey = generateEncryptedKey(contentMasterKey);
52  jwe.setEncodedEncryptedKey(encodedEncryptedKey);
53 
54  byte[] initializationVector = new byte[blockEncryptionAlgorithm.getInitVectorLength() / 8];
55  random.nextBytes(initializationVector);
56  String encodedInitializationVector = Base64Util.base64urlencode(initializationVector);
57  jwe.setEncodedInitializationVector(encodedInitializationVector);
58 
59  Pair<String, String> result = generateCipherTextAndIntegrityValue(contentMasterKey, initializationVector,
60  jwe.getAdditionalAuthenticatedData().getBytes(Util.UTF8_STRING_ENCODING),
61  jwe.getClaims().toBase64JsonObject().getBytes(Util.UTF8_STRING_ENCODING));
62  jwe.setEncodedCiphertext(result.getFirst());
63  jwe.setEncodedIntegrityValue(result.getSecond());
64 
65  return jwe;
66  } catch (InvalidJwtException e) {
67  throw new InvalidJweException(e);
68  } catch (UnsupportedEncodingException e) {
69  throw new InvalidJweException(e);
70  }
71  }
int getInitVectorLength()
Definition: BlockEncryptionAlgorithm.java:75
abstract String generateEncryptedKey(byte[] contentMasterKey)
abstract Pair< String, String > generateCipherTextAndIntegrityValue(byte[] contentMasterKey, byte[] initializationVector, byte[] additionalAuthenticatedData, byte[] plainText)
int getCmkLength()
Definition: BlockEncryptionAlgorithm.java:71
BlockEncryptionAlgorithm blockEncryptionAlgorithm
Definition: AbstractJweEncrypter.java:27

◆ generateCipherTextAndIntegrityValue()

abstract Pair<String, String> org.xdi.oxauth.model.jwe.AbstractJweEncrypter.generateCipherTextAndIntegrityValue ( byte []  contentMasterKey,
byte []  initializationVector,
byte []  additionalAuthenticatedData,
byte []  plainText 
) throws InvalidJweException
abstract

◆ generateEncryptedKey()

abstract String org.xdi.oxauth.model.jwe.AbstractJweEncrypter.generateEncryptedKey ( byte []  contentMasterKey) throws InvalidJweException
abstract

◆ getBlockEncryptionAlgorithm()

BlockEncryptionAlgorithm org.xdi.oxauth.model.jwe.AbstractJweEncrypter.getBlockEncryptionAlgorithm ( )
inline
38  {
40  }
BlockEncryptionAlgorithm blockEncryptionAlgorithm
Definition: AbstractJweEncrypter.java:27

◆ getKeyEncryptionAlgorithm()

KeyEncryptionAlgorithm org.xdi.oxauth.model.jwe.AbstractJweEncrypter.getKeyEncryptionAlgorithm ( )
inline
34  {
36  }
KeyEncryptionAlgorithm keyEncryptionAlgorithm
Definition: AbstractJweEncrypter.java:26

メンバ詳解

◆ blockEncryptionAlgorithm

BlockEncryptionAlgorithm org.xdi.oxauth.model.jwe.AbstractJweEncrypter.blockEncryptionAlgorithm
private

◆ keyEncryptionAlgorithm

KeyEncryptionAlgorithm org.xdi.oxauth.model.jwe.AbstractJweEncrypter.keyEncryptionAlgorithm
private

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