Java UTF8 Encode encodeSignatureUtf8(byte[] sig)

Here you can find the source of encodeSignatureUtf8(byte[] sig)

Description

Encodes the signature using charset UTF-8.

License

Open Source License

Parameter

Parameter Description
sig the HMAC-SHA256 encrypted, Base64-encoded signature.

Return

the signature encoded using charset UTF-8.

Declaration

public static String encodeSignatureUtf8(byte[] sig) 

Method Source Code

//package com.java2s;
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

public class Main {
    /** The charset used for the raw and hashed signature. */
    public static final Charset SIGNATURE_CHARSET = StandardCharsets.UTF_8;

    /**//from w ww . j a v a 2 s  .  co  m
     * Encodes the signature using charset UTF-8.
     *
     * @param sig the HMAC-SHA256 encrypted, Base64-encoded signature.
     *
     * @return the signature encoded using charset UTF-8.
     */
    public static String encodeSignatureUtf8(byte[] sig) {
        // Codes_SRS_SIGNATUREHELPER_11_010: [The function shall encode the signature using charset UTF-8.]
        return new String(sig, SIGNATURE_CHARSET);
    }
}

Related

  1. encodeStringUtf8(String text)
  2. encodeToUTF8(String str)
  3. encodeUtf8(byte[] bytes)
  4. encodeUTF8(byte[] bytes)