-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature that generate mac in ISO8583 Crypto PreProcessor UI based on specific fields #87
Comments
Hi @mehrdad2000 Thanks for bringing this up. Here is a work-around you can try: Note this avoids creating multiple instances of the MAC key and SecurityModule by caching a closure in a JMeter variable. if (!vars.getObject('addMac')) {
def macKey = new javax.crypto.spec.SecretKeySpec(
org.jpos.iso.ISOUtil.hex2byte('1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A'), 'ISO9797ALG3')
def ssm = new nz.co.breakpoint.jmeter.iso8583.SecurityModule()
vars.putObject('addMac', { sampler ->
def msg = sampler.getRequest()
def p = msg.getPackager()
def bytes = [0,2,11,12,47].collect {
p.getFieldPackager(it).pack(msg.getComponent(it))
}.flatten() as byte[]
sampler.addField('64', ssm.generateMAC(bytes, macKey, macKey.getAlgorithm()))
})
}
vars.getObject('addMac').call(sampler) Implementing this properly may be a bit more complicated to deal with the more general case of nested/subfields. |
@tilln I try this but encounter with strange issue, I just want to concat these fields "data", but seems after packed add size of first field in start of "bytes", so i change this line from this:
to this:
after that field 11,37 are not same as what generate by sampler! all other part of message same! FYI1: these fields generate by random function ${__Random(111111111111,999999999999,)} FYI2: for debug issue add this line:
|
I have experienced this issue myself after upgrading to JMeter v5.6 where JMeter seems to evaluate function expressions such as However, it is not an issue with this plugin. The attached script demonstrates this with a single HTTP Sampler: jmeter-regression-v5.6.jmx.txt Running this with I have not had time to investigate or log a JMeter bug so feel free to do that. As a work-around you can assign the random function output to a JMeter variable first and put that variable in the sampler. |
Before implementing this feature, I would need to understand what options to consider, such as list of input fields, how they are supposed to be combined to form the input bytes for the MAC calculation, e.g. packed by the packager or not, padded or not, with or without length and/or tag prefixes, etc. As there are so many variations (and I don't know all of them yet) I think it may be easier to use some custom code as the above than to capture all the options in the "ISO8583 Crypto PreProcessor" configuration. Happy to make changes to expose additional methods to access the Sampler and/or Preprocessor instances/properties. |
This issue is stale because it has been open for 30 days with no activity. |
Hi
Would you please add feature that generate mac in ISO8583 Crypto PreProcessor UI based on specific fields.
E.g. fields: 0,2,11,12,47
concat these fields and based on these fields generate mac.
Any idea?
Thanks
The text was updated successfully, but these errors were encountered: