CalculateDHBasicAgreement() 공개 정적인 메소드

public static CalculateDHBasicAgreement ( DHPublicKeyParameters publicKey, DHPrivateKeyParameters privateKey ) : byte[]
publicKey DHPublicKeyParameters
privateKey DHPrivateKeyParameters
리턴 byte[]
예제 #1
0
        protected virtual byte[] GenerateOtherSecret(int pskLength)
        {
            if (this.mKeyExchange == KeyExchangeAlgorithm.DHE_PSK)
            {
                if (mDHAgreePrivateKey != null)
                {
                    return(TlsDHUtilities.CalculateDHBasicAgreement(mDHAgreePublicKey, mDHAgreePrivateKey));
                }

                throw new TlsFatalAlert(AlertDescription.internal_error);
            }

            if (this.mKeyExchange == KeyExchangeAlgorithm.ECDHE_PSK)
            {
                if (mECAgreePrivateKey != null)
                {
                    return(TlsEccUtilities.CalculateECDHBasicAgreement(mECAgreePublicKey, mECAgreePrivateKey));
                }

                throw new TlsFatalAlert(AlertDescription.internal_error);
            }

            if (this.mKeyExchange == KeyExchangeAlgorithm.RSA_PSK)
            {
                return(this.mPremasterSecret);
            }

            return(new byte[pskLength]);
        }
예제 #2
0
 protected virtual byte[] GenerateOtherSecret(int pskLength)
 {
     if (this.mKeyExchange == 14)
     {
         if (this.mDHAgreePrivateKey != null)
         {
             return(TlsDHUtilities.CalculateDHBasicAgreement(this.mDHAgreePublicKey, this.mDHAgreePrivateKey));
         }
         throw new TlsFatalAlert(80);
     }
     else if (this.mKeyExchange == 24)
     {
         if (this.mECAgreePrivateKey != null)
         {
             return(TlsEccUtilities.CalculateECDHBasicAgreement(this.mECAgreePublicKey, this.mECAgreePrivateKey));
         }
         throw new TlsFatalAlert(80);
     }
     else
     {
         if (this.mKeyExchange == 15)
         {
             return(this.mPremasterSecret);
         }
         return(new byte[pskLength]);
     }
 }
예제 #3
0
 public override byte[] GeneratePremasterSecret()
 {
     if (this.mAgreementCredentials != null)
     {
         return(this.mAgreementCredentials.GenerateAgreement(this.mDHAgreePublicKey));
     }
     if (this.mDHAgreePrivateKey == null)
     {
         throw new TlsFatalAlert(80);
     }
     return(TlsDHUtilities.CalculateDHBasicAgreement(this.mDHAgreePublicKey, this.mDHAgreePrivateKey));
 }
예제 #4
0
        public override byte[] GeneratePremasterSecret()
        {
            if (mAgreementCredentials != null)
            {
                return(mAgreementCredentials.GenerateAgreement(mDHAgreePublicKey));
            }

            if (mDHAgreePrivateKey != null)
            {
                return(TlsDHUtilities.CalculateDHBasicAgreement(mDHAgreePublicKey, mDHAgreePrivateKey));
            }

            throw new TlsFatalAlert(AlertDescription.internal_error);
        }
예제 #5
0
        protected virtual byte[] GenerateOtherSecret(int pskLength)
        {
            if (this.keyExchange == KeyExchangeAlgorithm.DHE_PSK)
            {
                return(TlsDHUtilities.CalculateDHBasicAgreement(dhAgreeServerPublicKey, dhAgreeClientPrivateKey));
            }

            if (this.keyExchange == KeyExchangeAlgorithm.RSA_PSK)
            {
                return(this.premasterSecret);
            }

            return(new byte[pskLength]);
        }
예제 #6
0
 protected virtual byte[] CalculateDHBasicAgreement(DHPublicKeyParameters publicKey,
                                                    DHPrivateKeyParameters privateKey)
 {
     return(TlsDHUtilities.CalculateDHBasicAgreement(publicKey, privateKey));
 }