首先看一下如何用ios router做ca server。

hostname r3
ip domain name cisco.com
//这两个命令必须配,用来生成key
!
crypto pki server r3
cdp-url tftp://10.0.78.102/r3.crl //生成正书后,把相应的r3.crl文件上传到tftp服务器上去
database level complete
database archive pem password 0 cisco123
issuer-name cn=caserver, c=cn, o=bjenet
//这上面的4行是需要配置的,底下的两组pki命令都是router自己生成的,配置完后要no shutdown一下,只会ios会自己生成key(默认1024位),如果你仔细的话会发现key的名字和pki server的名字是一样的,对头,你要是出于安全考虑,想自己生成一个2048位的key,那么就要注意pki server的名字需要和key的名字一样
!
crypto pki trustpoint r3
revocati crl
rsakeypair r3
!
crypto pki certificate chain r3
certificate ca 01
3082023b 308201a4 a0030201 02020101 300d0609 2a864886 f70d0101 04050030
31310f30 0d060355 040a1306 424a454e 4554310b 30090603 55040613 02434e31
11300f06 03550403 13084341 53657276 6572301e 170d3036 30373231 31393332
35325a17 0d303930 37323031 39333235 325a3031 310f300d 06035504 0a130642
4a454e45 54310b30 09060355 04061302 434e3111 300f0603 55040313 08434153
65727665 7230819f 300d0609 2a864886 f70d0101 01050003 818d0030 81890281
8100a80b 2c3a575a 8ee6c334 597dbf04 b2bfae6f 900c37a6 2485d6a8 ddf2ad92
899aa91e 353be83c d28347d4 b2567602 e855d748 021f4e66 5f31c68c daeb7d55
8d4db11e 2595be5a 890bd2fd 5df341e1 25ec8e4a c29b63fc f70a73e2 6b15b5eb
9d5aa193 99a886ce 58fce9f4 037eeadf e056ae02 10ec2b54 e27e51da 4e5f00da
f0670203 010001a3 63306130 0f060355 1d130101 ff040530 030101ff 300e0603
551d0f01 01ff0404 03020186 301f0603 551d2304 18301680 14ac9683 4830127c
fa790371 5f41eae2 27a72185 a9301d06 03551d0e 04160414 ac968348 30127cfa
7903715f 41eae227 a72185a9 300d0609 2a864886 f70d0101 04050003 81810061
c47440e3 e0ca2b14 c144cafa 8bfc1ef8 33992f65 e477a0e8 40b1dca1 ed9dbd56
ff98e71b 4cf12cb1 257af839 c7667bfc e8ddd837 4dab5268 7f82f1a9 86552a82
18e397b3 7cfd3387 afdfa7b4 60b39feb 8b94a996 099c620e 0a2eb3a3 d0b54ac0
cb60b2bc 4ed1f2c6 e337328c 4944877e bc64c241 aeac546d 06d99d6a 10759c
quit
!
ip http server
//把80端口打开,*** client正是用这个端口从这个ca server获取证书
!
ntp server 129.6.15.28 //一定要让ca和*** client的时间同步,当然最好的方法就是ntp了


r3# sho crypto key mypubkey rsa
% key pair was generated at: 03:32:43 utc jul 22 2006
key name: r3 //look!key的名字和pki server的名字一样
usage: general purpose key
key is not exportable.
key data:
30819f30 0d06092a 864886f7 0d010101 05000381 8d003081 89028181 00a80b2c
3a575a8e e6c33459 7dbf04b2 bfae6f90 0c37a624 85d6a8dd f2ad9289 9aa91e35
3be83cd2 8347d4b2 567602e8 55d74802 1f4e665f 31c68cda eb7d558d 4db11e25
95be5a89 0bd2fd5d f341e125 ec8e4ac2 9b63fcf7 0a73e26b 15b5eb9d 5aa19399
a886ce58 fce9f403 7eeadfe0 56ae0210 ec2b54e2 7e51da4e 5f00daf0 67020301 0001
% key pair was generated at: 03:32:50 utc jul 22 2006
key name: r3.server
usage: encryption key
key is not exportable.
key data:
307c300d 06092a86 4886f70d 01010105 00036b00 30680261 00dba874 afc1df59
7ee8a1c7 f1f0b0fa 1e663de8 bfd122c3 e696b93d 31f62fd7 fc250d20 9d97a7de
a833443a 9b7518a2 35ff085c d73c77ff 85a88dee 1a4f33a5 00406382 fea155d8
1baa49fe 55e13af0 81442baf fa234b7b 71bde8b6 5d6d481e cd020301 0001