diff options
author | Colin Watson <cjwatson@debian.org> | 2010-03-31 00:48:57 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2010-03-31 00:48:57 +0100 |
commit | d1a87e462e1db89f19cd960588d0c6b287cb5ccc (patch) | |
tree | f0d13e1687800f36a3c4322b94ac5230ad17bdbf /scard | |
parent | 964476f91b66c475d5b8fa1e8b28d39a97a1b56e (diff) | |
parent | 004a7fb9c6a00b13dc98f56599918a54a3506d10 (diff) |
merge 5.4p1
Diffstat (limited to 'scard')
-rw-r--r-- | scard/Makefile.in | 29 | ||||
-rw-r--r-- | scard/Ssh.bin | bin | 600 -> 0 bytes | |||
-rw-r--r-- | scard/Ssh.bin.uu | 17 | ||||
-rw-r--r-- | scard/Ssh.java | 164 |
4 files changed, 0 insertions, 210 deletions
diff --git a/scard/Makefile.in b/scard/Makefile.in deleted file mode 100644 index 8519e208b..000000000 --- a/scard/Makefile.in +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | # $Id: Makefile.in,v 1.5 2006/10/23 21:44:47 tim Exp $ | ||
2 | |||
3 | prefix=@prefix@ | ||
4 | datadir=@datadir@ | ||
5 | datarootdir=@datarootdir@ | ||
6 | srcdir=@srcdir@ | ||
7 | top_srcdir=@top_srcdir@ | ||
8 | |||
9 | INSTALL=@INSTALL@ | ||
10 | |||
11 | VPATH=@srcdir@ | ||
12 | |||
13 | all: | ||
14 | |||
15 | #Ssh.bin: Ssh.bin.uu | ||
16 | # uudecode Ssh.bin.uu | ||
17 | |||
18 | clean: | ||
19 | # rm -rf Ssh.bin | ||
20 | |||
21 | distprep: | ||
22 | uudecode Ssh.bin.uu | ||
23 | |||
24 | distclean: clean | ||
25 | rm -f Makefile *~ | ||
26 | |||
27 | install: $(srcdir)/Ssh.bin | ||
28 | $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir) | ||
29 | $(INSTALL) -m 0644 $(srcdir)/Ssh.bin $(DESTDIR)$(datadir)/Ssh.bin | ||
diff --git a/scard/Ssh.bin b/scard/Ssh.bin deleted file mode 100644 index edbadc618..000000000 --- a/scard/Ssh.bin +++ /dev/null | |||
Binary files differ | |||
diff --git a/scard/Ssh.bin.uu b/scard/Ssh.bin.uu deleted file mode 100644 index ea3986a69..000000000 --- a/scard/Ssh.bin.uu +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | begin 644 Ssh.bin | ||
2 | M`P)!&P`801X`>``!`E@"`/Y@\`4`_J'P!0!!&T$=`?Z@\`4`01M!'`'^>/,! | ||
3 | M`4$;01X!_G#S%P'^0],1`?Y@\!0`_G/S'0#^<]4``D$;L`4`_F'3``#^8=,% | ||
4 | M`/ZAT`$!_J#0)P'^H],*`?ZCTPD`_G/5"P7^8=,'`OZAT`H`_J#0$@3^:-,@ | ||
5 | M`T$;`P`%`/Y@`<P``$$<\@\``$$=\B$``$$>\A```/`0__(%`@8!`0H``&`` | ||
6 | M0205!!D)I$L`"0J0`&``*!4$&58``````.P````%____P````.D````0```` | ||
7 | M,P```"````#'````,````(T````R````V!4#&0A*``D*;@!@`"@5!QD*`/\] | ||
8 | M(6``1A)*``D*9P!@`"@*/P!@`$LK"1)@`$LK!6``4!P$#00#2@`.#01@`%5@ | ||
9 | M`%I@`"@37``>%0@2%0A>`%\($F``9%(`:`H_`&``2RL*<VA@`$LK8`!I"1`U | ||
10 | M(14#`Q)@`&X<!`T$`TL`"P,28`!D4@`.#01@`%5@`%I@`"A2`"X5`PH$`&`` | ||
11 | M<RL#!6``9%(`'14#"@$"8`!S*P,%8`!D4@`,4@`)"FT`8``H60``\`+_\@$! | ||
12 | M`0D`"```"I``8``H60#P$__R`0$""0`,``!B01LM7P`\*UD```#P$O_V`0$# | ||
13 | M`0`8```37``>7@`R10`/$UP`'@H`R`D07@`W!%>P!?_R`0$$`@`\```37P`` | ||
14 | M$V+^H2U?``5=``H38OZ@+5\`#UT`%!-B_G@M"@0`7P`970`>"@0`8``C10`) | ||
15 | /"F<`8``H$UX`+5D````` | ||
16 | ` | ||
17 | end | ||
diff --git a/scard/Ssh.java b/scard/Ssh.java deleted file mode 100644 index 6418957c2..000000000 --- a/scard/Ssh.java +++ /dev/null | |||
@@ -1,164 +0,0 @@ | |||
1 | // $Id: Ssh.java,v 1.3 2002/05/22 04:24:02 djm Exp $ | ||
2 | // | ||
3 | // Ssh.java | ||
4 | // SSH / smartcard integration project, smartcard side | ||
5 | // | ||
6 | // Tomoko Fukuzawa, created, Feb., 2000 | ||
7 | // | ||
8 | // Naomaru Itoi, modified, Apr., 2000 | ||
9 | // | ||
10 | |||
11 | // copyright 2000 | ||
12 | // the regents of the university of michigan | ||
13 | // all rights reserved | ||
14 | // | ||
15 | // permission is granted to use, copy, create derivative works | ||
16 | // and redistribute this software and such derivative works | ||
17 | // for any purpose, so long as the name of the university of | ||
18 | // michigan is not used in any advertising or publicity | ||
19 | // pertaining to the use or distribution of this software | ||
20 | // without specific, written prior authorization. if the | ||
21 | // above copyright notice or any other identification of the | ||
22 | // university of michigan is included in any copy of any | ||
23 | // portion of this software, then the disclaimer below must | ||
24 | // also be included. | ||
25 | // | ||
26 | // this software is provided as is, without representation | ||
27 | // from the university of michigan as to its fitness for any | ||
28 | // purpose, and without warranty by the university of | ||
29 | // michigan of any kind, either express or implied, including | ||
30 | // without limitation the implied warranties of | ||
31 | // merchantability and fitness for a particular purpose. the | ||
32 | // regents of the university of michigan shall not be liable | ||
33 | // for any damages, including special, indirect, incidental, or | ||
34 | // consequential damages, with respect to any claim arising | ||
35 | // out of or in connection with the use of the software, even | ||
36 | // if it has been or is hereafter advised of the possibility of | ||
37 | // such damages. | ||
38 | |||
39 | import javacard.framework.*; | ||
40 | import javacardx.framework.*; | ||
41 | import javacardx.crypto.*; | ||
42 | |||
43 | public class Ssh extends javacard.framework.Applet | ||
44 | { | ||
45 | // Change this when the applet changes; hi byte is major, low byte is minor | ||
46 | static final short applet_version = (short)0x0102; | ||
47 | |||
48 | /* constants declaration */ | ||
49 | // code of CLA byte in the command APDU header | ||
50 | static final byte Ssh_CLA =(byte)0x05; | ||
51 | |||
52 | // codes of INS byte in the command APDU header | ||
53 | static final byte DECRYPT = (byte) 0x10; | ||
54 | static final byte GET_KEYLENGTH = (byte) 0x20; | ||
55 | static final byte GET_PUBKEY = (byte) 0x30; | ||
56 | static final byte GET_VERSION = (byte) 0x32; | ||
57 | static final byte GET_RESPONSE = (byte) 0xc0; | ||
58 | |||
59 | static final short keysize = 1024; | ||
60 | static final short root_fid = (short)0x3f00; | ||
61 | static final short privkey_fid = (short)0x0012; | ||
62 | static final short pubkey_fid = (short)(('s'<<8)|'h'); | ||
63 | |||
64 | /* instance variables declaration */ | ||
65 | AsymKey rsakey; | ||
66 | CyberflexFile file; | ||
67 | CyberflexOS os; | ||
68 | |||
69 | private Ssh() | ||
70 | { | ||
71 | file = new CyberflexFile(); | ||
72 | os = new CyberflexOS(); | ||
73 | |||
74 | rsakey = new RSA_CRT_PrivateKey (keysize); | ||
75 | |||
76 | if ( ! rsakey.isSupportedLength (keysize) ) | ||
77 | ISOException.throwIt (ISO.SW_WRONG_LENGTH); | ||
78 | |||
79 | register(); | ||
80 | } // end of the constructor | ||
81 | |||
82 | public boolean select() { | ||
83 | if (!rsakey.isInitialized()) | ||
84 | rsakey.setKeyInstance ((short)0xc8, (short)0x10); | ||
85 | |||
86 | return true; | ||
87 | } | ||
88 | |||
89 | public static void install(APDU apdu) | ||
90 | { | ||
91 | new Ssh(); // create a Ssh applet instance (card) | ||
92 | } // end of install method | ||
93 | |||
94 | public static void main(String args[]) { | ||
95 | ISOException.throwIt((short) 0x9000); | ||
96 | } | ||
97 | |||
98 | public void process(APDU apdu) | ||
99 | { | ||
100 | // APDU object carries a byte array (buffer) to | ||
101 | // transfer incoming and outgoing APDU header | ||
102 | // and data bytes between card and CAD | ||
103 | byte buffer[] = apdu.getBuffer(); | ||
104 | short size, st; | ||
105 | |||
106 | // verify that if the applet can accept this | ||
107 | // APDU message | ||
108 | // NI: change suggested by Wayne Dyksen, Purdue | ||
109 | if (buffer[ISO.OFFSET_INS] == ISO.INS_SELECT) | ||
110 | ISOException.throwIt(ISO.SW_NO_ERROR); | ||
111 | |||
112 | switch (buffer[ISO.OFFSET_INS]) { | ||
113 | case DECRYPT: | ||
114 | if (buffer[ISO.OFFSET_CLA] != Ssh_CLA) | ||
115 | ISOException.throwIt(ISO.SW_CLA_NOT_SUPPORTED); | ||
116 | //decrypt (apdu); | ||
117 | size = (short) (buffer[ISO.OFFSET_LC] & 0x00FF); | ||
118 | |||
119 | if (apdu.setIncomingAndReceive() != size) | ||
120 | ISOException.throwIt (ISO.SW_WRONG_LENGTH); | ||
121 | |||
122 | // check access; depends on bit 2 (x/a) | ||
123 | file.selectFile(root_fid); | ||
124 | file.selectFile(privkey_fid); | ||
125 | st = os.checkAccess(ACL.EXECUTE); | ||
126 | if (st != ST.ACCESS_CLEARED) { | ||
127 | CyberflexAPDU.prepareSW1SW2(st); | ||
128 | ISOException.throwIt(CyberflexAPDU.getSW1SW2()); | ||
129 | } | ||
130 | |||
131 | rsakey.cryptoUpdate (buffer, (short) ISO.OFFSET_CDATA, size, | ||
132 | buffer, (short) ISO.OFFSET_CDATA); | ||
133 | |||
134 | apdu.setOutgoingAndSend ((short) ISO.OFFSET_CDATA, size); | ||
135 | break; | ||
136 | case GET_PUBKEY: | ||
137 | file.selectFile(root_fid); // select root | ||
138 | file.selectFile(pubkey_fid); // select public key file | ||
139 | size = (short)(file.getFileSize() - 16); | ||
140 | st = os.readBinaryFile(buffer, (short)0, (short)0, size); | ||
141 | if (st == ST.SUCCESS) | ||
142 | apdu.setOutgoingAndSend((short)0, size); | ||
143 | else { | ||
144 | CyberflexAPDU.prepareSW1SW2(st); | ||
145 | ISOException.throwIt(CyberflexAPDU.getSW1SW2()); | ||
146 | } | ||
147 | break; | ||
148 | case GET_KEYLENGTH: | ||
149 | Util.setShort(buffer, (short)0, keysize); | ||
150 | apdu.setOutgoingAndSend ((short)0, (short)2); | ||
151 | break; | ||
152 | case GET_VERSION: | ||
153 | Util.setShort(buffer, (short)0, applet_version); | ||
154 | apdu.setOutgoingAndSend ((short)0, (short)2); | ||
155 | break; | ||
156 | case GET_RESPONSE: | ||
157 | break; | ||
158 | default: | ||
159 | ISOException.throwIt (ISO.SW_INS_NOT_SUPPORTED); | ||
160 | } | ||
161 | |||
162 | } // end of process method | ||
163 | |||
164 | } // end of class Ssh | ||