/** * Sets the digest value using a connection ID and password. Password * digests offer a more secure alternative for authentication compared to * plain text. The digest is the hex-encoded SHA-1 hash of the connection ID * plus the user's password. If the digest and password are set, digest * authentication will be used. If only one value is set, the respective * authentication mode will be used. * * @param connectionID the connection ID. * @param password the password. * @see org.jivesoftware.smack.Connection#getConnectionID() */ public void setDigest(String connectionID, String password) { this.digest = StringUtils.hash(connectionID + password); }
/** * Sets the digest value using a connection ID and password. Password * digests offer a more secure alternative for authentication compared to * plain text. The digest is the hex-encoded SHA-1 hash of the connection ID * plus the user's password. If the digest and password are set, digest * authentication will be used. If only one value is set, the respective * authentication mode will be used. * * @param connectionID the connection ID. * @param password the password. * @see org.jivesoftware.smack.Connection#getConnectionID() */ public void setDigest(String connectionID, String password) { this.digest = StringUtils.hash(connectionID + password); }
/** * Sets the digest value using a connection ID and password. Password * digests offer a more secure alternative for authentication compared to * plain text. The digest is the hex-encoded SHA-1 hash of the connection ID * plus the user's password. If the digest and password are set, digest * authentication will be used. If only one value is set, the respective * authentication mode will be used. * * @param connectionID the connection ID. * @param password the password. * @see org.jivesoftware.smack.XMPPConnection#getConnectionID() */ public void setDigest(String connectionID, String password) { this.digest = StringUtils.hash(connectionID + password); }
/** * Sets the digest value using a connection ID and password. Password * digests offer a more secure alternative for authentication compared to * plain text. The digest is the hex-encoded SHA-1 hash of the connection ID * plus the user's password. If the digest and password are set, digest * authentication will be used. If only one value is set, the respective * authentication mode will be used. * * @param connectionID the connection ID. * @param password the password. * @see org.jivesoftware.smack.Connection#getConnectionID() */ public void setDigest(String connectionID, String password) { this.digest = StringUtils.hash(connectionID + password); }
/** * Returns a SHA-1 digest of the given parameters as specified in <a * href="http://xmpp.org/extensions/xep-0065.html#impl-socks5">XEP-0065</a>. * * @param sessionID for the SOCKS5 Bytestream * @param initiatorJID JID of the initiator of a SOCKS5 Bytestream * @param targetJID JID of the target of a SOCKS5 Bytestream * @return SHA-1 digest of the given parameters */ public static String createDigest(String sessionID, String initiatorJID, String targetJID) { StringBuilder b = new StringBuilder(); b.append(sessionID).append(initiatorJID).append(targetJID); return StringUtils.hash(b.toString()); }
/** * Returns a SHA-1 digest of the given parameters as specified in <a * href="http://xmpp.org/extensions/xep-0065.html#impl-socks5">XEP-0065</a>. * * @param sessionID for the SOCKS5 Bytestream * @param initiatorJID JID of the initiator of a SOCKS5 Bytestream * @param targetJID JID of the target of a SOCKS5 Bytestream * @return SHA-1 digest of the given parameters */ public static String createDigest(String sessionID, String initiatorJID, String targetJID) { StringBuilder b = new StringBuilder(); b.append(sessionID).append(initiatorJID).append(targetJID); return StringUtils.hash(b.toString()); }
/** * Returns a SHA-1 digest of the given parameters as specified in <a * href="http://xmpp.org/extensions/xep-0065.html#impl-socks5">XEP-0065</a>. * * @param sessionID for the SOCKS5 Bytestream * @param initiatorJID JID of the initiator of a SOCKS5 Bytestream * @param targetJID JID of the target of a SOCKS5 Bytestream * @return SHA-1 digest of the given parameters */ public static String createDigest(String sessionID, String initiatorJID, String targetJID) { StringBuilder b = new StringBuilder(); b.append(sessionID).append(initiatorJID).append(targetJID); return StringUtils.hash(b.toString()); }
throw new XMPPException(e.getMessage()); connection.writer.write("<handshake>" + StringUtils.hash(connectionID+ ((ComponentXMPPConnection) connection).componentSecret) + "</handshake>"); connection.writer.flush();
/** * Creates the digest needed for a byte stream. It is the SHA1(sessionID + * initiator + target). * * @param sessionID The sessionID of the stream negotiation * @param initiator The inititator of the stream negotiation * @param target The target of the stream negotiation * @return SHA-1 hash of the three parameters */ private String createDigest(final String sessionID, final String initiator, final String target) { return StringUtils.hash(sessionID + StringUtils.parseName(initiator) + "@" + StringUtils.parseServer(initiator) + "/" + StringUtils.parseResource(initiator) + StringUtils.parseName(target) + "@" + StringUtils.parseServer(target) + "/" + StringUtils.parseResource(target)); }