コード例 #1
0
ファイル: SrpTlsClient.cs プロジェクト: 5l1v3r1/Asteroid-1
        public override IDictionary GetClientExtensions()
        {
            IDictionary clientExtensions = TlsExtensionsUtilities.EnsureExtensionsInitialised(base.GetClientExtensions());

            TlsSrpUtilities.AddSrpExtension(clientExtensions, this.mIdentity);
            return(clientExtensions);
        }
コード例 #2
0
 /**
  * Encode this {@link ServerSRPParams} to an {@link OutputStream}.
  *
  * @param output
  *            the {@link OutputStream} to encode to.
  * @throws IOException
  */
 public virtual void Encode(Stream output)
 {
     TlsSrpUtilities.WriteSrpParameter(m_N, output);
     TlsSrpUtilities.WriteSrpParameter(m_g, output);
     TlsUtilities.WriteOpaque8(m_s, output);
     TlsSrpUtilities.WriteSrpParameter(m_B, output);
 }
コード例 #3
0
        public override void GenerateClientKeyExchange(Stream output)
        {
            BigInteger A = mSrpClient.GenerateClientCredentials(mSrpSalt, mIdentity, mPassword);

            TlsSrpUtilities.WriteSrpParameter(A, output);

            mContext.SecurityParameters.srpIdentity = Arrays.Clone(mIdentity);
        }
コード例 #4
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));
        }
コード例 #5
0
ファイル: SrpTlsServer.cs プロジェクト: 5l1v3r1/Asteroid-1
        public override int GetSelectedCipherSuite()
        {
            int cipherSuite = base.GetSelectedCipherSuite();

            if (TlsSrpUtilities.IsSrpCipherSuite(cipherSuite))
            {
                if (mSrpIdentity != null)
                {
                    this.mLoginParameters = mSrpIdentityManager.GetLoginParameters(mSrpIdentity);
                }

                if (mLoginParameters == null)
                {
                    throw new TlsFatalAlert(AlertDescription.unknown_psk_identity);
                }
            }

            return(cipherSuite);
        }
コード例 #6
0
ファイル: SrpTlsServer.cs プロジェクト: 5l1v3r1/Asteroid-1
        public override void ProcessClientExtensions(IDictionary clientExtensions)
        {
            base.ProcessClientExtensions(clientExtensions);

            this.mSrpIdentity = TlsSrpUtilities.GetSrpExtension(clientExtensions);
        }
コード例 #7
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);
        }