README.md in cose-0.8.0 vs README.md in cose-0.9.0

- old
+ new

@@ -143,32 +143,35 @@ ```ruby cbor_data = "..." sign = COSE::Sign.deserialize(cbor_data) -sign.protected_headers -sign.unprotected_headers -sign.payload +# Verify by doing (key should be a COSE::Key): +sign.verify(key) -sign.signatures.each do |signature| - signature.protected_headers - signature.unprotected_headers - signature.signature -end +# or, if externally supplied authenticated data exists: +sign.verify(key, external_aad) + +# Then access payload +sign.payload ``` #### COSE_Sign1 ```ruby cbor_data = "..." sign1 = COSE::Sign1.deserialize(cbor_data) -sign1.protected_headers -sign1.unprotected_headers +# Verify by doing (key should be a COSE::Key): +sign1.verify(key) + +# or, if externally supplied authenticated data exists: +sign1.verify(key, external_aad) + +# Then access payload sign1.payload -sign1.signature ``` ### MAC Objects #### COSE_Mac @@ -176,40 +179,34 @@ ```ruby cbor_data = "..." mac = COSE::Mac.deserialize(cbor_data) -mac.protected_headers -mac.unprotected_headers -mac.payload -mac.tag +# Verify by doing (key should be a COSE::Key::Symmetric): +mac.verify(key) -mac.recipients.each do |recipient| - recipient.protected_headers - recipient.unprotected_headers - recipient.ciphertext +# or, if externally supplied authenticated data exists: +mac.verify(key, external_aad) - if recipient.recipients - recipient.recipients.each do |recipient| - recipient.protected_headers - recipient.unprotected_headers - recipient.ciphertext - end - end -end +# Then access payload +mac.payload ``` #### COSE_Mac0 ```ruby cbor_data = "..." mac0 = COSE::Mac0.deserialize(cbor_data) -mac0.protected_headers -mac0.unprotected_headers +# Verify by doing (key should be a COSE::Key::Symmetric): +mac0.verify(key) + +# or, if externally supplied authenticated data exists: +mac0.verify(key, external_aad) + +# Then access payload mac0.payload -mac0.tag ``` ### Encryption Objects #### COSE_Encrypt