Class: Ksef::Crypto::Digest
- Inherits:
-
Data
- Object
- Data
- Ksef::Crypto::Digest
- Defined in:
- lib/ksef/crypto/digest.rb
Overview
The SHA-256-and-size pair KSeF wants beside a payload (docs/REFERENCE.md §11.1).
POST /sessions/online/{ref}/invoices carries four integrity values — the hash
and size of the plaintext invoice and of the ciphertext. Computing one over the
wrong artifact is an easy mistake and a silent one, which is why
Encryptor#seal produces both at once rather than leaving a caller to
pair them up.
size is a byte count, not a character count. An invoice full of Polish
characters has more bytes than characters, and reporting the shorter figure would be
rejected downstream.
Instance Attribute Summary collapse
-
#bytes ⇒ Object
readonly
Returns the value of attribute bytes.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Class Method Summary collapse
Instance Method Summary collapse
-
#base64 ⇒ String
The wire form: base64 of the digest, always 44 characters, which is what the contract's
Sha256HashBase64constrains it to.
Instance Attribute Details
#bytes ⇒ Object (readonly)
Returns the value of attribute bytes
16 17 18 |
# File 'lib/ksef/crypto/digest.rb', line 16 def bytes @bytes end |
#size ⇒ Object (readonly)
Returns the value of attribute size
16 17 18 |
# File 'lib/ksef/crypto/digest.rb', line 16 def size @size end |