directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dran...@apache.org
Subject [23/45] directory-kerberos git commit: DIRKRB-149 New layout structure with the new name "Apache Kerby"
Date Thu, 22 Jan 2015 21:48:02 GMT
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-util/src/test/resources/camellia-expect-vt.txt
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-util/src/test/resources/camellia-expect-vt.txt b/haox-kerb/kerb-util/src/test/resources/camellia-expect-vt.txt
deleted file mode 100644
index e6ebe8a..0000000
--- a/haox-kerb/kerb-util/src/test/resources/camellia-expect-vt.txt
+++ /dev/null
@@ -1,1036 +0,0 @@
-
-KEYSIZE=128
-
-KEY=00000000000000000000000000000000
-
-I=1
-PT=80000000000000000000000000000000
-CT=07923A39EB0A817D1C4D87BDB82D1F1C
-
-I=2
-PT=40000000000000000000000000000000
-CT=48CD6419809672D2349260D89A08D3D3
-
-I=3
-PT=20000000000000000000000000000000
-CT=D07493CCB2E95CE0B4945A05ACC97D82
-
-I=4
-PT=10000000000000000000000000000000
-CT=5DBE1EAC9F7080A88DBED7F6DA101448
-
-I=5
-PT=08000000000000000000000000000000
-CT=F01EE477D199DF2701027034B229622F
-
-I=6
-PT=04000000000000000000000000000000
-CT=C841587ABD9A912E563774CB569D051E
-
-I=7
-PT=02000000000000000000000000000000
-CT=1D9BC0C04546F0915C8CCD11391A455C
-
-I=8
-PT=01000000000000000000000000000000
-CT=05E6EBB4BA167F5C479CEFF3152F943B
-
-I=9
-PT=00800000000000000000000000000000
-CT=93211E0F788845B9FC0E4551FFE92AC9
-
-I=10
-PT=00400000000000000000000000000000
-CT=B6D35701CD8FADDE383BBE8E6B70BAF7
-
-I=11
-PT=00200000000000000000000000000000
-CT=8358F9F4EBCFEE348CB30551ACB151A0
-
-I=12
-PT=00100000000000000000000000000000
-CT=D57516EB5AD93C523E40521BF447AFCE
-
-I=13
-PT=00080000000000000000000000000000
-CT=66B2534C279C439133F52E5AD8B439A9
-
-I=14
-PT=00040000000000000000000000000000
-CT=A71C69184A9F63C2992A5F18F77C1FE9
-
-I=15
-PT=00020000000000000000000000000000
-CT=1ADCBE49AEACB9ECEBBD492B10E82C7B
-
-I=16
-PT=00010000000000000000000000000000
-CT=27E3BCFB227C5561DB6CF7FC30387036
-
-I=17
-PT=00008000000000000000000000000000
-CT=F4AE20365CC9D06B0CAE6B695ED2CEC1
-
-I=18
-PT=00004000000000000000000000000000
-CT=3DD682F0B641ED32AD3D43EA2A0456E4
-
-I=19
-PT=00002000000000000000000000000000
-CT=6E5D14A95ECC290B509EA6B673652E3A
-
-I=20
-PT=00001000000000000000000000000000
-CT=F1CDF0F8D7B3FFD95422D7CC0CF40B7B
-
-I=21
-PT=00000800000000000000000000000000
-CT=A9253D459A34C385A1F1B2CFFA3935C5
-
-I=22
-PT=00000400000000000000000000000000
-CT=291024D99FF09A47A1DEE45BA700AE52
-
-I=23
-PT=00000200000000000000000000000000
-CT=49241D9459B277187BB10081C60361C0
-
-I=24
-PT=00000100000000000000000000000000
-CT=AD9BA365CC4DD5553D2D9FE303841D88
-
-I=25
-PT=00000080000000000000000000000000
-CT=C2ECA616664A249DC622CC11196B4AE1
-
-I=26
-PT=00000040000000000000000000000000
-CT=6E1A2D4794BB0DC08777A0BC7523E70E
-
-I=27
-PT=00000020000000000000000000000000
-CT=6DB1F0CF59656BDD235E82B8CEF0BE8E
-
-I=28
-PT=00000010000000000000000000000000
-CT=52F239C5EAF401EBDC54D2F011FF4B6A
-
-I=29
-PT=00000008000000000000000000000000
-CT=6B58A08F648414B67FD6847D2AA51CBF
-
-I=30
-PT=00000004000000000000000000000000
-CT=2959DD5367885A75EB48053CF3251A36
-
-I=31
-PT=00000002000000000000000000000000
-CT=630B292E3B88EF641CDFD531E206605E
-
-I=32
-PT=00000001000000000000000000000000
-CT=4BBB88EF82B70593FCC56AFD91540FDB
-
-I=33
-PT=00000000800000000000000000000000
-CT=0A13055B118A45C606999257BD191426
-
-I=34
-PT=00000000400000000000000000000000
-CT=5CF8E5C9F15D7E4F865020224853EB77
-
-I=35
-PT=00000000200000000000000000000000
-CT=3898805042C7A4315C5EE51AF2DE47E2
-
-I=36
-PT=00000000100000000000000000000000
-CT=8D3F96372E87CBB0B375425B3A10B9E7
-
-I=37
-PT=00000000080000000000000000000000
-CT=4D9510A378BD784A70A66BCC75B7D3C8
-
-I=38
-PT=00000000040000000000000000000000
-CT=70DB1902D37CFBDFB98F7C516F79D416
-
-I=39
-PT=00000000020000000000000000000000
-CT=383C6C2AABEF7FDE25CD470BF774A331
-
-I=40
-PT=00000000010000000000000000000000
-CT=47CBCB5288349B1A15DC9F81FBEE6B8F
-
-I=41
-PT=00000000008000000000000000000000
-CT=21DA34D4468EEB13AED95DAE0FF48310
-
-I=42
-PT=00000000004000000000000000000000
-CT=021C9A8E6BD36FBD036411E5D852A80F
-
-I=43
-PT=00000000002000000000000000000000
-CT=6A459E2F839AF60ACDE83774D0BB5574
-
-I=44
-PT=00000000001000000000000000000000
-CT=C19255121F1B933CAE09E58AEC0E9977
-
-I=45
-PT=00000000000800000000000000000000
-CT=7BA949E27B2BE148A6B801F9305F43D5
-
-I=46
-PT=00000000000400000000000000000000
-CT=E8CEB1026BCF7BCEA32E8A380EA76DB7
-
-I=47
-PT=00000000000200000000000000000000
-CT=63F97747ED56A8F521B20CC65F6F9465
-
-I=48
-PT=00000000000100000000000000000000
-CT=2091CFDC629819106188424AC694F75B
-
-I=49
-PT=00000000000080000000000000000000
-CT=A91BDF8E8B88407942423CCE000527C4
-
-I=50
-PT=00000000000040000000000000000000
-CT=73F9B44B9635A3FD683DBF8D49E9825B
-
-I=51
-PT=00000000000020000000000000000000
-CT=9DC64B2133FAD5069FD9A7CC2FFFD1CC
-
-I=52
-PT=00000000000010000000000000000000
-CT=28240F81FEC36B71E13F1FEA7A7641E3
-
-I=53
-PT=00000000000008000000000000000000
-CT=20DD39FEE96CD2EFF972872A692B28FD
-
-I=54
-PT=00000000000004000000000000000000
-CT=47A9E40483EC1925B635E47E964E8E93
-
-I=55
-PT=00000000000002000000000000000000
-CT=9C0EBD822C49FB3D853DF5B315A87BA0
-
-I=56
-PT=00000000000001000000000000000000
-CT=C18D813FDB45A594C6DC24E5A1F6CE32
-
-I=57
-PT=00000000000000800000000000000000
-CT=7E5467FF245ECF80CB55C2D8E91F0711
-
-I=58
-PT=00000000000000400000000000000000
-CT=394D4365B77954FDEA4145FCF7A7A041
-
-I=59
-PT=00000000000000200000000000000000
-CT=B1D8311A492ED11F11E57B29221610C4
-
-I=60
-PT=00000000000000100000000000000000
-CT=E5FBB947A63AEA90163AF04AD6951EF8
-
-I=61
-PT=00000000000000080000000000000000
-CT=CA0627DDF580F0E7D59562825C9D0492
-
-I=62
-PT=00000000000000040000000000000000
-CT=EF98FFD1AED295AAE1860F0274C8F555
-
-I=63
-PT=00000000000000020000000000000000
-CT=8C698E5CFFF08FACE10C2DC5FF1E2A81
-
-I=64
-PT=00000000000000010000000000000000
-CT=35A7767E02032C35B5CE1A6F49C57C28
-
-I=65
-PT=00000000000000008000000000000000
-CT=AB36F8734E76EBA306CF00D6763D90B0
-
-I=66
-PT=00000000000000004000000000000000
-CT=E854EB66D4EC66889B5E6CD4F44A5806
-
-I=67
-PT=00000000000000002000000000000000
-CT=15B66DF1455ACD640B8716BCF5DB2D69
-
-I=68
-PT=00000000000000001000000000000000
-CT=4C57AB5333E5C2D4B7E30A007E449F48
-
-I=69
-PT=00000000000000000800000000000000
-CT=BA3E7FF28EB38EA09D8DB1440A9A3552
-
-I=70
-PT=00000000000000000400000000000000
-CT=64E60227AFD80C40C70186CC94804C1A
-
-I=71
-PT=00000000000000000200000000000000
-CT=CEB4423C20B4C91C2551F6FC227C9514
-
-I=72
-PT=00000000000000000100000000000000
-CT=F736894B843EF32DA28576DE500D448C
-
-I=73
-PT=00000000000000000080000000000000
-CT=58FDA98B678D15053D4B6C060368108C
-
-I=74
-PT=00000000000000000040000000000000
-CT=E28CAE384E578F47657755EBCD97996C
-
-I=75
-PT=00000000000000000020000000000000
-CT=0A64617BD4B5B166668240D105B7B6A2
-
-I=76
-PT=00000000000000000010000000000000
-CT=4BD090C7E3D365B5EA80F19B4798881E
-
-I=77
-PT=00000000000000000008000000000000
-CT=BC7B6CB9BFF4F72973BB2CD20A512C06
-
-I=78
-PT=00000000000000000004000000000000
-CT=4C7ADDC5C867594E9EE75F0AA6AB9C23
-
-I=79
-PT=00000000000000000002000000000000
-CT=1FBD05C71A36691AC6566A5298101D53
-
-I=80
-PT=00000000000000000001000000000000
-CT=42D7D6B1F499D412F8793972BD968DA2
-
-I=81
-PT=00000000000000000000800000000000
-CT=260EC86E2786FC68824576B934F32814
-
-I=82
-PT=00000000000000000000400000000000
-CT=576C26DFD7046F9357F34BEA7DFB26A0
-
-I=83
-PT=00000000000000000000200000000000
-CT=6D55E54BFB6F927174A02294C95E0F8F
-
-I=84
-PT=00000000000000000000100000000000
-CT=1A6CE91DD458229C7675A34950D10E23
-
-I=85
-PT=00000000000000000000080000000000
-CT=DAD0D5E7E000652825AA34D228EA8D8F
-
-I=86
-PT=00000000000000000000040000000000
-CT=E68013F48D75EAD2BBC0B0BDA5E690BF
-
-I=87
-PT=00000000000000000000020000000000
-CT=A07D92312FBAE37BFE8A834210AE4F9C
-
-I=88
-PT=00000000000000000000010000000000
-CT=6EEE5F8544CD7D456366EB448813989A
-
-I=89
-PT=00000000000000000000008000000000
-CT=F8E5C7FF4B79D7ABE8BFA2DD148820A8
-
-I=90
-PT=00000000000000000000004000000000
-CT=C6349D75C7472BBD66F95B3A07C79C91
-
-I=91
-PT=00000000000000000000002000000000
-CT=B85713C12D8658951CD1AD21C74D2CD2
-
-I=92
-PT=00000000000000000000001000000000
-CT=907AA00B9F7D47A97623FB55BA911F29
-
-I=93
-PT=00000000000000000000000800000000
-CT=DC3CD0ED23D11776FAB43A2A6A8F3557
-
-I=94
-PT=00000000000000000000000400000000
-CT=4BFE58A8FD69179C14765B09AB70B705
-
-I=95
-PT=00000000000000000000000200000000
-CT=A23996E0EA67EC280356E5F77130A551
-
-I=96
-PT=00000000000000000000000100000000
-CT=CDEADE859B3AACD273CCA85A3E2E45F2
-
-I=97
-PT=00000000000000000000000080000000
-CT=E0FC78489857D84DA03F40CE97147174
-
-I=98
-PT=00000000000000000000000040000000
-CT=7615EA6351F6BB12855E8579C6995D8E
-
-I=99
-PT=00000000000000000000000020000000
-CT=13E184344FE28C2E70ED0E4D0A8037F9
-
-I=100
-PT=00000000000000000000000010000000
-CT=A5FE395F568482B87BC3EB208C81C942
-
-I=101
-PT=00000000000000000000000008000000
-CT=B3103E11AF06C85565823F8CAA3159F6
-
-I=102
-PT=00000000000000000000000004000000
-CT=7EBC2234D271B89C519C396985300030
-
-I=103
-PT=00000000000000000000000002000000
-CT=0661D338F2E0C939BA1687820A768467
-
-I=104
-PT=00000000000000000000000001000000
-CT=EC2B42667C0195A90715499617884DA5
-
-I=105
-PT=00000000000000000000000000800000
-CT=AE077BA19D24E7188DDD3682FF196892
-
-I=106
-PT=00000000000000000000000000400000
-CT=98823C24B9C65A66073C7952DC2B4B5E
-
-I=107
-PT=00000000000000000000000000200000
-CT=6AB58432CBB3C2F503DA2D16796CC297
-
-I=108
-PT=00000000000000000000000000100000
-CT=EEB5EBB3A53E4196C2F22BC1A4DDF5E8
-
-I=109
-PT=00000000000000000000000000080000
-CT=33DC40AC5FDC126D38878416AF6C0FA6
-
-I=110
-PT=00000000000000000000000000040000
-CT=38EDDC08E18B4AD982CEA921D2765A9A
-
-I=111
-PT=00000000000000000000000000020000
-CT=7D6BEA038E9347C642E18631660A9558
-
-I=112
-PT=00000000000000000000000000010000
-CT=FDA57921A473B5EE3700AD5ADF035019
-
-I=113
-PT=00000000000000000000000000008000
-CT=699B4812E200337E9C1D2C397F0DFE4E
-
-I=114
-PT=00000000000000000000000000004000
-CT=7A1EADF68B0807145D6C414852DECFC8
-
-I=115
-PT=00000000000000000000000000002000
-CT=1645FFAA8AD76689C01DA8C40882781F
-
-I=116
-PT=00000000000000000000000000001000
-CT=BA0C053BE702FA62FC66D8FEB12FC97E
-
-I=117
-PT=00000000000000000000000000000800
-CT=841FD8AF69CF2C31F7D4D7B6959662B5
-
-I=118
-PT=00000000000000000000000000000400
-CT=F675D59BDB33231861268F539829DA0B
-
-I=119
-PT=00000000000000000000000000000200
-CT=A4967F45ABB4E8C7DC5E3806680F35E0
-
-I=120
-PT=00000000000000000000000000000100
-CT=4D7E08081CC82F92ABA7C58C99F8343F
-
-I=121
-PT=00000000000000000000000000000080
-CT=9AEFDB287C119B82353612B60ECCBFD8
-
-I=122
-PT=00000000000000000000000000000040
-CT=979BB6A1553A17592A86E78DF144A699
-
-I=123
-PT=00000000000000000000000000000020
-CT=A6FA8CAB06FD2E5BF3A858983C01757A
-
-I=124
-PT=00000000000000000000000000000010
-CT=BE8511254C31E25420B91D6FEF1710ED
-
-I=125
-PT=00000000000000000000000000000008
-CT=F589A908D18A21894971C0433581E1A5
-
-I=126
-PT=00000000000000000000000000000004
-CT=4237585130E7C9F715235EB1D8C94DE7
-
-I=127
-PT=00000000000000000000000000000002
-CT=DEFE3E0B5C54C94B4F2A0F5A46F6210D
-
-I=128
-PT=00000000000000000000000000000001
-CT=F5574ACC3148DFCB9015200631024DF9
-
-==========
-
-KEYSIZE=256
-
-KEY=0000000000000000000000000000000000000000000000000000000000000000
-
-I=1
-PT=80000000000000000000000000000000
-CT=B0C6B88AEA518AB09E847248E91B1B9D
-
-I=2
-PT=40000000000000000000000000000000
-CT=B8D7684E35FA1DB15BDCEE7A48659858
-
-I=3
-PT=20000000000000000000000000000000
-CT=F0CAD59AF92FBB79F36951E697492750
-
-I=4
-PT=10000000000000000000000000000000
-CT=117100F6635389560DC4A2DA24EBA70F
-
-I=5
-PT=08000000000000000000000000000000
-CT=DBDD62355553019ED84C35886421E532
-
-I=6
-PT=04000000000000000000000000000000
-CT=9CB8D04FA506F19848F7B9110518BFC8
-
-I=7
-PT=02000000000000000000000000000000
-CT=E4308E253BC3444D293500701BA82C6A
-
-I=8
-PT=01000000000000000000000000000000
-CT=EA2FAE53F7F30C0170A20E95A068503E
-
-I=9
-PT=00800000000000000000000000000000
-CT=14B14839EA221880B2C64D1FE000B93D
-
-I=10
-PT=00400000000000000000000000000000
-CT=A5CFC075B342D5101AACC334E73058BB
-
-I=11
-PT=00200000000000000000000000000000
-CT=477EA56B2EBAD0F8AC5E1936866560FF
-
-I=12
-PT=00100000000000000000000000000000
-CT=107E8598418404196EC59F63E45B7F6D
-
-I=13
-PT=00080000000000000000000000000000
-CT=FF6A891E7C1C074A68FEC291928FDD8D
-
-I=14
-PT=00040000000000000000000000000000
-CT=F64C250A13F45D377ADB7545B2B157A9
-
-I=15
-PT=00020000000000000000000000000000
-CT=FAD0F252086F11C830C65B63197CBC38
-
-I=16
-PT=00010000000000000000000000000000
-CT=9DCB89B209441F02AD0D25C6AB826629
-
-I=17
-PT=00008000000000000000000000000000
-CT=E62E4ED4E4F34EDC563710D960E09D4C
-
-I=18
-PT=00004000000000000000000000000000
-CT=98A1B926BA06895C3F2E84CCBACBC356
-
-I=19
-PT=00002000000000000000000000000000
-CT=29BE0BE4DB7F4D196718AEA38F3B0BFD
-
-I=20
-PT=00001000000000000000000000000000
-CT=F670C4EBECBA0B43E71F6D752BFD4854
-
-I=21
-PT=00000800000000000000000000000000
-CT=7D7666B4484CDB7E3605468E093A787C
-
-I=22
-PT=00000400000000000000000000000000
-CT=562D06B181C091DA6C43642AE99460C6
-
-I=23
-PT=00000200000000000000000000000000
-CT=AB0EFB5975E6186B7D76BC9672453488
-
-I=24
-PT=00000100000000000000000000000000
-CT=10C0756538E7BFF88D19AE2B1F7B859A
-
-I=25
-PT=00000080000000000000000000000000
-CT=AF7FCD5248F8C72F1695AA05DD1CADE0
-
-I=26
-PT=00000040000000000000000000000000
-CT=9841E555655609A75D7BE20B8A90EF1E
-
-I=27
-PT=00000020000000000000000000000000
-CT=27F9546E6A1B7464780000561783569C
-
-I=28
-PT=00000010000000000000000000000000
-CT=8671D935D7A8354EECB7288803D42D7A
-
-I=29
-PT=00000008000000000000000000000000
-CT=0DA44F508DEBC6F044394624FCEB8EBE
-
-I=30
-PT=00000004000000000000000000000000
-CT=AB137369BE6D93FBB18006BDB236EC09
-
-I=31
-PT=00000002000000000000000000000000
-CT=EB90C4E597A7E1779FFA260886E26F75
-
-I=32
-PT=00000001000000000000000000000000
-CT=618CF3588D5C128EAF252616230E08F7
-
-I=33
-PT=00000000800000000000000000000000
-CT=98DC4DB49D197AB9152D12B9DE2D73CA
-
-I=34
-PT=00000000400000000000000000000000
-CT=5BDDE24B15702A35E1F140C57D206443
-
-I=35
-PT=00000000200000000000000000000000
-CT=CF755809882BED8BA2F9F1A4ED296A2B
-
-I=36
-PT=00000000100000000000000000000000
-CT=F1A8DBB999538AE89D16F92A7F4D1DF1
-
-I=37
-PT=00000000080000000000000000000000
-CT=775222FDDAAECB81CF675C4E0B98179E
-
-I=38
-PT=00000000040000000000000000000000
-CT=12A648CADCD153C760A965826683119A
-
-I=39
-PT=00000000020000000000000000000000
-CT=0503FB10AB241E7CF45D8CDEEE474335
-
-I=40
-PT=00000000010000000000000000000000
-CT=3D299C0070CBBD831B802690B8E7CA24
-
-I=41
-PT=00000000008000000000000000000000
-CT=33105BD4D11D66753DC34D128BEFE3F4
-
-I=42
-PT=00000000004000000000000000000000
-CT=5EFCE2B4B987C0F77D27B44836881682
-
-I=43
-PT=00000000002000000000000000000000
-CT=7835449454128035D7F0EA99E327577B
-
-I=44
-PT=00000000001000000000000000000000
-CT=27BEDDA0601BE35122FB1D272D73AB3E
-
-I=45
-PT=00000000000800000000000000000000
-CT=54C3F99FF48E318CC515EDE75800C4B3
-
-I=46
-PT=00000000000400000000000000000000
-CT=C627C329F8E48299F6FDB23B9DBEA0BB
-
-I=47
-PT=00000000000200000000000000000000
-CT=1B6578F9E23BD8C1845A02431C5F9AA3
-
-I=48
-PT=00000000000100000000000000000000
-CT=6DB2FB8C0B9344D0547C0FF1292020C6
-
-I=49
-PT=00000000000080000000000000000000
-CT=4FAD9B2C37C131493FBEF53581FA4F83
-
-I=50
-PT=00000000000040000000000000000000
-CT=47502A01E93D2C87BD5584F6AFD3D99D
-
-I=51
-PT=00000000000020000000000000000000
-CT=056E1C6F651BFE50271B3B7A18E76D84
-
-I=52
-PT=00000000000010000000000000000000
-CT=5632BAF6627B3D96AD4E06FA6A561F55
-
-I=53
-PT=00000000000008000000000000000000
-CT=E29807CAACDFA2D41A7D9E91FA7FD8EB
-
-I=54
-PT=00000000000004000000000000000000
-CT=81DD44BB5D1822DEE605F9E6FF01D7B3
-
-I=55
-PT=00000000000002000000000000000000
-CT=5C3649925E47D7FF96482A8FBD9666FD
-
-I=56
-PT=00000000000001000000000000000000
-CT=695415A836E66E737887845EC08A1ADB
-
-I=57
-PT=00000000000000800000000000000000
-CT=F5416BCE292D9E2CEA5D1CC70BBAEED1
-
-I=58
-PT=00000000000000400000000000000000
-CT=7AEC4F1388FC29C47F7FED74ADDE8485
-
-I=59
-PT=00000000000000200000000000000000
-CT=82A9F1A6CE08BC4876E649D8A8EA7EB6
-
-I=60
-PT=00000000000000100000000000000000
-CT=B6296C88ADF1A792908B065EEB04BFC2
-
-I=61
-PT=00000000000000080000000000000000
-CT=E766A39AECCA40BDBFBE6FF3FA292913
-
-I=62
-PT=00000000000000040000000000000000
-CT=C6D081454EA00D83C23B5A62C84359E1
-
-I=63
-PT=00000000000000020000000000000000
-CT=85D259A79CCA80484504D1603F7A8F53
-
-I=64
-PT=00000000000000010000000000000000
-CT=D8291FA1C6DC250078824B2D0A20883F
-
-I=65
-PT=00000000000000008000000000000000
-CT=95387CB74C48FFBD1F8D64A6CC45E074
-
-I=66
-PT=00000000000000004000000000000000
-CT=A17F975F538F56CDF629B516011DE837
-
-I=67
-PT=00000000000000002000000000000000
-CT=B50B615A1654C6E1CB6AB33716C097FE
-
-I=68
-PT=00000000000000001000000000000000
-CT=7BBB2CBB874DF6C8B821DA7FB0F9011B
-
-I=69
-PT=00000000000000000800000000000000
-CT=E9EFE074D096A275E47CD2E6206DF6A1
-
-I=70
-PT=00000000000000000400000000000000
-CT=88F2F8D5A836406AE8BBB98C65BBDA55
-
-I=71
-PT=00000000000000000200000000000000
-CT=F64620D8D87585A3EF038B9AD58F5EA0
-
-I=72
-PT=00000000000000000100000000000000
-CT=694438EC141C8ED5F2F898B4554A298F
-
-I=73
-PT=00000000000000000080000000000000
-CT=3E6226EC7726A1EE5F5FA9B18CCE8C44
-
-I=74
-PT=00000000000000000040000000000000
-CT=8AB6949E79911647800B9E87362AB97A
-
-I=75
-PT=00000000000000000020000000000000
-CT=093C5CF24EDAF7F9F1C8A80DE4FF50A9
-
-I=76
-PT=00000000000000000010000000000000
-CT=28A36E50061F19E240351ED0E378CBF4
-
-I=77
-PT=00000000000000000008000000000000
-CT=B93BB36CB88BF26EA79198652AA51D3C
-
-I=78
-PT=00000000000000000004000000000000
-CT=DE4948083D044FAC9BCA6DA8CD67B8A6
-
-I=79
-PT=00000000000000000002000000000000
-CT=6E778B5BDA6CA118117E47470D080D3C
-
-I=80
-PT=00000000000000000001000000000000
-CT=0A9107324DA32B4281D032A3487EF875
-
-I=81
-PT=00000000000000000000800000000000
-CT=18ED5635312D71ABD123CCE779D4D68A
-
-I=82
-PT=00000000000000000000400000000000
-CT=2E3C63F95C4BC1F944BAB06DEDC9AA8E
-
-I=83
-PT=00000000000000000000200000000000
-CT=ACCC869EF07004C8C3C709083BE7BA2F
-
-I=84
-PT=00000000000000000000100000000000
-CT=DF60B34FB1A59147CC1FB049C1578206
-
-I=85
-PT=00000000000000000000080000000000
-CT=4228DC636C08E41021054AA0E1E2227A
-
-I=86
-PT=00000000000000000000040000000000
-CT=7CE27F66EFD735FFD6B3E1738C50495B
-
-I=87
-PT=00000000000000000000020000000000
-CT=F8E74B33A9CDE351DA0BBC06D69093D7
-
-I=88
-PT=00000000000000000000010000000000
-CT=AE0D22A5B37B8DC5D81CC641EED334D0
-
-I=89
-PT=00000000000000000000008000000000
-CT=C181C6CA5E163743458B9167A0B6A16A
-
-I=90
-PT=00000000000000000000004000000000
-CT=5171F4F6095E4B276CFBA1F07223FBE6
-
-I=91
-PT=00000000000000000000002000000000
-CT=2732F4D3A8C9D1D8D493840D6E0B864F
-
-I=92
-PT=00000000000000000000001000000000
-CT=3EF04E0059A061D973532CA5C1DFBE7B
-
-I=93
-PT=00000000000000000000000800000000
-CT=6D9A8F23579E4978EBAA87B5ADEB77E5
-
-I=94
-PT=00000000000000000000000400000000
-CT=BBD08873CC44BA4253C0C41FEEB7F124
-
-I=95
-PT=00000000000000000000000200000000
-CT=72E4B2437CBD283F3809CE686F6A591E
-
-I=96
-PT=00000000000000000000000100000000
-CT=6E5580514B92512B1BF4B1B987B9AA1B
-
-I=97
-PT=00000000000000000000000080000000
-CT=5EF5D0C5BCBDCB604D3A083B68CE0FA3
-
-I=98
-PT=00000000000000000000000040000000
-CT=9D991FDD723AD2182777A15CA0E0F665
-
-I=99
-PT=00000000000000000000000020000000
-CT=24440626EFC8F86BEA7DE78085AB8A22
-
-I=100
-PT=00000000000000000000000010000000
-CT=17C3630D62D13C1E826C0FCCBD74A864
-
-I=101
-PT=00000000000000000000000008000000
-CT=4CF5AB86A56AB134A7FE46CCE3F9FCE9
-
-I=102
-PT=00000000000000000000000004000000
-CT=3E6B9C0388F6D9B8F458F30221907607
-
-I=103
-PT=00000000000000000000000002000000
-CT=AD9C926B8A5CD98EEE88200617E59958
-
-I=104
-PT=00000000000000000000000001000000
-CT=AFF8AED5E075E02AF720CA4BF0028B3B
-
-I=105
-PT=00000000000000000000000000800000
-CT=D90EAFF909202BB209BB3BB8C7F9A954
-
-I=106
-PT=00000000000000000000000000400000
-CT=2C709B00E6A22F00F64A7D8EE341853F
-
-I=107
-PT=00000000000000000000000000200000
-CT=CCEC598F0D9F0BF201B2F487136D54A4
-
-I=108
-PT=00000000000000000000000000100000
-CT=73B2883A0A166AAE1BF14E60A5195FA3
-
-I=109
-PT=00000000000000000000000000080000
-CT=E676867BD9AD5EF915143388496779D7
-
-I=110
-PT=00000000000000000000000000040000
-CT=CDCB73D1BFCFD4BE7F1DAA9B1C6A4055
-
-I=111
-PT=00000000000000000000000000020000
-CT=02A3A5C89DAA24CD2C517F7A73286A89
-
-I=112
-PT=00000000000000000000000000010000
-CT=C0FA2AC9E92EE58C2DD12D6D43AB7035
-
-I=113
-PT=00000000000000000000000000008000
-CT=EDC2CB1F7291353BDBF2385519E6AE16
-
-I=114
-PT=00000000000000000000000000004000
-CT=B4B62D16D197A98CD3B978812B9D9884
-
-I=115
-PT=00000000000000000000000000002000
-CT=5CDFC95A529A905101CEA26BC1B891ED
-
-I=116
-PT=00000000000000000000000000001000
-CT=CC7150CD3650B98363296C7C4ED368D1
-
-I=117
-PT=00000000000000000000000000000800
-CT=CC57706B0C6526B8E25A5DBD32EACBDB
-
-I=118
-PT=00000000000000000000000000000400
-CT=30D30456AD98B182D64C649648F6AEC9
-
-I=119
-PT=00000000000000000000000000000200
-CT=D7E9DA7F631938EB649A08AF82FBD75F
-
-I=120
-PT=00000000000000000000000000000100
-CT=B8DA2AF6600B07895B5D0FFAF4991469
-
-I=121
-PT=00000000000000000000000000000080
-CT=0F6F64F930BA6C178943322B98114599
-
-I=122
-PT=00000000000000000000000000000040
-CT=8B1F247802E47C91BEE2AA34ECFD7A01
-
-I=123
-PT=00000000000000000000000000000020
-CT=7A6985778D3A66E97F23E01F0D0E45E7
-
-I=124
-PT=00000000000000000000000000000010
-CT=BA664AC39855518DFDEE10D1B3111FAE
-
-I=125
-PT=00000000000000000000000000000008
-CT=7C92854D801A1648F65CA81813DDBF83
-
-I=126
-PT=00000000000000000000000000000004
-CT=6A3F25AAB7E92D9CF378E5D9C040F26B
-
-I=127
-PT=00000000000000000000000000000002
-CT=3D4B2CDE666761BA5DFB305178E667FB
-
-I=128
-PT=00000000000000000000000000000001
-CT=9CDB269B5D293BC5DB9C55B057D9B591
-
-==========

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-util/src/test/resources/camellia128-cts-cmac.cc
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-util/src/test/resources/camellia128-cts-cmac.cc b/haox-kerb/kerb-util/src/test/resources/camellia128-cts-cmac.cc
deleted file mode 100644
index 5d6f8a5..0000000
Binary files a/haox-kerb/kerb-util/src/test/resources/camellia128-cts-cmac.cc and /dev/null differ

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-util/src/test/resources/camellia256-cts-cmac.cc
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-util/src/test/resources/camellia256-cts-cmac.cc b/haox-kerb/kerb-util/src/test/resources/camellia256-cts-cmac.cc
deleted file mode 100644
index c9a6ecd..0000000
Binary files a/haox-kerb/kerb-util/src/test/resources/camellia256-cts-cmac.cc and /dev/null differ

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-util/src/test/resources/des-cbc-crc.cc
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-util/src/test/resources/des-cbc-crc.cc b/haox-kerb/kerb-util/src/test/resources/des-cbc-crc.cc
deleted file mode 100644
index b43fe30..0000000
Binary files a/haox-kerb/kerb-util/src/test/resources/des-cbc-crc.cc and /dev/null differ

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-util/src/test/resources/des3-cbc-sha1.cc
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-util/src/test/resources/des3-cbc-sha1.cc b/haox-kerb/kerb-util/src/test/resources/des3-cbc-sha1.cc
deleted file mode 100644
index ba2f6ea..0000000
Binary files a/haox-kerb/kerb-util/src/test/resources/des3-cbc-sha1.cc and /dev/null differ

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-util/src/test/resources/krbtgt.keytab
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-util/src/test/resources/krbtgt.keytab b/haox-kerb/kerb-util/src/test/resources/krbtgt.keytab
deleted file mode 100644
index 08bd0c1..0000000
Binary files a/haox-kerb/kerb-util/src/test/resources/krbtgt.keytab and /dev/null differ

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-util/src/test/resources/test.cc
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-util/src/test/resources/test.cc b/haox-kerb/kerb-util/src/test/resources/test.cc
deleted file mode 100644
index 22a27e8..0000000
Binary files a/haox-kerb/kerb-util/src/test/resources/test.cc and /dev/null differ

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-util/src/test/resources/test.keytab
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-util/src/test/resources/test.keytab b/haox-kerb/kerb-util/src/test/resources/test.keytab
deleted file mode 100644
index 5a9c733..0000000
Binary files a/haox-kerb/kerb-util/src/test/resources/test.keytab and /dev/null differ

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/pom.xml
----------------------------------------------------------------------
diff --git a/haox-kerb/pom.xml b/haox-kerb/pom.xml
deleted file mode 100644
index 245b13d..0000000
--- a/haox-kerb/pom.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License. See accompanying LICENSE file.
--->
-<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>
-
-  <parent>
-    <groupId>org.haox</groupId>
-    <artifactId>haox-all</artifactId>
-    <version>1.0-SNAPSHOT</version>
-  </parent>
-  
-  <artifactId>haox-kerb</artifactId>
-  <name>Haox-kerb Project</name>
-  <version>1.0-SNAPSHOT</version>
-  <packaging>pom</packaging>
-
-  <modules>
-    <module>kerb-core</module>
-    <module>kerb-core-test</module>
-    <module>kerb-common</module>
-    <module>kerb-util</module>
-    <module>kerb-crypto</module>
-    <module>kerb-identity</module>
-    <module>kerb-client</module>
-    <module>kerb-server</module>
-    <module>kerb-kdc-test</module>
-  </modules>
-
-  <dependencies>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kdc-backend/README
----------------------------------------------------------------------
diff --git a/kdc-backend/README b/kdc-backend/README
new file mode 100644
index 0000000..583763c
--- /dev/null
+++ b/kdc-backend/README
@@ -0,0 +1,5 @@
+A KDC implementation that integrates PKI and OAuth Token with an LDAP backend.
+The KDC server can be standalone.
+The LDAP backend can be standalone or embedded.
+Various tools like kinit, kadmin will be provided or
+at least, existing tools can be supported.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kdc-backend/ldap-identity-backend/pom.xml
----------------------------------------------------------------------
diff --git a/kdc-backend/ldap-identity-backend/pom.xml b/kdc-backend/ldap-identity-backend/pom.xml
new file mode 100644
index 0000000..7d6acc2
--- /dev/null
+++ b/kdc-backend/ldap-identity-backend/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License. See accompanying LICENSE file.
+-->
+<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>
+
+  <parent>
+    <groupId>org.apache.kerby</groupId>
+    <artifactId>kdc-backend</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>ldap-identity-backend</artifactId>
+
+  <name>Ldap identity backend</name>
+  <description>Ldap identity backend</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.kerby</groupId>
+      <artifactId>kerby-config</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.kerby</groupId>
+      <artifactId>kerb-identity</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kdc-backend/ldap-identity-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
----------------------------------------------------------------------
diff --git a/kdc-backend/ldap-identity-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java b/kdc-backend/ldap-identity-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
new file mode 100644
index 0000000..37e6862
--- /dev/null
+++ b/kdc-backend/ldap-identity-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
@@ -0,0 +1,77 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.kerby.kerberos.kdc.identitybackend;
+
+import org.apache.kerby.kerberos.kerb.identity.KrbIdentity;
+import org.apache.kerby.kerberos.kerb.identity.backend.AbstractIdentityBackend;
+
+import java.util.List;
+
+public class LdapIdentityBackend extends AbstractIdentityBackend {
+
+
+    public LdapIdentityBackend() {
+        super();
+    }
+
+    /**
+     * Load identities from file
+     */
+    public void load() {
+        // todo
+    }
+
+    /**
+     * Persist the updated identities back
+     */
+    public void save() {
+        // todo
+    }
+
+    @Override
+    public List<KrbIdentity> getIdentities() {
+        return null;
+    }
+
+    @Override
+    public boolean checkIdentity(String name) {
+        return false;
+    }
+
+    @Override
+    public KrbIdentity getIdentity(String name) {
+        return null;
+    }
+
+    @Override
+    public void addIdentity(KrbIdentity identity) {
+
+    }
+
+    @Override
+    public void updateIdentity(KrbIdentity identity) {
+
+    }
+
+    @Override
+    public void deleteIdentity(KrbIdentity identity) {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kdc-backend/pom.xml
----------------------------------------------------------------------
diff --git a/kdc-backend/pom.xml b/kdc-backend/pom.xml
new file mode 100644
index 0000000..8f81d7b
--- /dev/null
+++ b/kdc-backend/pom.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License. See accompanying LICENSE file.
+-->
+<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>
+
+  <parent>
+    <groupId>org.apache.kerby</groupId>
+    <artifactId>kerby-all</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>kdc-backend</artifactId>
+  <name>Kdc Backend Project</name>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <modules>
+    <module>ldap-identity-backend</module>
+  </modules>
+</project>

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kerby-asn1/README.md
----------------------------------------------------------------------
diff --git a/kerby-asn1/README.md b/kerby-asn1/README.md
new file mode 100644
index 0000000..eb35929
--- /dev/null
+++ b/kerby-asn1/README.md
@@ -0,0 +1,301 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+haox-asn1
+=========
+
+### A ASN1 parser with easy and simple API
+
+```
+// encoding
+Asn1Integer aValue = new Asn1Integer(8899);
+byte[] encoded = aValue.encode();
+
+// decoding
+byte[] contentToDecode = ...
+Asn1Integer decodedValue = new Asn1Integer();
+decodedValue.decode(contentToDecode);
+Integer value = decodedValue.getValue();
+```
+
+### Data-driven ASN1 encoding/decoding framework and parser
+
+With the following definition from Kerberos protocol
+```
+ AuthorizationData ::= SEQUENCE OF SEQUENCE {
+     ad-type         [0] Int32,
+     ad-data         [1] OCTET STRING
+ }
+ ```
+ 
+You can model AuthzDataEntry as follows
+```java
+public class AuthzDataEntry extends Asn1SequenceType {
+    static int AD_TYPE = 0;
+    static int AD_DATA = 1;
+
+    public AuthzDataEntry() {
+        super(new Asn1FieldInfo[] {
+                new Asn1FieldInfo(AD_TYPE, Asn1Integer.class),
+                new Asn1FieldInfo(AD_DATA, Asn1OctetString.class)
+        });
+    }
+
+    public int getAuthzType() {
+        Integer value = getFieldAsInteger(AD_TYPE);
+        return value;
+    }
+
+    public byte[] getAuthzData() {
+        return getFieldAsOctetBytes(AD_DATA);
+    }
+}
+```
+
+And then define AuthorizationData simply
+```java
+public class AuthorizationData extends Asn1SequenceOf<AuthzDataEntry> {
+
+}
+```
+
+Then you can process with above definitions, encode and decode, without caring about the details.
+
+Think about how to implement the following more complex and pratical sample from [ITU-T Rec. X.680 ISO/IEC 8824-1](http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf):
+```
+A.1 ASN.1 description of the record structure
+The structure of the hypothetical personnel record is formally described below using ASN.1 specified in
+ITU-T Rec. X.680 | ISO/IEC 8824-1 for defining types.
+
+PersonnelRecord ::= [APPLICATION 0] IMPLICIT SET {
+    Name Name,
+    title [0] VisibleString,
+    number EmployeeNumber,
+    dateOfHire [1] Date,
+    nameOfSpouse [2] Name,
+    children [3] IMPLICIT
+    SEQUENCE OF ChildInformation DEFAULT {} 
+}
+
+ChildInformation ::= SET {
+    name Name,
+    dateOfBirth [0] Date
+}
+
+Name ::= [APPLICATION 1] IMPLICIT SEQUENCE {
+    givenName VisibleString,
+    initial VisibleString,
+    familyName VisibleString
+}
+
+EmployeeNumber ::= [APPLICATION 2] IMPLICIT INTEGER
+Date ::= [APPLICATION 3] IMPLICIT VisibleString -- YYYYMMDD
+```
+Similarly as above, we can have (from the unit test codes):
+```java
+public class PersonnelRecord extends TaggingSet {
+    private static int NAME = 0;
+    private static int TITLE = 1;
+    private static int NUMBER = 2;
+    private static int DATEOFHIRE= 3;
+    private static int NAMEOFSPOUSE = 4;
+    private static int CHILDREN = 5;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(NAME, -1, Name.class),
+            new Asn1FieldInfo(TITLE, 0, Asn1VisibleString.class),
+            new Asn1FieldInfo(NUMBER, -1, EmployeeNumber.class),
+            new Asn1FieldInfo(DATEOFHIRE, 1, Date.class),
+            new Asn1FieldInfo(NAMEOFSPOUSE, 2, Name.class),
+            new Asn1FieldInfo(CHILDREN, 3, Children.class, true)
+    };
+
+    public PersonnelRecord() {
+        super(0, fieldInfos, true);
+        setEncodingOption(EncodingOption.IMPLICIT);
+    }
+
+    public void setName(Name name) {
+        setFieldAs(NAME, name);
+    }
+
+    public Name getName() {
+        return getFieldAs(NAME, Name.class);
+    }
+
+    public void setTitle(String title) {
+        setFieldAs(TITLE, new Asn1VisibleString(title));
+    }
+
+    public String getTitle() {
+        return getFieldAsString(TITLE);
+    }
+
+    public void setEmployeeNumber(EmployeeNumber employeeNumber) {
+        setFieldAs(NUMBER, employeeNumber);
+    }
+
+    public EmployeeNumber getEmployeeNumber() {
+        return getFieldAs(NUMBER, EmployeeNumber.class);
+    }
+
+    public void setDateOfHire(Date dateOfHire) {
+        setFieldAs(DATEOFHIRE, dateOfHire);
+    }
+
+    public Date getDateOfHire() {
+        return getFieldAs(DATEOFHIRE, Date.class);
+    }
+
+    public void setNameOfSpouse(Name spouse) {
+        setFieldAs(NAMEOFSPOUSE, spouse);
+    }
+
+    public Name getNameOfSpouse() {
+        return getFieldAs(NAMEOFSPOUSE, Name.class);
+    }
+
+    public void setChildren(Children children) {
+        setFieldAs(CHILDREN, children);
+    }
+
+    public Children getChildren() {
+        return getFieldAs(CHILDREN, Children.class);
+    }
+
+    public static class Children extends Asn1SequenceOf<ChildInformation> {
+        public Children(ChildInformation ... children) {
+            super();
+            for (ChildInformation child : children) {
+                addElement(child);
+            }
+        }
+
+        public Children() {
+            super();
+        }
+    }
+
+    public static class ChildInformation extends Asn1SetType {
+        private static int NAME = 0;
+        private static int DATEOFBIRTH = 1;
+
+        static Asn1FieldInfo[] tags = new Asn1FieldInfo[] {
+                new Asn1FieldInfo(NAME, -1, Name.class),
+                new Asn1FieldInfo(DATEOFBIRTH, 0, Date.class)
+        };
+
+        public ChildInformation() {
+            super(tags);
+        }
+
+        public void setName(Name name) {
+            setFieldAs(NAME, name);
+        }
+
+        public Name getName() {
+            return getFieldAs(NAME, Name.class);
+        }
+
+        public void setDateOfBirth(Date date) {
+            setFieldAs(DATEOFBIRTH, date);
+        }
+
+        public Date getDateOfBirth() {
+            return getFieldAs(DATEOFBIRTH, Date.class);
+        }
+    }
+
+    public static class Name extends TaggingSequence {
+        private static int GIVENNAME = 0;
+        private static int INITIAL = 1;
+        private static int FAMILYNAME = 2;
+
+        static Asn1FieldInfo[] tags = new Asn1FieldInfo[] {
+                new Asn1FieldInfo(GIVENNAME, -1, Asn1VisibleString.class),
+                new Asn1FieldInfo(INITIAL, -1, Asn1VisibleString.class),
+                new Asn1FieldInfo(FAMILYNAME, -1, Asn1VisibleString.class)
+        };
+
+        public Name() {
+            super(1, tags, true);
+            setEncodingOption(EncodingOption.IMPLICIT);
+        }
+
+        public Name(String givenName, String initial, String familyName) {
+            this();
+            setGivenName(givenName);
+            setInitial(initial);
+            setFamilyName(familyName);
+        }
+
+        public void setGivenName(String givenName) {
+            setFieldAs(GIVENNAME, new Asn1VisibleString(givenName));
+        }
+
+        public String getGivenName() {
+            return getFieldAsString(GIVENNAME);
+        }
+
+        public void setInitial(String initial) {
+            setFieldAs(INITIAL, new Asn1VisibleString(initial));
+        }
+
+        public String getInitial() {
+            return getFieldAsString(INITIAL);
+        }
+
+        public void setFamilyName(String familyName) {
+            setFieldAs(FAMILYNAME, new Asn1VisibleString(familyName));
+        }
+
+        public String getFamilyName() {
+            return getFieldAsString(FAMILYNAME);
+        }
+    }
+
+    public static class EmployeeNumber extends Asn1Tagging<Asn1Integer> {
+        public EmployeeNumber(Integer value) {
+            super(2, new Asn1Integer(value), true);
+            setEncodingOption(EncodingOption.IMPLICIT);
+        }
+        public EmployeeNumber() {
+            this(null);
+        }
+    }
+
+    public static class Date extends Asn1Tagging<Asn1VisibleString> {
+        public Date(String value) {
+            super(3, new Asn1VisibleString(value), true);
+            setEncodingOption(EncodingOption.IMPLICIT);
+        }
+        public Date() {
+            this(null);
+        }
+    }
+}
+```
+### Notes
+* 90% tests coverage for DER encoding
+* For BER & CER encoding, to be fully supported
+* No extra dependency
+
+### License
+Apache V2 License
+
+
+

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kerby-asn1/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-asn1/pom.xml b/kerby-asn1/pom.xml
new file mode 100644
index 0000000..b667443
--- /dev/null
+++ b/kerby-asn1/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License. See accompanying LICENSE file.
+-->
+<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/xsd/maven-4.0.0.xsd">
+
+  <parent>
+    <groupId>org.apache.kerby</groupId>
+    <artifactId>kerby-all</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>kerby-asn1</artifactId>
+  <name>Kerby ASN1 Project</name>
+  <description>Kerby ASN1 Project</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>${junit.version}</version>
+    </dependency>
+  </dependencies>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Dump.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Dump.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Dump.java
new file mode 100644
index 0000000..cfd9c5d
--- /dev/null
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Dump.java
@@ -0,0 +1,70 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.kerby.asn1;
+
+import org.apache.kerby.asn1.type.Asn1Item;
+import org.apache.kerby.asn1.type.Asn1Simple;
+import org.apache.kerby.asn1.type.Asn1Type;
+
+import java.io.IOException;
+
+public class Asn1Dump {
+
+    public static void dump(byte[] content) throws IOException {
+        String dumped = dumpAsString(content);
+        System.out.println(dumped);
+    }
+
+    public static String dumpAsString(byte[] content) throws IOException {
+        StringBuilder sb = new StringBuilder();
+
+        Asn1InputBuffer buffer = new Asn1InputBuffer(content);
+        Asn1Type value;
+        while (true) {
+            value = buffer.read();
+            if (value == null) break;
+            dump(value, sb);
+        }
+
+        return sb.toString();
+    }
+
+    public static String dumpAsString(Asn1Type value) {
+        StringBuilder sb = new StringBuilder();
+        dump(value, sb);
+        return sb.toString();
+    }
+
+    private static void dump(Asn1Type value, StringBuilder buffer) {
+        if (value instanceof Asn1Simple) {
+            buffer.append(((Asn1Simple) value).getValue().toString());
+        } else if (value instanceof Asn1Item) {
+            dump((Asn1Item) value, buffer);
+        }
+    }
+
+    private static void dump(Asn1Item value, StringBuilder buffer) {
+        if (value.isFullyDecoded()) {
+            dump(value.getValue(), buffer);
+        } else {
+            buffer.append("Asn1Item");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Factory.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Factory.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Factory.java
new file mode 100644
index 0000000..2762476
--- /dev/null
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Factory.java
@@ -0,0 +1,44 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.kerby.asn1;
+
+import org.apache.kerby.asn1.type.Asn1Collection;
+import org.apache.kerby.asn1.type.Asn1Simple;
+import org.apache.kerby.asn1.type.Asn1Type;
+
+public class Asn1Factory {
+
+    public static Asn1Type create(int tagNo) {
+        UniversalTag tagNoEnum = UniversalTag.fromValue(tagNo);
+        if (tagNoEnum != UniversalTag.UNKNOWN) {
+            return create(tagNoEnum);
+        }
+        throw new IllegalArgumentException("Unexpected tag " + tagNo);
+    }
+
+    public static Asn1Type create(UniversalTag tagNo) {
+        if (Asn1Simple.isSimple(tagNo)) {
+            return Asn1Simple.createSimple(tagNo);
+        } else if (Asn1Collection.isCollection(tagNo)) {
+            return Asn1Collection.createCollection(tagNo);
+        }
+        throw new IllegalArgumentException("Unexpected tag " + tagNo);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1InputBuffer.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1InputBuffer.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1InputBuffer.java
new file mode 100644
index 0000000..934b0c1
--- /dev/null
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1InputBuffer.java
@@ -0,0 +1,82 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.kerby.asn1;
+
+import org.apache.kerby.asn1.type.AbstractAsn1Type;
+import org.apache.kerby.asn1.type.Asn1Item;
+import org.apache.kerby.asn1.type.Asn1Type;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+/**
+ * Asn1 decoder
+ */
+public class Asn1InputBuffer {
+    private final LimitedByteBuffer limitedBuffer;
+
+    public Asn1InputBuffer(byte[] bytes) {
+        this(new LimitedByteBuffer(bytes));
+    }
+
+    public Asn1InputBuffer(ByteBuffer byteBuffer) {
+        this(new LimitedByteBuffer(byteBuffer));
+    }
+
+    public Asn1InputBuffer(LimitedByteBuffer limitedByteBuffer) {
+        this.limitedBuffer = limitedByteBuffer;
+    }
+
+    public Asn1Type read() throws IOException {
+        if (! limitedBuffer.available()) {
+            return null;
+        }
+        Asn1Item one = AbstractAsn1Type.decodeOne(limitedBuffer);
+        if (one.isSimple()) {
+            one.decodeValueAsSimple();
+        } else if (one.isCollection()) {
+            one.decodeValueAsCollection();
+        }
+        if (one.isFullyDecoded()) {
+            return one.getValue();
+        }
+        return one;
+    }
+
+    public void readBytes(byte[] bytes) throws IOException {
+        limitedBuffer.readBytes(bytes);
+    }
+
+    public byte[] readAllLeftBytes() throws IOException {
+        return limitedBuffer.readAllLeftBytes();
+    }
+
+    public void skipNext() throws IOException {
+        if (limitedBuffer.available()) {
+            AbstractAsn1Type.skipOne(limitedBuffer);
+        }
+    }
+
+    public void skipBytes(int len) throws IOException {
+        if (limitedBuffer.available()) {
+            limitedBuffer.skip(len);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1OutputBuffer.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1OutputBuffer.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1OutputBuffer.java
new file mode 100644
index 0000000..42f8ead
--- /dev/null
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1OutputBuffer.java
@@ -0,0 +1,72 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.kerby.asn1;
+
+import org.apache.kerby.asn1.type.AbstractAsn1Type;
+import org.apache.kerby.asn1.type.Asn1Type;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Asn1 encoder
+ */
+public class Asn1OutputBuffer {
+    private List<Asn1Type> objects;
+
+    public Asn1OutputBuffer() {
+        this.objects = new ArrayList<Asn1Type>(3);
+    }
+
+    public void write(Asn1Type value) {
+        objects.add(value);
+    }
+
+    public void write(Asn1Type value, EncodingOption option) {
+        value.setEncodingOption(option);
+        objects.add(value);
+    }
+
+    public ByteBuffer getOutput() {
+        int len = encodingLength();
+        ByteBuffer byteBuffer = ByteBuffer.allocate(len);
+        encode(byteBuffer);
+        return byteBuffer;
+    }
+
+    private int encodingLength() {
+        int allLen = 0;
+        for (Asn1Type item : objects) {
+            if (item != null) {
+                allLen += ((AbstractAsn1Type) item).encodingLength();
+            }
+        }
+        return allLen;
+    }
+
+    private void encode(ByteBuffer buffer) {
+        for (Asn1Type item : objects) {
+            if (item != null) {
+                item.encode(buffer);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kerby-asn1/src/main/java/org/apache/kerby/asn1/EncodingOption.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/EncodingOption.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/EncodingOption.java
new file mode 100644
index 0000000..c15f5ce
--- /dev/null
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/EncodingOption.java
@@ -0,0 +1,84 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.kerby.asn1;
+
+public enum EncodingOption
+{
+    UNKNOWN(-1),
+    PRIMITIVE(1),
+    CONSTRUCTED(2),
+    CONSTRUCTED_DEFLEN(3),
+    CONSTRUCTED_INDEFLEN(4),
+    IMPLICIT(5),
+    EXPLICIT(6),
+    BER(7),
+    DER(8),
+    CER(9);
+
+    private int value;
+
+    private EncodingOption(int value) {
+        this.value = value;
+    }
+
+    public static int CONSTRUCTED_FLAG = 0x20;
+
+    public static boolean isConstructed(int tag) {
+        return (tag & CONSTRUCTED_FLAG) != 0;
+    }
+
+    public int getValue() {
+        return value;
+    }
+
+    public boolean isPrimitive() {
+        return this == PRIMITIVE;
+    }
+
+    public boolean isConstructed() {
+        return this == CONSTRUCTED || this == CONSTRUCTED_DEFLEN || this == CONSTRUCTED_INDEFLEN;
+    }
+
+    public boolean isImplicit() {
+        return this == IMPLICIT;
+    }
+
+    public boolean isExplicit() {
+        return this == EXPLICIT;
+    }
+
+    public boolean isDer() {
+        return this == DER;
+    }
+
+    public boolean isCer() {
+        return this == CER;
+    }
+
+    public static EncodingOption fromValue(int value) {
+        for (EncodingOption e : values()) {
+            if (e.getValue() == value) {
+                return (EncodingOption) e;
+            }
+        }
+
+        return UNKNOWN;
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kerby-asn1/src/main/java/org/apache/kerby/asn1/LimitedByteBuffer.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/LimitedByteBuffer.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/LimitedByteBuffer.java
new file mode 100644
index 0000000..ed5332b
--- /dev/null
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/LimitedByteBuffer.java
@@ -0,0 +1,121 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.kerby.asn1;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+public class LimitedByteBuffer {
+    private final ByteBuffer byteBuffer;
+    private final int limit;
+    private int startOffset;
+
+    public LimitedByteBuffer(byte[] bytes) {
+        this.byteBuffer = ByteBuffer.wrap(bytes);
+        this.limit = bytes.length;
+        this.startOffset = 0;
+    }
+
+    public LimitedByteBuffer(ByteBuffer byteBuffer) {
+        this(byteBuffer, byteBuffer.limit());
+    }
+
+    public LimitedByteBuffer(ByteBuffer byteBuffer, int limit) {
+        this.byteBuffer = byteBuffer;
+        this.limit = limit;
+        this.startOffset = byteBuffer.position();
+    }
+
+    public LimitedByteBuffer(LimitedByteBuffer other, int limit) {
+        if (limit > other.hasLeft()) {
+            throw new IllegalArgumentException("limit is too large, out of bound");
+        }
+        this.byteBuffer = other.byteBuffer.duplicate();
+        this.limit = limit;
+        this.startOffset = byteBuffer.position();
+    }
+
+    public boolean available() {
+        return byteBuffer.hasRemaining() &&
+                byteBuffer.position() - startOffset < limit;
+    }
+
+    public long hasRead() {
+        return byteBuffer.position() - startOffset;
+    }
+    public long hasLeft() {
+        return limit - hasRead();
+    }
+
+    public byte readByte() throws IOException {
+        if (!available()) {
+            throw new IOException("Buffer EOF");
+        }
+        return byteBuffer.get();
+    }
+
+    public byte[] readAllLeftBytes() throws IOException {
+        return readBytes((int) hasLeft());
+    }
+
+    public void skip(int len) throws IOException {
+        checkLen(len);
+        int newPos = byteBuffer.position() + len;
+        byteBuffer.position(newPos);
+    }
+
+    public byte[] readBytes(int len) throws IOException {
+        checkLen(len);
+
+        byte[] bytes = new byte[len];
+        if (len > 0) {
+            byteBuffer.get(bytes);
+        }
+        return bytes;
+    }
+
+    private void checkLen(int len) throws IOException {
+        if (len < 0) {
+            throw new IllegalArgumentException("Bad argument len: " + len);
+        }
+        if (len > 0) {
+            if (!available()) {
+                throw new IOException("Buffer EOF");
+            }
+            if (hasLeft() < len) {
+                throw new IOException("Out of Buffer");
+            }
+        }
+    }
+
+    public void readBytes(byte[] bytes) throws IOException {
+        if (bytes == null) {
+            throw new IllegalArgumentException("Bad argument bytes: null");
+        }
+        if (!available()) {
+            throw new IOException("Buffer EOF");
+        }
+        if (hasLeft() < bytes.length) {
+            throw new IOException("Out of Buffer");
+        }
+
+        byteBuffer.get(bytes);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kerby-asn1/src/main/java/org/apache/kerby/asn1/TagClass.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/TagClass.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/TagClass.java
new file mode 100644
index 0000000..430630f
--- /dev/null
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/TagClass.java
@@ -0,0 +1,74 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.kerby.asn1;
+
+public enum TagClass {
+    UNKNOWN(-1),
+    UNIVERSAL(0x00),
+    APPLICATION(0x40),
+    CONTEXT_SPECIFIC(0x80),
+    PRIVATE(0xC0);
+
+    private int value;
+
+    private TagClass(int value) {
+        this.value = value;
+    }
+
+    public int getValue() {
+        return value;
+    }
+
+    public boolean isUniversal() {
+        return this == UNIVERSAL;
+    }
+
+    public boolean isAppSpecific() {
+        return this == APPLICATION;
+    }
+
+    public boolean isContextSpecific() {
+        return this == CONTEXT_SPECIFIC;
+    }
+
+    public boolean isTagged() {
+        return this == APPLICATION || this == CONTEXT_SPECIFIC;
+    }
+
+    public static TagClass fromValue(int value) {
+        // Optimized by Emmanuel
+        switch (value) {
+            case 0x00:
+                return TagClass.UNIVERSAL;
+            case 0x40:
+                return TagClass.APPLICATION;
+            case 0x80:
+                return TagClass.CONTEXT_SPECIFIC;
+            case 0xC0:
+                return TagClass.PRIVATE;
+            default:
+                return TagClass.UNKNOWN;
+        }
+    }
+
+    public static TagClass fromTagFlags(int tag) {
+        return fromValue(tag & 0xC0);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kerby-asn1/src/main/java/org/apache/kerby/asn1/TaggingOption.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/TaggingOption.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/TaggingOption.java
new file mode 100644
index 0000000..534977b
--- /dev/null
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/TaggingOption.java
@@ -0,0 +1,68 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.kerby.asn1;
+
+public class TaggingOption
+{
+    private int tagNo;
+    private boolean isImplicit;
+    private boolean isAppSpecific;
+
+    public static TaggingOption newImplicitAppSpecific(int tagNo) {
+        return new TaggingOption(tagNo, true, true);
+    }
+
+    public static TaggingOption newExplicitAppSpecific(int tagNo) {
+        return new TaggingOption(tagNo, false, true);
+    }
+
+    public static TaggingOption newImplicitContextSpecific(int tagNo) {
+        return new TaggingOption(tagNo, true, false);
+    }
+
+    public static TaggingOption newExplicitContextSpecific(int tagNo) {
+        return new TaggingOption(tagNo, false, false);
+    }
+
+    private TaggingOption(int tagNo, boolean isImplicit, boolean isAppSpecific) {
+        this.tagNo = tagNo;
+        this.isImplicit = isImplicit;
+        this.isAppSpecific = isAppSpecific;
+    }
+
+    public int tagFlags(boolean isTaggedConstructed) {
+        boolean isConstructed = isImplicit ? isTaggedConstructed : true;
+        TagClass tagClass = isAppSpecific ? TagClass.APPLICATION : TagClass.CONTEXT_SPECIFIC;
+        int flags = tagClass.getValue() | (isConstructed ? EncodingOption.CONSTRUCTED_FLAG : 0x00);
+        return flags;
+    }
+
+    public int getTagNo() {
+        return tagNo;
+    }
+
+    public boolean isAppSpecific() {
+        return isAppSpecific;
+    }
+
+    public boolean isImplicit() {
+        return isImplicit;
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kerby-asn1/src/main/java/org/apache/kerby/asn1/UniversalTag.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/UniversalTag.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/UniversalTag.java
new file mode 100644
index 0000000..0eb5c78
--- /dev/null
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/UniversalTag.java
@@ -0,0 +1,106 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.kerby.asn1;
+
+// Optimized by Emmanuel
+public enum UniversalTag {
+    UNKNOWN             (-1),
+    CHOICE              (-2), // Only for internal using
+    BOOLEAN             (0x01),
+    INTEGER             (0x02),
+    BIT_STRING          (0x03),
+    OCTET_STRING        (0x04),
+    NULL                (0x05),
+    OBJECT_IDENTIFIER   (0x06),
+    OBJECT_DESCRIPTOR   (0x07),     // Added for completness
+    EXTERNAL            (0x08),
+    REAL                (0x09),
+    ENUMERATED          (0x0a),
+    EMBEDDED_PDV        (0x0b),     // Added for completness
+    UTF8_STRING         (0x0c),
+    RELATIVE_OID        (0x0d),     // Added for completness
+    RESERVED_14         (0x0e),     // Added for completness
+    RESERVED_15         (0x0f),     // Added for completness
+    SEQUENCE            (0x10),
+    SEQUENCE_OF         (0x10),
+    SET                 (0x11),
+    SET_OF              (0x11),
+    NUMERIC_STRING      (0x12),
+    PRINTABLE_STRING    (0x13),
+    T61_STRING          (0x14),
+    VIDEOTEX_STRING     (0x15),
+    IA5_STRING          (0x16),
+    UTC_TIME            (0x17),
+    GENERALIZED_TIME    (0x18),
+    GRAPHIC_STRING      (0x19),
+    VISIBLE_STRING      (0x1a),
+    GENERAL_STRING      (0x1b),
+    UNIVERSAL_STRING    (0x1c),
+    CHARACTER_STRING    (0x1d),     // Added for completness
+    BMP_STRING          (0x1e),
+    RESERVED_31         (0x1f);     // Added for completness
+
+    private int value;
+
+    private UniversalTag(int value) {
+        this.value = value;
+    }
+
+    public int getValue() {
+        return value;
+    }
+
+    public static UniversalTag fromValue(int value) {
+        switch (value) {
+            case 0x01 : return BOOLEAN;
+            case 0x02 : return INTEGER;
+            case 0x03 : return BIT_STRING;
+            case 0x04 : return OCTET_STRING;
+            case 0x05 : return NULL;
+            case 0x06 : return OBJECT_IDENTIFIER;
+            case 0x07 : return OBJECT_DESCRIPTOR;
+            case 0x08 : return EXTERNAL;
+            case 0x09 : return REAL;
+            case 0x0A : return ENUMERATED;
+            case 0x0B : return EMBEDDED_PDV;
+            case 0x0C : return UTF8_STRING;
+            case 0x0D : return RELATIVE_OID;
+            case 0x0E : return RESERVED_14;
+            case 0x0F : return RESERVED_15;
+            case 0x10 : return SEQUENCE;
+            case 0x11 : return SET;
+            case 0x12 : return NUMERIC_STRING;
+            case 0x13 : return PRINTABLE_STRING;
+            case 0x14 : return T61_STRING;
+            case 0x15 : return VIDEOTEX_STRING;
+            case 0x16 : return IA5_STRING;
+            case 0x17 : return UTC_TIME;
+            case 0x18 : return GENERALIZED_TIME;
+            case 0x19 : return GRAPHIC_STRING;
+            case 0x1A : return VISIBLE_STRING;
+            case 0x1B : return GENERAL_STRING;
+            case 0x1C : return UNIVERSAL_STRING;
+            case 0x1D : return CHARACTER_STRING;
+            case 0x1E : return BMP_STRING;
+            case 0x1F : return RESERVED_31;
+            default : return UNKNOWN;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
new file mode 100644
index 0000000..3aefed7
--- /dev/null
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
@@ -0,0 +1,420 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.kerby.asn1.type;
+
+import org.apache.kerby.asn1.EncodingOption;
+import org.apache.kerby.asn1.LimitedByteBuffer;
+import org.apache.kerby.asn1.TagClass;
+import org.apache.kerby.asn1.TaggingOption;
+
+import java.io.EOFException;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+public abstract class AbstractAsn1Type<T> implements Asn1Type {
+    private TagClass tagClass = TagClass.UNKNOWN;
+    private int tagNo = -1;
+    private int tagFlags = -1;
+    protected EncodingOption encodingOption = EncodingOption.UNKNOWN;
+    private int encodingLen = -1;
+    private T value;
+
+    public AbstractAsn1Type(TagClass tagClass, int tagNo) {
+        this(tagClass, tagNo, null);
+    }
+
+    public AbstractAsn1Type(int tagFlags, int tagNo) {
+        this(tagFlags, tagNo, null);
+    }
+
+    public AbstractAsn1Type(int tagFlags, int tagNo, T value) {
+        this(TagClass.fromTagFlags(tagFlags), tagNo, value);
+        setTagFlags(tagFlags);
+    }
+
+    public AbstractAsn1Type(TagClass tagClass, int tagNo, T value) {
+        this.tagClass = tagClass;
+        this.tagNo = tagNo;
+        this.value = value;
+    }
+
+    public void setEncodingOption(EncodingOption encodingOption) {
+        this.encodingOption = encodingOption;
+    }
+
+    public T getValue() {
+        return value;
+    }
+
+    public void setValue(T value) {
+        this.value = value;
+    }
+
+    protected TagClass tagClass() {
+        return tagClass;
+    }
+
+    @Override
+    public int tagNo() {
+        return tagNo;
+    }
+
+    protected void setTagFlags(int tagFlags) {
+        this.tagFlags = tagFlags & 0xe0;
+    }
+
+    protected void setTagNo(int tagNo) {
+        this.tagNo = tagNo;
+    }
+
+    @Override
+    public byte[] encode() {
+        ByteBuffer byteBuffer = ByteBuffer.allocate(encodingLength());
+        encode(byteBuffer);
+        byteBuffer.flip();
+        return byteBuffer.array();
+    }
+
+    @Override
+    public void encode(ByteBuffer buffer) {
+        encodeTag(buffer, tagFlags(), tagNo());
+        encodeLength(buffer, encodingBodyLength());
+        encodeBody(buffer);
+    }
+
+    protected void encodeBody(ByteBuffer buffer) { }
+
+    @Override
+    public void decode(byte[] content) throws IOException {
+        decode(new LimitedByteBuffer(content));
+    }
+
+    @Override
+    public void decode(ByteBuffer content) throws IOException {
+        decode(new LimitedByteBuffer(content));
+    }
+
+    @Override
+    public int tagFlags() {
+        if (tagFlags == -1) {
+            int flags = tagClass.getValue();
+            if (isConstructed()) flags |= EncodingOption.CONSTRUCTED_FLAG;
+            return flags;
+        }
+        return tagFlags;
+    }
+
+    @Override
+    public int encodingLength() {
+        if (encodingLen == -1) {
+            int bodyLen = encodingBodyLength();
+            encodingLen = lengthOfTagLength(tagNo()) + lengthOfBodyLength(bodyLen) + bodyLen;
+        }
+        return encodingLen;
+    }
+
+    public boolean isConstructed() {
+        if (tagFlags != -1) {
+            return (tagFlags & EncodingOption.CONSTRUCTED_FLAG) != 0;
+        } else {
+            return false;
+        }
+    }
+
+    public boolean isUniversal() {
+        return tagClass.isUniversal();
+    }
+
+    public boolean isAppSpecific() {
+        return tagClass.isAppSpecific();
+    }
+
+    public boolean isContextSpecific() {
+        return tagClass.isContextSpecific();
+    }
+
+    public boolean isTagged() {
+        return tagClass.isTagged();
+    }
+
+    public boolean isSimple() {
+        return isUniversal() && Asn1Simple.isSimple(tagNo);
+    }
+
+    public boolean isCollection() {
+        return isUniversal() && Asn1Collection.isCollection(tagNo);
+    }
+
+    protected abstract int encodingBodyLength();
+
+    protected void decode(LimitedByteBuffer content) throws IOException {
+        int tag = readTag(content);
+        int tagNo = readTagNo(content, tag);
+        int length = readLength(content);
+
+        decode(tag, tagNo, new LimitedByteBuffer(content, length));
+    }
+
+    public void decode(int tagFlags, int tagNo, LimitedByteBuffer content) throws IOException {
+        if (this.tagClass != TagClass.UNKNOWN && this.tagClass != TagClass.fromTagFlags(tagFlags)) {
+            throw new IOException("Unexpected tagFlags " + tagFlags + ", expecting " + this.tagClass);
+        }
+        if (this.tagNo != -1 && this.tagNo != tagNo) {
+            throw new IOException("Unexpected tagNo " + tagNo + ", expecting " + this.tagNo);
+        }
+
+        this.tagClass = TagClass.fromTagFlags(tagFlags);
+        this.tagFlags = tagFlags;
+        this.tagNo = tagNo;
+
+        decodeBody(content);
+    }
+
+    protected abstract void decodeBody(LimitedByteBuffer content) throws IOException;
+
+    protected int taggedEncodingLength(TaggingOption taggingOption) {
+        int taggingTagNo = taggingOption.getTagNo();
+        int taggingBodyLen = taggingOption.isImplicit() ? encodingBodyLength() : encodingLength();
+        int taggingEncodingLen = lengthOfTagLength(taggingTagNo) + lengthOfBodyLength(taggingBodyLen) + taggingBodyLen;
+        return taggingEncodingLen;
+    }
+
+    public byte[] taggedEncode(TaggingOption taggingOption) {
+        ByteBuffer byteBuffer = ByteBuffer.allocate(taggedEncodingLength(taggingOption));
+        taggedEncode(byteBuffer, taggingOption);
+        byteBuffer.flip();
+        return byteBuffer.array();
+    }
+
+    @Override
+    public void taggedEncode(ByteBuffer buffer, TaggingOption taggingOption) {
+        int taggingTagFlags = taggingOption.tagFlags(isConstructed());
+        encodeTag(buffer, taggingTagFlags, taggingOption.getTagNo());
+        int taggingBodyLen = taggingOption.isImplicit() ? encodingBodyLength() : encodingLength();
+        encodeLength(buffer, taggingBodyLen);
+        if (taggingOption.isImplicit()) {
+            encodeBody(buffer);
+        } else {
+            encode(buffer);
+        }
+    }
+
+    public void taggedDecode(byte[] content, TaggingOption taggingOption) throws IOException {
+        taggedDecode(ByteBuffer.wrap(content), taggingOption);
+    }
+
+    @Override
+    public void taggedDecode(ByteBuffer content, TaggingOption taggingOption) throws IOException {
+        LimitedByteBuffer limitedBuffer = new LimitedByteBuffer(content);
+        taggedDecode(limitedBuffer, taggingOption);
+    }
+
+    protected void taggedDecode(LimitedByteBuffer content, TaggingOption taggingOption) throws IOException {
+        int taggingTag = readTag(content);
+        int taggingTagNo = readTagNo(content, taggingTag);
+        int taggingLength = readLength(content);
+        LimitedByteBuffer newContent = new LimitedByteBuffer(content, taggingLength);
+
+        int tagFlags = taggingTag & 0xe0;
+        taggedDecode(tagFlags, taggingTagNo, newContent, taggingOption);
+    }
+
+    protected void taggedDecode(int taggingTagFlags, int taggingTagNo, LimitedByteBuffer content, TaggingOption taggingOption) throws IOException {
+        int expectedTaggingTagFlags = taggingOption.tagFlags(isConstructed());
+        if (expectedTaggingTagFlags != taggingTagFlags) {
+            throw new IOException("Unexpected tag flags" + taggingTagFlags + ", expecting " + expectedTaggingTagFlags);
+        }
+        if (taggingOption.getTagNo() != taggingTagNo) {
+            throw new IOException("Unexpected tagNo " + taggingTagNo + ", expecting " + taggingOption.getTagNo());
+        }
+
+        if (taggingOption.isImplicit()) {
+            decodeBody(content);
+        } else {
+            decode(content);
+        }
+    }
+
+    public static Asn1Item decodeOne(LimitedByteBuffer content) throws IOException {
+        int tag = readTag(content);
+        int tagNo = readTagNo(content, tag);
+        boolean isConstructed = EncodingOption.isConstructed(tag);
+        int length = readLength(content);
+        if (length < 0) {
+            throw new IOException("Unexpected length");
+        }
+        LimitedByteBuffer valueContent = new LimitedByteBuffer(content, length);
+        content.skip(length);
+
+        Asn1Item result = new Asn1Item(tag, tagNo, valueContent);
+        if (result.isSimple()) {
+            result.decodeValueAsSimple();
+        }
+        return result;
+    }
+
+    public static void skipOne(LimitedByteBuffer content) throws IOException {
+        int tag = readTag(content);
+        int tagNo = readTagNo(content, tag);
+        int length = readLength(content);
+        if (length < 0) {
+            throw new IOException("Unexpected length");
+        }
+        content.skip(length);
+    }
+
+    public static int lengthOfBodyLength(int bodyLength) {
+        int length = 1;
+
+        if (bodyLength > 127) {
+            int payload = bodyLength;
+            while (payload != 0) {
+                payload >>= 8;
+                length++;
+            }
+        }
+
+        return length;
+    }
+
+    public static int lengthOfTagLength(int tagNo) {
+        int length = 1;
+
+        if (tagNo >= 31) {
+            if (tagNo < 128) {
+                length++;
+            } else {
+                length++;
+
+                do {
+                    tagNo >>= 7;
+                    length++;
+                } while (tagNo > 127);
+            }
+        }
+
+        return length;
+    }
+
+    public static void encodeTag(ByteBuffer buffer, int flags, int tagNo) {
+        if (tagNo < 31) {
+            buffer.put((byte) (flags | tagNo));
+        } else {
+            buffer.put((byte) (flags | 0x1f));
+            if (tagNo < 128) {
+                buffer.put((byte) tagNo);
+            } else {
+                byte[] tmpBytes = new byte[5]; // 5 * 7 > 32
+                int iPut = tmpBytes.length;
+
+                tmpBytes[--iPut] = (byte)(tagNo & 0x7f);
+                do {
+                    tagNo >>= 7;
+                    tmpBytes[--iPut] = (byte)(tagNo & 0x7f | 0x80);
+                } while (tagNo > 127);
+
+                buffer.put(tmpBytes, iPut, tmpBytes.length - iPut);
+            }
+        }
+    }
+
+    public static void encodeLength(ByteBuffer buffer, int bodyLength) {
+        if (bodyLength < 128) {
+            buffer.put((byte) bodyLength);
+        } else {
+            int length = 0;
+            int payload = bodyLength;
+
+            while (payload != 0) {
+                payload >>= 8;
+                length++;
+            }
+
+            buffer.put((byte) (length | 0x80));
+
+            payload = bodyLength;
+            for (int i = length - 1; i >= 0; i--) {
+                buffer.put((byte) (payload >> (i * 8)));
+            }
+        }
+    }
+
+    public static int readTag(LimitedByteBuffer buffer) throws IOException {
+        int tag = buffer.readByte() & 0xff;
+        if (tag == 0) {
+            throw new IOException("Bad tag 0 found");
+        }
+        return tag;
+    }
+
+    public static int readTagNo(LimitedByteBuffer buffer, int tag) throws IOException {
+        int tagNo = tag & 0x1f;
+
+        if (tagNo == 0x1f) {
+            tagNo = 0;
+
+            int b = buffer.readByte() & 0xff;
+            if ((b & 0x7f) == 0) {
+                throw new IOException("Invalid high tag number found");
+            }
+
+            while ((b >= 0) && ((b & 0x80) != 0)) {
+                tagNo |= (b & 0x7f);
+                tagNo <<= 7;
+                b = buffer.readByte();
+            }
+
+            tagNo |= (b & 0x7f);
+        }
+
+        return tagNo;
+    }
+
+    public static int readLength(LimitedByteBuffer buffer) throws IOException {
+        int bodyLength = buffer.readByte() & 0xff;
+        if (bodyLength < 0) {
+            throw new EOFException("Unexpected EOF");
+        }
+
+        if (bodyLength > 127) {
+            int length = bodyLength & 0x7f;
+            if (length > 4) {
+                throw new IOException("Bad bodyLength of more than 4 bytes: " + length);
+            }
+
+            bodyLength = 0;
+            int tmp;
+            for (int i = 0; i < length; i++) {
+                tmp = buffer.readByte() & 0xff;
+                bodyLength = (bodyLength << 8) + tmp;
+            }
+
+            if (bodyLength < 0) {
+                throw new IOException("Invalid bodyLength " + bodyLength);
+            }
+            if (bodyLength > buffer.hasLeft()) {
+                throw new IOException("Corrupt stream - less data "
+                        + buffer.hasLeft() + " than expected " + bodyLength);
+            }
+        }
+
+        return bodyLength;
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Any.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Any.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Any.java
new file mode 100644
index 0000000..1474851
--- /dev/null
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Any.java
@@ -0,0 +1,47 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.kerby.asn1.type;
+
+import org.apache.kerby.asn1.LimitedByteBuffer;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+public class Asn1Any extends AbstractAsn1Type<Asn1Type> {
+
+    public Asn1Any(Asn1Type anyValue) {
+        super(anyValue.tagFlags(), anyValue.tagNo(), anyValue);
+    }
+
+    @Override
+    protected int encodingBodyLength() {
+        return ((AbstractAsn1Type) getValue()).encodingBodyLength();
+    }
+
+    @Override
+    protected void encodeBody(ByteBuffer buffer) {
+        ((AbstractAsn1Type) getValue()).encodeBody(buffer);
+    }
+
+    @Override
+    protected void decodeBody(LimitedByteBuffer content) throws IOException {
+        ((AbstractAsn1Type) getValue()).decodeBody(content);
+    }
+}


Mime
View raw message