Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for NewPublicKey (0.17 sec)

  1. test/fixedbugs/issue52193.go

    	if err != nil {
    		return nil, err
    	}
    
    	peerPublic, err := p256.NewPublicKey(peerShare) // ERROR "devirtualizing p256.NewPublicKey" "inlining call to ecdh.*NewPublicKey"
    	if err != nil {
    		return nil, err
    	}
    
    	return ourKey.ECDH(peerPublic)
    }
    
    // Test that inlining doesn't break if devirtualization exposes a new
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 09 17:21:38 UTC 2024
    - 1.2K bytes
    - Viewed (0)
  2. src/crypto/ecdh/ecdh_test.go

    		aliceKey, err := curve.GenerateKey(rand.Reader)
    		if err != nil {
    			t.Fatal(err)
    		}
    		bobKey, err := curve.GenerateKey(rand.Reader)
    		if err != nil {
    			t.Fatal(err)
    		}
    
    		alicePubKey, err := curve.NewPublicKey(aliceKey.PublicKey().Bytes())
    		if err != nil {
    			t.Error(err)
    		}
    		if !bytes.Equal(aliceKey.PublicKey().Bytes(), alicePubKey.Bytes()) {
    			t.Error("encoded and decoded public keys are different")
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 27 18:23:49 UTC 2024
    - 18K bytes
    - Viewed (0)
  3. src/crypto/ecdh/ecdh.go

    	// private key is also rejected, as the encoding of the corresponding public
    	// key would be irregular.
    	//
    	// For X25519, this only checks the scalar length.
    	NewPrivateKey(key []byte) (*PrivateKey, error)
    
    	// NewPublicKey checks that key is valid and returns a PublicKey.
    	//
    	// For NIST curves, this decodes an uncompressed point according to SEC 1,
    	// Version 2.0, Section 2.3.4. Compressed encodings and the point at
    	// infinity are rejected.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 17:09:47 UTC 2023
    - 6.4K bytes
    - Viewed (0)
  4. src/crypto/ecdh/x25519.go

    		curve:     key.curve,
    		publicKey: make([]byte, x25519PublicKeySize),
    	}
    	x25519Basepoint := [32]byte{9}
    	x25519ScalarMult(k.publicKey, key.privateKey, x25519Basepoint[:])
    	return k
    }
    
    func (c *x25519Curve) NewPublicKey(key []byte) (*PublicKey, error) {
    	if len(key) != x25519PublicKeySize {
    		return nil, errors.New("crypto/ecdh: invalid public key")
    	}
    	return &PublicKey{
    		curve:     c,
    		publicKey: append([]byte{}, key...),
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 17:09:47 UTC 2023
    - 3.1K bytes
    - Viewed (0)
  5. src/crypto/ecdh/nist.go

    		_, borrow = bits.Sub64(limbA, limbB, borrow)
    	}
    
    	// If there is a borrow at the end of the operation, then a < b.
    	return borrow == 1
    }
    
    func (c *nistCurve[Point]) NewPublicKey(key []byte) (*PublicKey, error) {
    	// Reject the point at infinity and compressed encodings.
    	if len(key) == 0 || key[0] != 4 {
    		return nil, errors.New("crypto/ecdh: invalid public key")
    	}
    	k := &PublicKey{
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 18:57:38 UTC 2024
    - 8.1K bytes
    - Viewed (0)
  6. src/crypto/elliptic/elliptic.go

    	Params() *CurveParams
    
    	// IsOnCurve reports whether the given (x,y) lies on the curve.
    	//
    	// Deprecated: this is a low-level unsafe API. For ECDH, use the crypto/ecdh
    	// package. The NewPublicKey methods of NIST curves in crypto/ecdh accept
    	// the same encoding as the Unmarshal function, and perform on-curve checks.
    	IsOnCurve(x, y *big.Int) bool
    
    	// Add returns the sum of (x1,y1) and (x2,y2).
    	//
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 17:09:47 UTC 2023
    - 9K bytes
    - Viewed (0)
  7. src/crypto/tls/key_agreement.go

    	if len(ckx.ciphertext) == 0 || int(ckx.ciphertext[0]) != len(ckx.ciphertext)-1 {
    		return nil, errClientKeyExchange
    	}
    
    	peerKey, err := ka.key.Curve().NewPublicKey(ckx.ciphertext[1:])
    	if err != nil {
    		return nil, errClientKeyExchange
    	}
    	preMasterSecret, err := ka.key.ECDH(peerKey)
    	if err != nil {
    		return nil, errClientKeyExchange
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 14:56:25 UTC 2024
    - 11.8K bytes
    - Viewed (0)
  8. src/crypto/internal/hpke/hpke.go

    }
    
    func ParseHPKEPublicKey(kemID uint16, bytes []byte) (*ecdh.PublicKey, error) {
    	kemInfo, ok := SupportedKEMs[kemID]
    	if !ok {
    		return nil, errors.New("unsupported KEM id")
    	}
    	return kemInfo.curve.NewPublicKey(bytes)
    }
    
    type uint128 struct {
    	hi, lo uint64
    }
    
    func (u uint128) addOne() uint128 {
    	lo, carry := bits.Add64(u.lo, 1, 0)
    	return uint128{u.hi + carry, lo}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 22:33:33 UTC 2024
    - 7K bytes
    - Viewed (0)
  9. src/crypto/ecdsa/ecdsa.go

    // invalid according to the definition of [ecdh.Curve.NewPublicKey], or if the
    // Curve is not supported by crypto/ecdh.
    func (k *PublicKey) ECDH() (*ecdh.PublicKey, error) {
    	c := curveToECDH(k.Curve)
    	if c == nil {
    		return nil, errors.New("ecdsa: unsupported curve by crypto/ecdh")
    	}
    	if !k.Curve.IsOnCurve(k.X, k.Y) {
    		return nil, errors.New("ecdsa: invalid public key")
    	}
    	return c.NewPublicKey(elliptic.Marshal(k.Curve, k.X, k.Y))
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:11:18 UTC 2024
    - 20.4K bytes
    - Viewed (0)
  10. src/crypto/tls/handshake_client_tls13.go

    			c.sendAlert(alertIllegalParameter)
    			return errors.New("tls: invalid server key share")
    		}
    		ecdhePeerData = hs.serverHello.serverShare.data[:x25519PublicKeySize]
    	}
    	peerKey, err := hs.keyShareKeys.ecdhe.Curve().NewPublicKey(ecdhePeerData)
    	if err != nil {
    		c.sendAlert(alertIllegalParameter)
    		return errors.New("tls: invalid server key share")
    	}
    	sharedKey, err := hs.keyShareKeys.ecdhe.ECDH(peerKey)
    	if err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:10:12 UTC 2024
    - 27.9K bytes
    - Viewed (0)
Back to top