Documentation ¶
Overview ¶
Package crust will contain cryptographic functions needed for communication between the xx messenger and Crust.
Index ¶
- func HashFile(file []byte) ([]byte, error)
- func HashUsername(username string) []byte
- func JointVerify(UDPubkey, userPublicKey *rsa.PublicKey, ...) error
- func SignUpload(rand io.Reader, userPrivKey *rsa.PrivateKey, file []byte, timestamp time.Time) ([]byte, error)
- func SignVerification(rand io.Reader, udPrivKey *rsa.PrivateKey, username string, ...) ([]byte, error)
- func VerifyUpload(userPublicKey *rsa.PublicKey, now, timestamp time.Time, ...) error
- func VerifyVerificationSignature(pubKey *rsa.PublicKey, usernameHash []byte, receptionPubKey *rsa.PublicKey, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashUsername ¶
HashUsername hashes the passed in username using the sha256 hashing algorithm.
func JointVerify ¶
func JointVerify(UDPubkey, userPublicKey *rsa.PublicKey, usernameHash, fileHash, verificationSignature, uploadSignature []byte, uploadTs, now time.Time) error
JointVerify verifies both the upload and the verification signature at once Both will be sent as part of the auth headers to Crust's upload and pinning service, this will make proper usage more clear Returns nil for the error if the verification is successful
func SignUpload ¶
func SignUpload(rand io.Reader, userPrivKey *rsa.PrivateKey, file []byte, timestamp time.Time) ([]byte, error)
SignUpload returns a signature that proves that the user wants to upload a new file. The timestamp indicates the time the user wanted to upload the file. Use serializeTimestamp to serialize the timestamp.
func SignVerification ¶
func SignVerification(rand io.Reader, udPrivKey *rsa.PrivateKey, username string, receptionPubKey *rsa.PublicKey) ([]byte, error)
SignVerification signs the user's username and reception public key, hashed together.
func VerifyUpload ¶
func VerifyUpload(userPublicKey *rsa.PublicKey, now, timestamp time.Time, fileHash, signature []byte) error
VerifyUpload verifies the user's upload signature. The signature should be from SignUpload. The timestamp provided must be +-1 minute from the current time passed in as "now".
Types ¶
This section is empty.