Documentation ¶
Index ¶
- Constants
- func PrivateKeyToCurve25519(curve25519Private *[PubPriKeySize]byte, privateKey *[PubPriKeySize]byte)
- func PublicKeyToCurve25519(curve25519Public *[PubPriKeySize]byte, publicKey *[PubPriKeySize]byte) bool
- func RepresentativeToPublicKey(publicKey, representative *[32]byte)
- func ScalarBaseMult(publicKey, representative, privateKey *[PubPriKeySize]byte) bool
- type Curve
- func (cr *Curve) Decrypt(cipherText []byte) ([]byte, error)
- func (cr *Curve) Encrypt(plainText []byte) ([]byte, error)
- func (es *Curve) GetKey() []byte
- func (es *Curve) GetKeyString() string
- func (es *Curve) GetPrivate() []byte
- func (es *Curve) GetPrivateString() string
- func (es *Curve) GetPublic() []byte
- func (es *Curve) GetPublicString() string
- func (es *Curve) MakeKey() (err error)
- func (es *Curve) SetKey(key []byte) error
- func (es *Curve) SetKeyString(key string) error
- func (es *Curve) SetPrivate(pri32 []byte) error
- func (es *Curve) SetPrivateString(pri string) error
- func (es *Curve) SetPublic(pub32 []byte) error
- func (es *Curve) SetPublicString(pub string) error
- func (es *Curve) Sign(data []byte) []byte
- func (es *Curve) Verify(sign *[FullKeySize]byte, data []byte) bool
Constants ¶
const ( PublicKeySize = ed25519.PublicKeySize PrivateKeySize = ed25519.PrivateKeySize PubPriKeySize = ed25519.PublicKeySize FullKeySize = ed25519.SignatureSize )
Variables ¶
This section is empty.
Functions ¶
func PrivateKeyToCurve25519 ¶
func PrivateKeyToCurve25519(curve25519Private *[PubPriKeySize]byte, privateKey *[PubPriKeySize]byte)
PrivateKeyToCurve25519 converts an ed25519 private key into a corresponding curve25519 private key such that the resulting curve25519 public key will equal the result from PublicKeyToCurve25519.
func PublicKeyToCurve25519 ¶
func PublicKeyToCurve25519(curve25519Public *[PubPriKeySize]byte, publicKey *[PubPriKeySize]byte) bool
PublicKeyToCurve25519 converts an Ed25519 public key into the curve25519 public key that would be generated from the same private key.
func RepresentativeToPublicKey ¶
func RepresentativeToPublicKey(publicKey, representative *[32]byte)
RepresentativeToPublicKey converts a uniform representative value for a curve25519 public key, as produced by ScalarBaseMult, to a curve25519 public key.
func ScalarBaseMult ¶
func ScalarBaseMult(publicKey, representative, privateKey *[PubPriKeySize]byte) bool
ScalarBaseMult computes a curve25519 public key from a private key and also a uniform representative for that public key. Note that this function will fail and return false for about half of private keys. See http://elligator.cr.yp.to/elligator-20130828.pdf.
Types ¶
type Curve ¶
type Curve struct {
// contains filtered or unexported fields
}
func (*Curve) GetKeyString ¶
func (*Curve) GetPrivate ¶
func (*Curve) GetPrivateString ¶
func (*Curve) GetPublicString ¶
func (*Curve) SetKeyString ¶
func (*Curve) SetPrivate ¶
if you must set the private key to sign, note that you also need to set the public key, because the real private key is actually a combination of the public key and private key
func (*Curve) SetPrivateString ¶
func (*Curve) SetPublic ¶
if you only need to verify the signature, you only need the public key. Generally, the verifier does not have a private key pub32 must be longer than 32 and only the first 32 bytes are fetched