public class Algorithms extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
$main(String[] args)
Describe
main method here. |
static String |
bytesToHex(byte[] buff) |
static byte[] |
digest(String id,
String secret,
String alg) |
static String |
generateDialbackKey(String originatingServer,
String receivingServer,
String secret,
String streamID)
Calculates dialback key as decribed in XEP-0185 version 1.0.
|
static String |
hexDigest(String id,
String secret,
String alg)
This method encodes data using digest algorithm described in
JEP-0078 documentation.
|
static String |
sha256(String data)
Calculates SHA-256 hash of given data.
|
public static final String hexDigest(String id, String secret, String alg) throws NoSuchAlgorithmException
String containing digest data which
can be compared with data sent by the user to authenticate him.id - a String value of some ID value like session ID to
concatenate with secret word.secret - a String value of a secret word shared between
entites.alg - a String value of algorithm name to use for
generating diffest message.String value digest message as defined.NoSuchAlgorithmException - if an error occurs during encoding
digest message.public static final byte[] digest(String id, String secret, String alg) throws NoSuchAlgorithmException
NoSuchAlgorithmExceptionpublic static final String bytesToHex(byte[] buff)
public static void $main(String[] args) throws Exception
main method here.args - a String[] valueExceptionpublic static String generateDialbackKey(String originatingServer, String receivingServer, String secret, String streamID)
Implemented algorithm (recomended in XEP-0185):
key = HMAC-SHA256
(
SHA256(Secret),
{
Receiving Server, ' ',
Originating Server, ' ',
Stream ID
}
)
originatingServer - the hostname of the Originating ServerreceivingServer - the hostname of the Receiving Serversecret - a secret known by the Authoritative Server's networkstreamID - the Stream ID generated by the Receiving ServerCopyright © 2022 "Tigase, Inc.". All rights reserved.