4343import java .util .Map ;
4444import java .util .WeakHashMap ;
4545
46- import org .bouncycastle .asn1 .ASN1Boolean ;
47- import org .bouncycastle .asn1 .ASN1Encodable ;
48- import org .bouncycastle .asn1 .ASN1EncodableVector ;
49- import org .bouncycastle .asn1 .ASN1Encoding ;
50- import org .bouncycastle .asn1 .ASN1Enumerated ;
51- import org .bouncycastle .asn1 .ASN1GeneralizedTime ;
52- import org .bouncycastle .asn1 .ASN1InputStream ;
53- import org .bouncycastle .asn1 .ASN1ObjectIdentifier ;
54- import org .bouncycastle .asn1 .ASN1Sequence ;
55- import org .bouncycastle .asn1 .ASN1Set ;
56- import org .bouncycastle .asn1 .ASN1String ;
57- import org .bouncycastle .asn1 .ASN1Integer ;
58- import org .bouncycastle .asn1 .ASN1Null ;
59- import org .bouncycastle .asn1 .ASN1OctetString ;
60- import org .bouncycastle .asn1 .ASN1Primitive ;
61- import org .bouncycastle .asn1 .ASN1TaggedObject ;
62- import org .bouncycastle .asn1 .ASN1UTCTime ;
63- import org .bouncycastle .asn1 .DERBitString ;
64- import org .bouncycastle .asn1 .BEROctetString ;
65- import org .bouncycastle .asn1 .BERSequenceGenerator ;
66- import org .bouncycastle .asn1 .BERSet ;
67- import org .bouncycastle .asn1 .BERTags ;
68- import org .bouncycastle .asn1 .DERApplicationSpecific ;
69- import org .bouncycastle .asn1 .DERBMPString ;
70- import org .bouncycastle .asn1 .DERBoolean ;
71- import org .bouncycastle .asn1 .DEREnumerated ;
72- import org .bouncycastle .asn1 .DERGeneralString ;
73- import org .bouncycastle .asn1 .DERGeneralizedTime ;
74- import org .bouncycastle .asn1 .DERIA5String ;
75- import org .bouncycastle .asn1 .DERInteger ;
76- import org .bouncycastle .asn1 .DERNull ;
77- import org .bouncycastle .asn1 .DERNumericString ;
78- import org .bouncycastle .asn1 .DERObjectIdentifier ;
79- import org .bouncycastle .asn1 .DEROctetString ;
80- import org .bouncycastle .asn1 .DERPrintableString ;
81- import org .bouncycastle .asn1 .DERSequence ;
82- import org .bouncycastle .asn1 .DERT61String ;
83- import org .bouncycastle .asn1 .DERTaggedObject ;
84- import org .bouncycastle .asn1 .DERUTCTime ;
85- import org .bouncycastle .asn1 .DERUTF8String ;
86- import org .bouncycastle .asn1 .DERUniversalString ;
87- import org .bouncycastle .asn1 .DERVisibleString ;
88- import org .bouncycastle .asn1 .DLSet ;
46+ import org .bouncycastle .asn1 .*;
8947
9048import org .jruby .Ruby ;
9149import org .jruby .RubyArray ;
@@ -966,10 +924,6 @@ static IRubyObject decodeObject(final ThreadContext context,
966924 final BN val = BN .newBN (runtime , ((ASN1Integer ) obj ).getValue ());
967925 return ASN1 .getClass ("Integer" ).newInstance (context , val , Block .NULL_BLOCK );
968926 }
969- if ( obj instanceof DERInteger ) {
970- final BN val = BN .newBN (runtime , ((DERInteger ) obj ).getValue ());
971- return ASN1 .getClass ("Integer" ).newInstance (context , val , Block .NULL_BLOCK );
972- }
973927
974928 if ( obj instanceof DERBitString ) {
975929 final DERBitString derObj = (DERBitString ) obj ;
@@ -1038,11 +992,6 @@ else if ( obj instanceof DERBMPString ) {
1038992 final boolean val = ((ASN1Boolean ) obj ).isTrue ();
1039993 return ASN1 .getClass ("Boolean" ).newInstance (context , runtime .newBoolean (val ), Block .NULL_BLOCK );
1040994 }
1041- // DERBoolean extends ASN1Boolean only since 1.51 (<= 1.50 the other way around)
1042- if ( obj instanceof DERBoolean ) {
1043- final boolean val = ((DERBoolean ) obj ).isTrue ();
1044- return ASN1 .getClass ("Boolean" ).newInstance (context , runtime .newBoolean (val ), Block .NULL_BLOCK );
1045- }
1046995
1047996 if ( obj instanceof ASN1UTCTime ) {
1048997 final Date adjustedTime ;
@@ -1068,26 +1017,20 @@ else if ( obj instanceof DERBMPString ) {
10681017 return ASN1 .getClass ("GeneralizedTime" ).newInstance (context , time , Block .NULL_BLOCK );
10691018 }
10701019 // NOTE: keep for BC versions compatibility ... extends ASN1GeneralizedTime (since BC 1.51)
1071- if ( obj instanceof DERGeneralizedTime ) {
1072- final Date generalTime ;
1073- try {
1074- generalTime = ((DERGeneralizedTime ) obj ).getDate ();
1075- }
1076- catch (ParseException e ) { throw new IOException (e ); }
1077- final RubyTime time = RubyTime .newTime (runtime , generalTime .getTime ());
1078- return ASN1 .getClass ("GeneralizedTime" ).newInstance (context , time , Block .NULL_BLOCK );
1079- }
1020+ // if ( obj instanceof DERGeneralizedTime ) {
1021+ // final Date generalTime;
1022+ // try {
1023+ // generalTime = ((DERGeneralizedTime) obj).getDate();
1024+ // }
1025+ // catch (ParseException e) { throw new IOException(e); }
1026+ // final RubyTime time = RubyTime.newTime(runtime, generalTime.getTime());
1027+ // return ASN1.getClass("GeneralizedTime").newInstance(context, time, Block.NULL_BLOCK);
1028+ // }
10801029
10811030 if ( obj instanceof ASN1ObjectIdentifier ) {
10821031 final String objId = ((ASN1ObjectIdentifier ) obj ).getId ();
10831032 return ASN1 .getClass ("ObjectId" ).newInstance (context , runtime .newString (objId ), Block .NULL_BLOCK );
10841033 }
1085- // ASN1ObjectIdentifier extends DERObjectIdentifier < 1.51
1086- // DERObjectIdentifier extends ASN1ObjectIdentifier = 1.51
1087- if ( obj instanceof DERObjectIdentifier ) {
1088- final String objId = ((DERObjectIdentifier ) obj ).getId ();
1089- return ASN1 .getClass ("ObjectId" ).newInstance (context , runtime .newString (objId ), Block .NULL_BLOCK );
1090- }
10911034
10921035 if ( obj instanceof ASN1TaggedObject ) {
10931036 final ASN1TaggedObject taggedObj = (ASN1TaggedObject ) obj ;
0 commit comments