当前位置: 首页>>代码示例>>Java>>正文


Java Base64.decode方法代码示例

本文整理汇总了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));
}
 
开发者ID:jonathangerbaud,项目名称:KlyphMessenger,代码行数:32,代码来源:SASLXFacebookPlatformMechanism.java

示例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;
}
 
开发者ID:prive,项目名称:prive-android,代码行数:8,代码来源:OtrSmTest.java

示例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;
}
 
开发者ID:prive,项目名称:prive-android,代码行数:8,代码来源:OtrAndroidKeyManagerImpl.java

示例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));
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:54,代码来源:SASLXFacebookPlatformMechanism.java

示例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();
}
           	
           });
   }
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:61,代码来源:SASLFacebookConnect.java

示例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();
		}

	});
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:55,代码来源:SASLFacebookConnect.java

示例7: decode

import org.jivesoftware.smack.util.Base64; //导入方法依赖的package包/类
public String decode(String s) {
	return new String(Base64.decode(s));
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:4,代码来源:Base64Encoder.java

示例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));
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:54,代码来源:FacebookConnectSASLMechanism.java

示例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));
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:54,代码来源:FacebookConnectSASLMechanism.java

示例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));
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:54,代码来源:FacebookConnectSASLMechanism.java

示例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);
}
 
开发者ID:prive,项目名称:prive-android,代码行数:7,代码来源:AES_256_CBC.java

示例12: decode

import org.jivesoftware.smack.util.Base64; //导入方法依赖的package包/类
public String decode(String s) {
    return new String(Base64.decode(s));
}
 
开发者ID:jtietema,项目名称:telegraph,代码行数:4,代码来源:Base64Encoder.java

示例13: getData

import org.jivesoftware.smack.util.Base64; //导入方法依赖的package包/类
/**
    * Get the avatar data.
    *
    * @return the decoded data
    */
   public byte[] getData() {
return Base64.decode(mData);
   }
 
开发者ID:BoogieMAN2K,项目名称:Beem,代码行数:9,代码来源:AvatarExtension.java


注:本文中的org.jivesoftware.smack.util.Base64.decode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。