fix typo / improve documentatation
This commit is contained in:
parent
701dc26ab5
commit
5cdec38a18
16 changed files with 77 additions and 187 deletions
|
|
@ -13,8 +13,7 @@ import (
|
|||
"io"
|
||||
)
|
||||
|
||||
// Use: ios/android only
|
||||
// SignTextDetached sign detached text type
|
||||
// SignTextDetached signs detached text type
|
||||
func (pm *PmCrypto) SignTextDetached(plainText string, privateKey *KeyRing, passphrase string, trim bool) (string, error) {
|
||||
//sign with 0x01 text
|
||||
if trim {
|
||||
|
|
@ -40,8 +39,7 @@ func (pm *PmCrypto) SignTextDetached(plainText string, privateKey *KeyRing, pass
|
|||
return outBuf.String(), nil
|
||||
}
|
||||
|
||||
// Use: ios/android only
|
||||
// Sign detached bin data using string key
|
||||
// SignBinDetached Signs detached bin data using string key
|
||||
func (pm *PmCrypto) SignBinDetached(plainData []byte, privateKey *KeyRing, passphrase string) (string, error) {
|
||||
//sign with 0x00
|
||||
signEntity := privateKey.GetSigningEntity(passphrase)
|
||||
|
|
@ -63,10 +61,8 @@ func (pm *PmCrypto) SignBinDetached(plainData []byte, privateKey *KeyRing, passp
|
|||
return outBuf.String(), nil
|
||||
}
|
||||
|
||||
// Use: ios/android only
|
||||
// Verify detached text - check if signature is valid using a given publicKey in binary format
|
||||
// VerifyTextSignDetachedBinKey Verifies detached text - check if signature is valid using a given publicKey in binary format
|
||||
func (pm *PmCrypto) VerifyTextSignDetachedBinKey(signature string, plainText string, publicKey *KeyRing, verifyTime int64) (bool, error) {
|
||||
|
||||
plainText = internal.TrimNewlines(plainText)
|
||||
origText := bytes.NewReader(bytes.NewBufferString(plainText).Bytes())
|
||||
|
||||
|
|
@ -81,7 +77,7 @@ func verifySignature(pubKeyEntries openpgp.EntityList, origText *bytes.Reader, s
|
|||
}
|
||||
} else {
|
||||
config.Time = func() time.Time {
|
||||
return time.Unix(verifyTime+internal.CreationTimeOffset, 0)
|
||||
return time.Unix(verifyTime + internal.CreationTimeOffset, 0)
|
||||
}
|
||||
}
|
||||
signatureReader := strings.NewReader(signature)
|
||||
|
|
@ -116,10 +112,8 @@ func verifySignature(pubKeyEntries openpgp.EntityList, origText *bytes.Reader, s
|
|||
return true, nil
|
||||
}
|
||||
|
||||
// Use: ios/android only
|
||||
// Verify detached text in binary format - check if signature is valid using a given publicKey in binary format
|
||||
// VerifyBinSignDetachedBinKey Verifies detached text in binary format - check if signature is valid using a given publicKey in binary format
|
||||
func (pm *PmCrypto) VerifyBinSignDetachedBinKey(signature string, plainData []byte, publicKey *KeyRing, verifyTime int64) (bool, error) {
|
||||
|
||||
origText := bytes.NewReader(plainData)
|
||||
|
||||
return verifySignature(publicKey.entities, origText, signature, verifyTime)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue