diff options
| author | J08nY | 2017-03-14 01:28:25 +0100 |
|---|---|---|
| committer | J08nY | 2017-03-14 01:28:25 +0100 |
| commit | b8e77022e075cd53994ad8c2bacb84307b5fb66f (patch) | |
| tree | a67f83592033d93e1961f6917644d2eb1763982d /src/cz/crcs/ectester/applet/EC_Consts.java | |
| parent | ea77f29683c8721ae1581b76f3f6b83ee26720bc (diff) | |
| download | ECTester-b8e77022e075cd53994ad8c2bacb84307b5fb66f.tar.gz ECTester-b8e77022e075cd53994ad8c2bacb84307b5fb66f.tar.zst ECTester-b8e77022e075cd53994ad8c2bacb84307b5fb66f.zip | |
Created a new command: Corrupt
Originaly a part of a set command, now allows more control
of keypairs
Diffstat (limited to 'src/cz/crcs/ectester/applet/EC_Consts.java')
| -rw-r--r-- | src/cz/crcs/ectester/applet/EC_Consts.java | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/cz/crcs/ectester/applet/EC_Consts.java b/src/cz/crcs/ectester/applet/EC_Consts.java index fc62c67..68fb4c9 100644 --- a/src/cz/crcs/ectester/applet/EC_Consts.java +++ b/src/cz/crcs/ectester/applet/EC_Consts.java @@ -947,6 +947,7 @@ public class EC_Consts { public static final byte CORRUPTION_ONEBYTERANDOM = (byte) 0x03; public static final byte CORRUPTION_ZERO = (byte) 0x04; public static final byte CORRUPTION_ONE = (byte) 0x05; + public static final byte CORRUPTION_INCREMENT = (byte) 0x06; // Supported embedded curves, getCurveParameter @@ -1269,18 +1270,16 @@ public class EC_Consts { case CORRUPTION_ONE: Util.arrayFillNonAtomic(buffer, offset, length, (byte) 1); break; + case CORRUPTION_INCREMENT: + short index = (short) (offset + length - 1); + byte value; + do { + value = buffer[index]; + buffer[index--] = ++value; + } while (value == (byte) 0 && index >= offset); + break; default: ISOException.throwIt(ISO7816.SW_FUNC_NOT_SUPPORTED); - /* //TODO implement CORRUPT_B_LASTBYTEINCREMENT somehow - case CORRUPT_B_LASTBYTEINCREMENT: - m_ramArray2[(short) (m_lenB - 1)] += 1; - // Make sure its not the valid byte again - if (m_ramArray[(short) (m_lenB - 1)] == m_ramArray2[(short) (m_lenB - 1)]) { - m_ramArray2[(short) (m_lenB - 1)] += 1; // if yes, increment once more - } - break; - } - */ } } |
