github.com/pion/dtls/v2@v2.2.12/internal/ciphersuite/tls_ecdhe_ecdsa_with_aes_256_gcm_sha384.go (about)

     1  // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
     2  // SPDX-License-Identifier: MIT
     3  
     4  package ciphersuite
     5  
     6  import (
     7  	"crypto/sha512"
     8  	"hash"
     9  )
    10  
    11  // TLSEcdheEcdsaWithAes256GcmSha384  represents a TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 CipherSuite
    12  type TLSEcdheEcdsaWithAes256GcmSha384 struct {
    13  	TLSEcdheEcdsaWithAes128GcmSha256
    14  }
    15  
    16  // ID returns the ID of the CipherSuite
    17  func (c *TLSEcdheEcdsaWithAes256GcmSha384) ID() ID {
    18  	return TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
    19  }
    20  
    21  func (c *TLSEcdheEcdsaWithAes256GcmSha384) String() string {
    22  	return "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"
    23  }
    24  
    25  // HashFunc returns the hashing func for this CipherSuite
    26  func (c *TLSEcdheEcdsaWithAes256GcmSha384) HashFunc() func() hash.Hash {
    27  	return sha512.New384
    28  }
    29  
    30  // Init initializes the internal Cipher with keying material
    31  func (c *TLSEcdheEcdsaWithAes256GcmSha384) Init(masterSecret, clientRandom, serverRandom []byte, isClient bool) error {
    32  	const (
    33  		prfMacLen = 0
    34  		prfKeyLen = 32
    35  		prfIvLen  = 4
    36  	)
    37  
    38  	return c.init(masterSecret, clientRandom, serverRandom, isClient, prfMacLen, prfKeyLen, prfIvLen, c.HashFunc())
    39  }