aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp/src/main/java/com/juick/components/s2s/util/DialbackUtils.java
blob: 980c2d6a8a5bb2f2b6780aef1f8e80293d861d0c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package com.juick.components.s2s.util;

import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.codec.digest.HmacUtils;

/**
 * Created by vitalyster on 05.12.2016.
 */
public class DialbackUtils {
    private DialbackUtils() {
        throw new IllegalStateException();
    }

    public static String generateDialbackKey(String secret, String to, String from, String id) {
        return HmacUtils.hmacSha256Hex(DigestUtils.sha256(secret),
                (to + " " + from + " " + id).getBytes());
    }
}