001package com.bitbucket.thinbus.srp6.js;
002
003import com.nimbusds.srp6.SRP6CryptoParams;
004
005/**
006 * Wrapper of a server session matching the Javascript client session
007 * SRP6JavascriptClientSession_N1024_SHA256. BigInteger values are communicated
008 * as hex strings. Hashing is done as string concat of hex numbers. Does not
009 * include any session timeout logic on the assumption that can be handled by
010 * web server session logic.
011 * <p>
012 * Specification RFC 2945.
013 * 
014 * @author Simon Massey
015 */
016public class SRP6JavascriptServerSessionSHA256 extends SRP6JavascriptServerSession {
017
018        public static final String SHA_256 = "SHA-256";
019
020        /**
021         * This must match the expected character length of the specified algorithm
022         * i.e. SHA-256 is 64
023         */
024        public static int HASH_HEX_LENGTH = 64;
025
026        /**
027         * Create a SHA-256 server session compatible with a JavaScript client
028         * session.
029         * 
030         * You can generate your own with openssl see {@link OpenSSLCryptoConfig}
031         * 
032         * @param N
033         *            The large safe prime in radix10
034         * @param g
035         *            The safe prime generator in radix10
036         */
037        public SRP6JavascriptServerSessionSHA256(String N, String g) {
038                super(new SRP6CryptoParams(fromDecimal(N), fromDecimal(g), SHA_256));
039        }
040}