43
43
import java .util .Map ;
44
44
import java .util .WeakHashMap ;
45
45
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 .*;
89
47
90
48
import org .jruby .Ruby ;
91
49
import org .jruby .RubyArray ;
@@ -966,10 +924,6 @@ static IRubyObject decodeObject(final ThreadContext context,
966
924
final BN val = BN .newBN (runtime , ((ASN1Integer ) obj ).getValue ());
967
925
return ASN1 .getClass ("Integer" ).newInstance (context , val , Block .NULL_BLOCK );
968
926
}
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
- }
973
927
974
928
if ( obj instanceof DERBitString ) {
975
929
final DERBitString derObj = (DERBitString ) obj ;
@@ -1038,11 +992,6 @@ else if ( obj instanceof DERBMPString ) {
1038
992
final boolean val = ((ASN1Boolean ) obj ).isTrue ();
1039
993
return ASN1 .getClass ("Boolean" ).newInstance (context , runtime .newBoolean (val ), Block .NULL_BLOCK );
1040
994
}
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
- }
1046
995
1047
996
if ( obj instanceof ASN1UTCTime ) {
1048
997
final Date adjustedTime ;
@@ -1068,26 +1017,20 @@ else if ( obj instanceof DERBMPString ) {
1068
1017
return ASN1 .getClass ("GeneralizedTime" ).newInstance (context , time , Block .NULL_BLOCK );
1069
1018
}
1070
1019
// 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
+ // }
1080
1029
1081
1030
if ( obj instanceof ASN1ObjectIdentifier ) {
1082
1031
final String objId = ((ASN1ObjectIdentifier ) obj ).getId ();
1083
1032
return ASN1 .getClass ("ObjectId" ).newInstance (context , runtime .newString (objId ), Block .NULL_BLOCK );
1084
1033
}
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
- }
1091
1034
1092
1035
if ( obj instanceof ASN1TaggedObject ) {
1093
1036
final ASN1TaggedObject taggedObj = (ASN1TaggedObject ) obj ;
0 commit comments