unbreak maybe?
This commit is contained in:
parent
86b3d3ce62
commit
64c52e327a
@ -2,14 +2,14 @@ package srnd
|
||||
|
||||
import "github.com/majestrate/nacl"
|
||||
|
||||
func nacl_cryptoVerifyFucky(hash, sig, pk []byte) bool {
|
||||
func naclCryptoVerifyFucky(hash, sig, pk []byte) bool {
|
||||
return nacl.CryptoVerifyFucky(hash, sig, pk)
|
||||
}
|
||||
|
||||
func nacl_cryptoSignFucky(hash, sk []byte) (sig []byte) {
|
||||
func naclCryptoSignFucky(hash, sk []byte) (sig []byte) {
|
||||
return nacl.CryptoSignFucky(hash, sk)
|
||||
}
|
||||
|
||||
func nacl_cryptoVerifyDetached(hash, sig, pk []byte) bool {
|
||||
func naclCryptoVerifyDetached(hash, sig, pk []byte) bool {
|
||||
return nacl.CryptoVerifyDetached(hash, sig, pk)
|
||||
}
|
||||
|
@ -464,7 +464,7 @@ func verifyMessageSHA512(pk, sig string, body *io.LimitedReader, innerHandler fu
|
||||
hash := h.Sum(nil)
|
||||
log.Printf("hash=%s", hexify(hash))
|
||||
log.Printf("sig=%s", hexify(sig_bytes))
|
||||
if nacl_cryptoVerifyFucky(hash, sig_bytes, pk_bytes) {
|
||||
if naclCryptoVerifyFucky(hash, sig_bytes, pk_bytes) {
|
||||
log.Println("signature is valid :^)")
|
||||
} else {
|
||||
err = errors.New("invalid signature")
|
||||
@ -502,7 +502,7 @@ func verifyMessageBLAKE2B(pk, sig string, body *io.LimitedReader, innerHandler f
|
||||
hash := h.Sum(nil)
|
||||
log.Printf("hash=%s", hexify(hash))
|
||||
log.Printf("sig=%s", hexify(sig_bytes))
|
||||
if nacl_cryptoVerifyDetached(hash, sig_bytes, pk_bytes) {
|
||||
if naclCryptoVerifyDetached(hash, sig_bytes, pk_bytes) {
|
||||
log.Println("signature is valid :^)")
|
||||
} else {
|
||||
err = errors.New("invalid signature")
|
||||
|
@ -405,7 +405,7 @@ func getSignPubkey(sk []byte) string {
|
||||
// XXX: DEPRECATED
|
||||
func cryptoSignFucky(h, sk []byte) string {
|
||||
// sign
|
||||
sig := nacl_cryptoSignFucky(h, sk)
|
||||
sig := naclCryptoSignFucky(h, sk)
|
||||
if sig == nil {
|
||||
return "[failed to sign]"
|
||||
}
|
||||
@ -413,7 +413,7 @@ func cryptoSignFucky(h, sk []byte) string {
|
||||
}
|
||||
|
||||
// convert seed to secret key
|
||||
func seedToKeyPair(seed []byte) (full ed25519.PrivateKey, pub ed25519.PublicKey) {
|
||||
func seedToKeyPair(seed []byte) (pub ed25519.PublicKey, full ed25519.PrivateKey) {
|
||||
var in [32]byte
|
||||
var out [32]byte
|
||||
copy(in[:], seed[0:32])
|
||||
@ -426,7 +426,7 @@ func seedToKeyPair(seed []byte) (full ed25519.PrivateKey, pub ed25519.PublicKey)
|
||||
|
||||
func cryptoSignProper(h, sk []byte) string {
|
||||
// convert key
|
||||
key, _ := seedToKeyPair(sk)
|
||||
_, key := seedToKeyPair(sk)
|
||||
// sign
|
||||
sig := ed25519.Sign(key, h)
|
||||
if sig == nil {
|
||||
@ -688,7 +688,7 @@ func verifyFrontendSig(pubkey, sig, msgid string) bool {
|
||||
s := unhex(sig)
|
||||
k := unhex(pubkey)
|
||||
h := sha512.Sum512([]byte(msgid))
|
||||
return nacl_cryptoVerifyFucky(h[:], s, k)
|
||||
return naclCryptoVerifyFucky(h[:], s, k)
|
||||
}
|
||||
|
||||
func msgidFrontendSign(sk []byte, msgid string) string {
|
||||
|
Reference in New Issue
Block a user