"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/crypto/x509/sec1.go" between
go1.19.src.tar.gz and go1.19.1.src.tar.gz

About: Google’s Go is a compiled, garbage-collected, concurrent programming language.
Latest stable release (1.19).

sec1.go  (go1.19.src):sec1.go  (go1.19.1.src)
skipping to change at line 57 skipping to change at line 57
if !ok { if !ok {
return nil, errors.New("x509: unknown elliptic curve") return nil, errors.New("x509: unknown elliptic curve")
} }
return marshalECPrivateKeyWithOID(key, oid) return marshalECPrivateKeyWithOID(key, oid)
} }
// marshalECPrivateKey marshals an EC private key into ASN.1, DER format and // marshalECPrivateKey marshals an EC private key into ASN.1, DER format and
// sets the curve ID to the given OID, or omits it if OID is nil. // sets the curve ID to the given OID, or omits it if OID is nil.
func marshalECPrivateKeyWithOID(key *ecdsa.PrivateKey, oid asn1.ObjectIdentifier ) ([]byte, error) { func marshalECPrivateKeyWithOID(key *ecdsa.PrivateKey, oid asn1.ObjectIdentifier ) ([]byte, error) {
if !key.Curve.IsOnCurve(key.X, key.Y) {
return nil, errors.New("invalid elliptic key public key")
}
privateKey := make([]byte, (key.Curve.Params().N.BitLen()+7)/8) privateKey := make([]byte, (key.Curve.Params().N.BitLen()+7)/8)
return asn1.Marshal(ecPrivateKey{ return asn1.Marshal(ecPrivateKey{
Version: 1, Version: 1,
PrivateKey: key.D.FillBytes(privateKey), PrivateKey: key.D.FillBytes(privateKey),
NamedCurveOID: oid, NamedCurveOID: oid,
PublicKey: asn1.BitString{Bytes: elliptic.Marshal(key.Curve, key.X, key.Y)}, PublicKey: asn1.BitString{Bytes: elliptic.Marshal(key.Curve, key.X, key.Y)},
}) })
} }
// parseECPrivateKey parses an ASN.1 Elliptic Curve Private Key Structure. // parseECPrivateKey parses an ASN.1 Elliptic Curve Private Key Structure.
 End of changes. 1 change blocks. 
0 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)