示例#1
0
        /**
         * Parse a {@link ServerSRPParams} from an {@link InputStream}.
         *
         * @param input
         *            the {@link InputStream} to parse from.
         * @return a {@link ServerSRPParams} object.
         * @throws IOException
         */
        public static ServerSrpParams Parse(Stream input)
        {
            BigInteger N = TlsSrpUtilities.ReadSrpParameter(input);
            BigInteger g = TlsSrpUtilities.ReadSrpParameter(input);

            byte[]     s = TlsUtilities.ReadOpaque8(input);
            BigInteger B = TlsSrpUtilities.ReadSrpParameter(input);

            return(new ServerSrpParams(N, g, s, B));
        }
示例#2
0
        public override void ProcessClientKeyExchange(Stream input)
        {
            /*
             * RFC 5054 2.5.4: The server MUST abort the handshake with an "illegal_parameter" alert if
             * A % N = 0.
             */
            try
            {
                this.mSrpPeerCredentials = Srp6Utilities.ValidatePublicValue(mSrpGroup.N, TlsSrpUtilities.ReadSrpParameter(input));
            }
            catch (CryptoException e)
            {
                throw new TlsFatalAlert(AlertDescription.illegal_parameter, e);
            }

            mContext.SecurityParameters.srpIdentity = Arrays.Clone(mIdentity);
        }