Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 101 for Curve (0.04 sec)

  1. src/crypto/elliptic/elliptic_test.go

    		tests = tests[:1]
    	}
    	for _, test := range tests {
    		curve := test.curve
    		t.Run(test.name, func(t *testing.T) {
    			t.Parallel()
    			f(t, curve)
    		})
    	}
    }
    
    func TestOnCurve(t *testing.T) {
    	t.Parallel()
    	testAllCurves(t, func(t *testing.T, curve Curve) {
    		if !curve.IsOnCurve(curve.Params().Gx, curve.Params().Gy) {
    			t.Error("basepoint is not on the curve")
    		}
    	})
    }
    
    func TestOffCurve(t *testing.T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 27 02:00:03 UTC 2023
    - 11.6K bytes
    - Viewed (0)
  2. src/crypto/ecdsa/ecdsa_test.go

    		if line[0] == '[' {
    			line = line[1 : len(line)-1]
    			curve, hash, _ := strings.Cut(line, ",")
    
    			switch curve {
    			case "P-224":
    				pub.Curve = elliptic.P224()
    			case "P-256":
    				pub.Curve = elliptic.P256()
    			case "P-384":
    				pub.Curve = elliptic.P384()
    			case "P-521":
    				pub.Curve = elliptic.P521()
    			default:
    				pub.Curve = nil
    			}
    
    			switch hash {
    			case "SHA-1":
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 21:33:58 UTC 2024
    - 13.5K bytes
    - Viewed (0)
  3. src/crypto/x509/sec1.go

    	}
    
    	var curve elliptic.Curve
    	if namedCurveOID != nil {
    		curve = namedCurveFromOID(*namedCurveOID)
    	} else {
    		curve = namedCurveFromOID(privKey.NamedCurveOID)
    	}
    	if curve == nil {
    		return nil, errors.New("x509: unknown elliptic curve")
    	}
    
    	k := new(big.Int).SetBytes(privKey.PrivateKey)
    	curveOrder := curve.Params().N
    	if k.Cmp(curveOrder) >= 0 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 17:09:47 UTC 2023
    - 4.6K bytes
    - Viewed (0)
  4. src/crypto/elliptic/nistec.go

    	}
    	p2, err := curve.pointFromAffine(x2, y2)
    	if err != nil {
    		panic("crypto/elliptic: Add was called on an invalid point")
    	}
    	return curve.pointToAffine(p1.Add(p1, p2))
    }
    
    func (curve *nistCurve[Point]) Double(x1, y1 *big.Int) (*big.Int, *big.Int) {
    	p, err := curve.pointFromAffine(x1, y1)
    	if err != nil {
    		panic("crypto/elliptic: Double was called on an invalid point")
    	}
    	return curve.pointToAffine(p.Double(p))
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Nov 21 16:19:34 UTC 2022
    - 9.6K bytes
    - Viewed (0)
  5. src/crypto/ecdsa/ecdsa.go

    	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))
    }
    
    // Equal reports whether pub and x have the same value.
    //
    // Two keys are only considered to have the same value if they have the same Curve value.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:11:18 UTC 2024
    - 20.4K bytes
    - Viewed (0)
  6. src/crypto/ecdh/ecdh.go

    //
    // This check is performed in constant time as long as the key types and their
    // curve match.
    func (k *PublicKey) Equal(x crypto.PublicKey) bool {
    	xx, ok := x.(*PublicKey)
    	if !ok {
    		return false
    	}
    	return k.curve == xx.curve &&
    		subtle.ConstantTimeCompare(k.publicKey, xx.publicKey) == 1
    }
    
    func (k *PublicKey) Curve() Curve {
    	return k.curve
    }
    
    // PrivateKey is an ECDH private key, usually kept secret.
    //
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 17:09:47 UTC 2023
    - 6.4K bytes
    - Viewed (0)
  7. src/crypto/elliptic/params.go

    	// use that instead of the generic one.
    	if specific, ok := matchesSpecificCurve(curve); ok {
    		return specific.Add(x1, y1, x2, y2)
    	}
    	panicIfNotOnCurve(curve, x1, y1)
    	panicIfNotOnCurve(curve, x2, y2)
    
    	z1 := zForAffine(x1, y1)
    	z2 := zForAffine(x2, y2)
    	return curve.affineFromJacobian(curve.addJacobian(x1, y1, z1, x2, y2, z2))
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 16 17:46:09 UTC 2024
    - 9.6K bytes
    - Viewed (0)
  8. src/crypto/ecdh/x25519.go

    	}
    	return &PrivateKey{
    		curve:      c,
    		privateKey: append([]byte{}, key...),
    	}, nil
    }
    
    func (c *x25519Curve) privateKeyToPublicKey(key *PrivateKey) *PublicKey {
    	if key.curve != c {
    		panic("crypto/ecdh: internal error: converting the wrong key type")
    	}
    	k := &PublicKey{
    		curve:     key.curve,
    		publicKey: make([]byte, x25519PublicKeySize),
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 17:09:47 UTC 2023
    - 3.1K bytes
    - Viewed (0)
  9. src/crypto/elliptic/elliptic.go

    func Marshal(curve Curve, x, y *big.Int) []byte {
    	panicIfNotOnCurve(curve, x, y)
    
    	byteLen := (curve.Params().BitSize + 7) / 8
    
    	ret := make([]byte, 1+2*byteLen)
    	ret[0] = 4 // uncompressed point
    
    	x.FillBytes(ret[1 : 1+byteLen])
    	y.FillBytes(ret[1+byteLen : 1+2*byteLen])
    
    	return ret
    }
    
    // MarshalCompressed converts a point on the curve into the compressed form
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 17:09:47 UTC 2023
    - 9K bytes
    - Viewed (0)
  10. src/crypto/ecdh/nist.go

    		if err != nil {
    			return nil, err
    		}
    		return newBoringPrivateKey(c, bk, key)
    	}
    	k := &PrivateKey{
    		curve:      c,
    		privateKey: append([]byte{}, key...),
    	}
    	return k, nil
    }
    
    func newBoringPrivateKey(c Curve, bk *boring.PrivateKeyECDH, privateKey []byte) (*PrivateKey, error) {
    	k := &PrivateKey{
    		curve:      c,
    		boring:     bk,
    		privateKey: append([]byte(nil), privateKey...),
    	}
    	return k, nil
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 18:57:38 UTC 2024
    - 8.1K bytes
    - Viewed (0)
Back to top