Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion openpgp/ecdsa/ecdsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
package ecdsa

import (
"crypto/elliptic"
"errors"
"github.com/ProtonMail/go-crypto/openpgp/internal/ecc"
"io"
"math/big"

"github.com/ProtonMail/go-crypto/openpgp/internal/ecc"
)

type PublicKey struct {
Expand All @@ -19,6 +21,14 @@ type PrivateKey struct {
D *big.Int
}

// NewPublicKeyFromCurve takes an elliptic curve, and returns a PublicKey
// of that curve type.
func NewPublicKeyFromCurve(c elliptic.Curve) *PublicKey {
return &PublicKey{
curve: ecc.NewGenericCurve(c),
}
}

func NewPublicKey(curve ecc.ECDSACurve) *PublicKey {
return &PublicKey{
curve: curve,
Expand Down