Documentation ¶
Overview ¶
Package ed25519 uses the Ed25519 to implement sig-related parts of ski.CryptoKit. Calls into non-signature related CryptoKit functions will return unimplemented err.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CryptoKit = ski.CryptoKit{ CryptoKitID: ski.CryptoKitID_ED25519, GenerateNewKey: func( inRand io.Reader, inRequestedKeyLen int, ioEntry *ski.KeyEntry, ) error { var err error switch ioEntry.KeyInfo.KeyType { case ski.KeyType_SigningKey: { ioEntry.KeyInfo.PubKey, ioEntry.PrivKey, err = ed25519.GenerateKey(inRand) } default: return plan.Error(nil, plan.Unimplemented, "unimplemented KeyType") } if err != nil { return plan.Errorf(err, plan.KeyGenerationFailed, "key generation failed for KeyType %v", ioEntry.KeyInfo.KeyType) } return nil }, EncryptUsingPassword: func( inRand io.Reader, inMsg []byte, inPwd []byte, ) ([]byte, error) { return nil, unimpErr }, DecryptUsingPassword: func( inMsg []byte, inPwd []byte, ) ([]byte, error) { return nil, unimpErr }, Encrypt: func( inRand io.Reader, inMsg []byte, inKey []byte, ) ([]byte, error) { return nil, unimpErr }, Decrypt: func( inMsg []byte, inKey []byte, ) ([]byte, error) { return nil, unimpErr }, EncryptFor: func( inRand io.Reader, inMsg []byte, inPeerPubKey []byte, inPrivKey []byte, ) ([]byte, error) { return nil, unimpErr }, DecryptFrom: func( inMsg []byte, inPeerPubKey []byte, inPrivKey []byte, ) ([]byte, error) { return nil, unimpErr }, Sign: func( inDigest []byte, inSignerPrivKey []byte, ) ([]byte, error) { if len(inSignerPrivKey) != ed25519.PrivateKeySize { return nil, plan.Errorf(nil, plan.BadKeyFormat, "bad ed25519 private key size") } sig := ed25519.Sign(inSignerPrivKey, inDigest) return sig, nil }, VerifySignature: func( inSig []byte, inDigest []byte, inSignerPubKey []byte, ) error { if len(inSignerPubKey) != ed25519.PublicKeySize { return plan.Errorf(nil, plan.BadKeyFormat, "bad ed25519 public key size") } if !ed25519.Verify(inSignerPubKey, inDigest, inSig) { return plan.Error(nil, plan.VerifySignatureFailed, "ed25519 sig verification failed") } return nil }, }
CryptoKit is used with ski.RegisterCryptoKit() so it can be accessed by ski.CryptoKitID
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.