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

静的公開メンバ関数

static String base64urlencode (byte[] arg)
 
static byte [] base64urldecode (String arg) throws IllegalArgumentException
 
static String base64urldecodeToString (String arg) throws IllegalArgumentException, UnsupportedEncodingException
 
static String removePadding (String base64UrlEncoded)
 
static String base64urlencodeUnsignedBigInt (BigInteger bigInteger)
 
static byte [] unsignedToBytes (int[] plaintextUnsignedBytes)
 

静的非公開変数類

static final Logger log = Logger.getLogger(Base64Util.class)
 

詳解

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

関数詳解

◆ base64urldecode()

static byte [] org.xdi.oxauth.model.util.Base64Util.base64urldecode ( String  arg) throws IllegalArgumentException
inlinestatic
31  {
32  String s = removePadding(arg);
33  return Base64.decodeBase64(s); // Standard base64 decoder
34  }
static String removePadding(String base64UrlEncoded)
Definition: Base64Util.java:41

◆ base64urldecodeToString()

static String org.xdi.oxauth.model.util.Base64Util.base64urldecodeToString ( String  arg) throws IllegalArgumentException, UnsupportedEncodingException
inlinestatic
36  {
37  byte[] decoded = base64urldecode(arg);
38  return new String(decoded, "UTF-8");
39  }
static byte [] base64urldecode(String arg)
Definition: Base64Util.java:31

◆ base64urlencode()

static String org.xdi.oxauth.model.util.Base64Util.base64urlencode ( byte []  arg)
inlinestatic
23  {
24  String s = Base64.encodeBase64String(arg); // Standard base64 encoder
25  s = s.split("=")[0]; // Remove any trailing '='s
26  s = s.replace('+', '-'); // 62nd char of encoding
27  s = s.replace('/', '_'); // 63rd char of encoding
28  return s;
29  }

◆ base64urlencodeUnsignedBigInt()

static String org.xdi.oxauth.model.util.Base64Util.base64urlencodeUnsignedBigInt ( BigInteger  bigInteger)
inlinestatic
61  {
62  byte[] array = bigInteger.toByteArray();
63  if (array[0] == 0) {
64  byte[] tmp = new byte[array.length - 1];
65  System.arraycopy(array, 1, tmp, 0, tmp.length);
66  array = tmp;
67  }
68 
69  return Base64Util.base64urlencode(array);
70  }

◆ removePadding()

static String org.xdi.oxauth.model.util.Base64Util.removePadding ( String  base64UrlEncoded)
inlinestatic
41  {
42  String s = base64UrlEncoded;
43  s = s.replace('-', '+'); // 62nd char of encoding
44  s = s.replace('_', '/'); // 63rd char of encoding
45  switch (s.length() % 4) // Pad with trailing '='s
46  {
47  case 0:
48  break; // No pad chars in this case
49  case 2:
50  s += "==";
51  break; // Two pad chars
52  case 3:
53  s += "=";
54  break; // One pad char
55  default:
56  throw new IllegalArgumentException("Illegal base64url string.");
57  }
58  return s;
59  }

◆ unsignedToBytes()

static byte [] org.xdi.oxauth.model.util.Base64Util.unsignedToBytes ( int []  plaintextUnsignedBytes)
inlinestatic
72  {
73  byte[] bytes = new byte[plaintextUnsignedBytes.length];
74 
75  for (int i = 0; i < plaintextUnsignedBytes.length; i++) {
76  bytes[i] = (byte) plaintextUnsignedBytes[i];
77  }
78 
79  return bytes;
80  }

メンバ詳解

◆ log

final Logger org.xdi.oxauth.model.util.Base64Util.log = Logger.getLogger(Base64Util.class)
staticprivate

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