List of usage examples for org.apache.commons.codec.binary Base64 encodeBase64String
public static String encodeBase64String(final byte[] binaryData)
From source file:com.laudandjolynn.avf.utils.SecurityCoder.java
/** * base64?/* w w w.j ava2 s . co m*/ * * @param data * @return */ public static String base64Encoder(byte[] data) { return Base64.encodeBase64String(data); }
From source file:com.spectralogic.ds3client.models.Checksum.java
public static Checksum value(final byte[] hash) { final String hashStr = Base64.encodeBase64String(hash); return new Value(hashStr); }
From source file:eu.freme.broker.security.tools.PasswordHasher.java
public static String getSaltedHash(String password) throws Exception { byte[] salt = SecureRandom.getInstance("SHA1PRNG").generateSeed(saltLen); return Base64.encodeBase64String(salt) + "$" + hash(password, salt); }
From source file:apm.common.utils.Encodes.java
/** * Base64?. */ public static String encodeBase64(byte[] input) { return Base64.encodeBase64String(input); }
From source file:com.aliyun.openservices.tablestore.hadoop.Utils.java
static String serialize(Writable w) { ByteArrayOutputStream os = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(os); try {/*from ww w. java2 s . co m*/ w.write(out); out.close(); } catch (IOException ex) { // intend to ignore } byte[] buf = os.toByteArray(); return Base64.encodeBase64String(buf); }
From source file:net.lukecollins.dev.github.HttpUtils.java
/** * Get Response for Service./*from w w w . ja v a 2 s. c om*/ * @param service servicename * @return returns HttpResponse of Http GET */ public static HttpResponse getRequest(String service) { HttpClient httpClient = HttpClientBuilder.create().build(); HttpGet httpGet = new HttpGet(GhatConstantsUtil.URL + service); //Add token to header String token = GhatConstantsUtil.APIKEY + ":x-oauth-basic"; String authString = null; try { authString = "Basic " + Base64.encodeBase64String(token.getBytes("UTF-8")); } catch (UnsupportedEncodingException exp) { log.error(LOG_CONTEXT, exp); } httpGet.addHeader("Authorization", authString); HttpResponse response = null; try { response = httpClient.execute(httpGet); } catch (IOException exp) { log.error(LOG_CONTEXT, exp); } return response; }
From source file:com.google.nigori.server.appengine.Lookup.java
public static Key makeKey(AEUser user, byte[] key) { return KeyFactory.createKey( KeyFactory.createKey(user.getKey(), AppEngineDatabase.STORE, AppEngineDatabase.STORE), Lookup.class.getSimpleName(), Base64.encodeBase64String(key)); }
From source file:net.netdedicated.license.BasicCredentials.java
String toBase64() throws IOException { return Base64.encodeBase64String((username + ":" + password).getBytes()).trim(); }
From source file:com.contentful.vault.compiler.SqliteUtils.java
static String hashForId(String id) { return Base64.encodeBase64String(id.getBytes()).replaceAll("=", "").toLowerCase(); }
From source file:com.spectralogic.ds3client.models.ChecksumType.java
public static ChecksumType value(final byte[] hash) { final String hashStr = Base64.encodeBase64String(hash); return new Value(hashStr); }