Example usage for org.apache.commons.net.util Base64 encodeBase64URLSafeString

List of usage examples for org.apache.commons.net.util Base64 encodeBase64URLSafeString

Introduction

In this page you can find the example usage for org.apache.commons.net.util Base64 encodeBase64URLSafeString.

Prototype

public static String encodeBase64URLSafeString(byte[] binaryData) 

Source Link

Document

Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the output.

Usage

From source file:eagle.common.EagleBase64Wrapper.java

public static String encodeByteArray2URLSafeString(byte[] bytes) {
    return Base64.encodeBase64URLSafeString(bytes);
}

From source file:com.astamuse.asta4d.web.util.SecureIdGenerator.java

public static String createEncryptedURLSafeId() {
    try {//from  w ww .j a  v  a  2  s  .co m
        byte[] idBytes = IdGenerator.createIdBytes();

        ByteBuffer bb = ByteBuffer.allocate(idBytes.length + 4);
        bb.put(idBytes);

        // add random salt
        bb.putInt(sr.nextInt());

        MessageDigest crypt = MessageDigest.getInstance("SHA-1");
        return Base64.encodeBase64URLSafeString(crypt.digest(bb.array()));

    } catch (NoSuchAlgorithmException e) {
        // impossible
        throw new RuntimeException(e);
    }
}

From source file:costumetrade.user.login.BasicAuthenticateInterceptor.java

private static String generateKey(String account, String password) {

    return Base64.encodeBase64URLSafeString((account + ":" + password).getBytes(StandardCharsets.UTF_8));
}

From source file:Comman.Tool.java

/**
 * Encodes the byte array into base64 string
 *
 * @param imageByteArray - byte array//from w w w .  jav a  2s  . c om
 * @return String a {@link java.lang.String}
 */
public static String encodeImage(byte[] imageByteArray) {
    return Base64.encodeBase64URLSafeString(imageByteArray);
}