Class: EMV::APDU::CPS::EXTERNAL_AUTHENTICATE
- Inherits:
-
C_MAC_APDU
- Object
- ISO7816::APDU::APDU
- EMV_APDU
- CPS_APDU
- C_MAC_APDU
- EMV::APDU::CPS::EXTERNAL_AUTHENTICATE
- Defined in:
- lib/emv/cps_apdu.rb
Instance Attribute Summary
Attributes inherited from C_MAC_APDU
Attributes inherited from CPS_APDU
Instance Method Summary collapse
-
#cryptogram ⇒ Object
Sets the host cryptogram according to CPS 3.2.6.6.
-
#cryptogram=(bytes) ⇒ Object
Explicitly set a cryptogram, e.g.
-
#initialize(card, secure_context) ⇒ EXTERNAL_AUTHENTICATE
constructor
A new instance of EXTERNAL_AUTHENTICATE.
-
#security_level=(level) ⇒ Object
CPS 3.2.6 :enc_and_mac :mac :no_sec or a sec level byte…
- #send(handle_more_data = true, card = nil) ⇒ Object
Constructor Details
#initialize(card, secure_context) ⇒ EXTERNAL_AUTHENTICATE
Returns a new instance of EXTERNAL_AUTHENTICATE.
191 192 193 194 |
# File 'lib/emv/cps_apdu.rb', line 191 def initialize card, secure_context super self.security_level= secure_context.level if secure_context.level end |
Instance Method Details
#cryptogram ⇒ Object
Sets the host cryptogram according to CPS 3.2.6.6
219 220 221 222 |
# File 'lib/emv/cps_apdu.rb', line 219 def cryptogram @cryptogram ||= secure_context.calculate_host_cryptogram @cryptogram end |
#cryptogram=(bytes) ⇒ Object
Explicitly set a cryptogram, e.g. if an incorrect cryptogram is to be set for testing.
226 227 228 |
# File 'lib/emv/cps_apdu.rb', line 226 def cryptogram= bytes @cryptogram= bytes end |
#security_level=(level) ⇒ Object
CPS 3.2.6
:enc_and_mac
:mac
:no_sec
or a sec level byte...
202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/emv/cps_apdu.rb', line 202 def security_level= level case level when :enc_and_mac self.p1= 0x03 when :mac self.p1= 0x01 when :no_sec self.p1= 0x00 else self.p1=level end @secure_context.level= level end |
#send(handle_more_data = true, card = nil) ⇒ Object
231 232 233 234 235 |
# File 'lib/emv/cps_apdu.rb', line 231 def send handle_more_data=true, card=nil @data= self.cryptogram @data+= c_mac # calculate the c_mac... super end |