Begin porting example to JC221
This commit is contained in:
parent
dd68840fff
commit
c87ffe9bfa
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,3 +4,5 @@ tools/
|
|||||||
*.cap
|
*.cap
|
||||||
*.class
|
*.class
|
||||||
*.jar
|
*.jar
|
||||||
|
target/
|
||||||
|
.vscode/
|
||||||
|
42
pom.xml
Normal file
42
pom.xml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.hacdc.crystal</groupId>
|
||||||
|
<artifactId>crystal</artifactId>
|
||||||
|
<version>1.0-ALPHA</version>
|
||||||
|
<name>crystal</name>
|
||||||
|
<url>https://wiki.hacdc.org</url>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bouncycastle</groupId>
|
||||||
|
<artifactId>bcprov-jdk18on</artifactId>
|
||||||
|
<version>1.80</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<configuration>
|
||||||
|
<target>
|
||||||
|
<ant antfile="${basedir}/build.xml" inheritAll="false">
|
||||||
|
<target name="build"/>
|
||||||
|
</ant>
|
||||||
|
</target>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -30,6 +30,20 @@ public class Crystal extends Applet {
|
|||||||
|
|
||||||
private void processCMD1(APDU apdu) throws ISOException {
|
private void processCMD1(APDU apdu) throws ISOException {
|
||||||
// Process command 1
|
// Process command 1
|
||||||
|
short len = apdu.setIncomingAndReceive();
|
||||||
|
byte[] buffer = apdu.getBuffer();
|
||||||
|
short offset = apdu.getOffsetCdata();
|
||||||
|
byte p1 = buffer[ISO7816.OFFSET_P1]; // 00, could encode further parameters for CMD1 here
|
||||||
|
byte p2 = buffer[ISO7816.OFFSET_P2]; // 00, could encode further parameters for CMD2 here
|
||||||
|
if (p1 == 0x00 && p2 == 0x00) {
|
||||||
|
if (len != 16) {
|
||||||
|
ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
|
||||||
|
} else {
|
||||||
|
apdu.setOutgoingAndSend(dataOffset, (short)16);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user