RemovePKCSPadding removes padding from data that was added with addPKCSPadding.
(src []byte)
| 40 | |
| 41 | // RemovePKCSPadding removes padding from data that was added with addPKCSPadding. |
| 42 | func RemovePKCSPadding(src []byte) ([]byte, error) { |
| 43 | length := len(src) |
| 44 | padLength := int(src[length-1]) |
| 45 | if padLength > aes.BlockSize || length < aes.BlockSize { |
| 46 | return nil, errInvalidPadding |
| 47 | } |
| 48 | |
| 49 | return src[:length-padLength], nil |
| 50 | } |
| 51 | |
| 52 | // EncryptAndSign (inputPublicKey, inData) MAIN PROCEDURE: |
| 53 | // 1. newPrivateKey, newPubKey := genSecp256k1Keypair() |
no outgoing calls