本文整理汇总了Java中org.jivesoftware.smack.util.Base64.decode方法的典型用法代码示例。如果您正苦于以下问题:Java Base64.decode方法的具体用法?Java Base64.decode怎么用?Java Base64.decode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smack.util.Base64
的用法示例。
在下文中一共展示了Base64.decode方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: challengeReceived
import org.jivesoftware.smack.util.Base64; //导入方法依赖的package包/类
@Override
public void challengeReceived(String challenge) throws IOException {
byte[] response = null;
if (challenge != null) {
String decodedChallenge = new String(Base64.decode(challenge));
Map<String, String> parameters = getQueryMap(decodedChallenge);
String version = "1.0";
String nonce = parameters.get("nonce");
String method = parameters.get("method");
String composedResponse =
"method=" + URLEncoder.encode(method, "utf-8") +
"&nonce=" + URLEncoder.encode(nonce, "utf-8") +
"&access_token=" + URLEncoder.encode(accessToken, "utf-8") +
"&api_key=" + URLEncoder.encode(apiKey, "utf-8") +
"&call_id=0" +
"&v=" + URLEncoder.encode(version, "utf-8");
response = composedResponse.getBytes();
}
String authenticationText = "";
if (response != null) {
authenticationText = Base64.encodeBytes(response);
}
// Send the authentication to the server
getSASLAuthentication().send(new Response(authenticationText));
}
示例2: getPropertyBytes
import org.jivesoftware.smack.util.Base64; //导入方法依赖的package包/类
public byte[] getPropertyBytes(String id) {
String value = properties.getProperty(id);
if (value != null)
return Base64.decode(value);
return null;
}
示例3: getPropertyBytes
import org.jivesoftware.smack.util.Base64; //导入方法依赖的package包/类
public byte[] getPropertyBytes(String id) {
String value = mProperties.getProperty(id);
if (value != null)
return Base64.decode(value);
return null;
}
示例4: challengeReceived
import org.jivesoftware.smack.util.Base64; //导入方法依赖的package包/类
@Override
public void challengeReceived(String challenge) throws IOException
{
byte[] response = null;
if (challenge != null)
{
String decodedChallenge = new String(Base64.decode(challenge));
Map<String, String> parameters = getQueryMap(decodedChallenge);
String version = "1.0";
String nonce = parameters.get("nonce");
String method = parameters.get("method");
long callId = new GregorianCalendar().getTimeInMillis();
String sig =
"api_key=" + apiKey + "call_id=" + callId + "method="
+ method + "nonce=" + nonce + "access_token="
+ sessionKey + "v=" + version;
try
{
sig = md5(sig);
} catch (NoSuchAlgorithmException e)
{
throw new IllegalStateException(e);
}
String composedResponse =
"api_key=" + URLEncoder.encode(apiKey, "utf-8")
+ "&call_id=" + callId + "&method="
+ URLEncoder.encode(method, "utf-8") + "&nonce="
+ URLEncoder.encode(nonce, "utf-8")
+ "&access_token="
+ URLEncoder.encode(sessionKey, "utf-8") + "&v="
+ URLEncoder.encode(version, "utf-8") + "&sig="
+ URLEncoder.encode(sig, "utf-8");
response = composedResponse.getBytes("utf-8");
}
String authenticationText = "";
if (response != null)
{
authenticationText =
Base64.encodeBytes(response, Base64.DONT_BREAK_LINES);
}
// Send the authentication to the server
getSASLAuthentication().send(new Response(authenticationText));
}
示例5: challengeReceived
import org.jivesoftware.smack.util.Base64; //导入方法依赖的package包/类
public void challengeReceived(String challenge) throws IOException {
// Build the challenge response stanza encoding the response text
final StringBuilder stanza = new StringBuilder();
byte response[] = null;
if (challenge != null) {
String decodedResponse = new String(Base64.decode(challenge));
Map<String, String> parameters = getQueryMap(decodedResponse);
String version = "1.0";
String nonce = parameters.get("nonce");
String method = parameters.get("method");
Long callId = new GregorianCalendar().getTimeInMillis()/1000;
String sig = "api_key="+apiKey
+"call_id="+callId
+"method="+method
+"nonce="+nonce
+"session_key="+sessionKey
+"v="+version
+sessionSecret;
try {
sig = MD5(sig);
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException(e);
}
String composedResponse = "api_key="+apiKey+"&"
+"call_id="+callId+"&"
+"method="+method+"&"
+"nonce="+nonce+"&"
+"session_key="+sessionKey+"&"
+"v="+version+"&"
+"sig="+sig;
response = composedResponse.getBytes();
}
String authenticationText="";
if (response != null) {
authenticationText = Base64.encodeBytes(response, Base64.DONT_BREAK_LINES);
}
stanza.append("<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">");
stanza.append(authenticationText);
stanza.append("</response>");
// Send the authentication to the server
getSASLAuthentication().send(new Packet(){
@Override
public String toXML() {
return stanza.toString();
}
});
}
示例6: challengeReceived
import org.jivesoftware.smack.util.Base64; //导入方法依赖的package包/类
public void challengeReceived(String challenge) throws IOException {
// Build the challenge response stanza encoding the response text
final StringBuilder stanza = new StringBuilder();
byte response[] = null;
if (challenge != null) {
String decodedResponse = new String(Base64.decode(challenge));
Map<String, String> parameters = getQueryMap(decodedResponse);
String version = "1.0";
String nonce = parameters.get("nonce");
String method = parameters.get("method");
Long callId = new GregorianCalendar().getTimeInMillis() / 1000;
String sig = "api_key=" + apiKey + "call_id=" + callId + "method="
+ method + "nonce=" + nonce + "session_key=" + sessionKey
+ "v=" + version + sessionSecret;
try {
sig = MD5(sig);
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException(e);
}
String composedResponse = "api_key=" + apiKey + "&" + "call_id="
+ callId + "&" + "method=" + method + "&" + "nonce="
+ nonce + "&" + "session_key=" + sessionKey + "&" + "v="
+ version + "&" + "sig=" + sig;
response = composedResponse.getBytes();
}
String authenticationText = "";
if (response != null) {
authenticationText = Base64.encodeBytes(response,
Base64.DONT_BREAK_LINES);
}
stanza.append("<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">");
stanza.append(authenticationText);
stanza.append("</response>");
// Send the authentication to the server
getSASLAuthentication().send(new Packet() {
@Override
public String toXML() {
return stanza.toString();
}
});
}
示例7: decode
import org.jivesoftware.smack.util.Base64; //导入方法依赖的package包/类
public String decode(String s) {
return new String(Base64.decode(s));
}
示例8: challengeReceived
import org.jivesoftware.smack.util.Base64; //导入方法依赖的package包/类
public void challengeReceived(String challenge) throws IOException {
// Build the challenge response stanza encoding the response text
StringBuilder stanza = new StringBuilder();
byte response[] = null;
if (challenge != null) {
String decodedResponse = new String(Base64.decode(challenge));
Map<String, String> parameters = getQueryMap(decodedResponse);
String version = "1.0";
String nonce = parameters.get("nonce");
String method = parameters.get("method");
Long callId = new GregorianCalendar().getTimeInMillis()/1000;
String sig = "api_key="+apiKey
+"call_id="+callId
+"method="+method
+"nonce="+nonce
+"access_token="+accessToken
+"v="+version
+appSecret;
try {
sig = MD5(sig);
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException(e);
}
String composedResponse = "api_key="+apiKey+"&"
+"call_id="+callId+"&"
+"method="+method+"&"
+"nonce="+nonce+"&"
+"access_token="+accessToken+"&"
+"v="+version+"&"
+"sig="+sig;
response = composedResponse.getBytes();
}
String authenticationText="";
if (response != null) {
authenticationText = Base64.encodeBytes(response, Base64.DONT_BREAK_LINES);
}
stanza.append("<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">");
stanza.append(authenticationText);
stanza.append("</response>");
// Send the authentication to the server
getSASLAuthentication().send(new Response(authenticationText));
}
示例9: challengeReceived
import org.jivesoftware.smack.util.Base64; //导入方法依赖的package包/类
public void challengeReceived(String challenge) throws IOException {
// Build the challenge response stanza encoding the response text
StringBuilder stanza = new StringBuilder();
byte response[] = null;
if (challenge != null) {
String decodedResponse = new String(Base64.decode(challenge));
Map<String, String> parameters = getQueryMap(decodedResponse);
String version = "1.0";
String nonce = parameters.get("nonce");
String method = parameters.get("method");
Long callId = new GregorianCalendar().getTimeInMillis()/1000;
String sig = "api_key="+apiKey
+"call_id="+callId
+"method="+method
+"nonce="+nonce
+"session_key="+sessionKey
+"v="+version
+appSecret;
try {
sig = MD5(sig);
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException(e);
}
String composedResponse = "api_key="+apiKey+"&"
+"call_id="+callId+"&"
+"method="+method+"&"
+"nonce="+nonce+"&"
+"session_key="+sessionKey+"&"
+"v="+version+"&"
+"sig="+sig;
response = composedResponse.getBytes();
}
String authenticationText="";
if (response != null) {
authenticationText = Base64.encodeBytes(response, Base64.DONT_BREAK_LINES);
}
stanza.append("<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">");
stanza.append(authenticationText);
stanza.append("</response>");
// Send the authentication to the server
getSASLAuthentication().send(new Response(authenticationText));
}
示例10: challengeReceived
import org.jivesoftware.smack.util.Base64; //导入方法依赖的package包/类
public void challengeReceived(String challenge) throws IOException {
// Build the challenge response stanza encoding the response text
StringBuilder stanza = new StringBuilder();
byte response[] = null;
if (challenge != null) {
String decodedResponse = new String(Base64.decode(challenge));
Map<String, String> parameters = getQueryMap(decodedResponse);
String version = "1.0";
String nonce = parameters.get("nonce");
String method = parameters.get("method");
Long callId = new GregorianCalendar().getTimeInMillis()/1000;
String sig = "api_key="+apiKey
+"call_id="+callId
+"method="+method
+"nonce="+nonce
+"access_token="+accessToken
+"v="+version
+appSecret;
try {
sig = MD5(sig);
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException(e);
}
String composedResponse = "api_key="+apiKey+"&"
+"call_id="+callId+"&"
+"method="+method+"&"
+"nonce="+nonce+"&"
+"access_token="+accessToken+"&"
+"v="+version+"&"
+"sig="+sig;
response = composedResponse.getBytes();
}
String authenticationText="";
if (response != null) {
authenticationText = Base64.encodeBytes(response, Base64.DONT_BREAK_LINES);
}
stanza.append("<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">");
stanza.append(authenticationText);
stanza.append("</response>");
// Send the authentication to the server
getSASLAuthentication().send(new Response(authenticationText));
}
示例11: decryptAscii
import org.jivesoftware.smack.util.Base64; //导入方法依赖的package包/类
public static String decryptAscii(File f, String password) throws IOException {
byte[] headerSaltAndCipherText = null;
String raw = FileUtils.readFileToString(f);
headerSaltAndCipherText = Base64.decode(raw);
return decrypt(headerSaltAndCipherText, password);
}
示例12: decode
import org.jivesoftware.smack.util.Base64; //导入方法依赖的package包/类
public String decode(String s) {
return new String(Base64.decode(s));
}
示例13: getData
import org.jivesoftware.smack.util.Base64; //导入方法依赖的package包/类
/**
* Get the avatar data.
*
* @return the decoded data
*/
public byte[] getData() {
return Base64.decode(mData);
}