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