@@ -521,18 +521,18 @@ private static Map<ASN1ObjectIdentifier, String> getSymLookup(final Ruby runtime
521
521
522
522
private final static Object [][] ASN1_INFO = {
523
523
{ "EOC" , null , "EndOfContent" }, // OpenSSL::ASN1::EOC (0)
524
- { "BOOLEAN" , org .bouncycastle .asn1 .DERBoolean .class , "Boolean" },
525
- { "INTEGER" , org .bouncycastle .asn1 .DERInteger .class , "Integer" },
524
+ { "BOOLEAN" , org .bouncycastle .asn1 .ASN1Boolean .class , "Boolean" },
525
+ { "INTEGER" , org .bouncycastle .asn1 .ASN1Integer .class , "Integer" },
526
526
{ "BIT_STRING" , org .bouncycastle .asn1 .DERBitString .class , "BitString" },
527
527
{ "OCTET_STRING" , org .bouncycastle .asn1 .DEROctetString .class , "OctetString" },
528
528
{ "NULL" , org .bouncycastle .asn1 .DERNull .class , "Null" },
529
529
// OpenSSL::ASN1::OBJECT (6) :
530
- { "OBJECT" , org .bouncycastle .asn1 .DERObjectIdentifier .class , "ObjectId" },
530
+ { "OBJECT" , org .bouncycastle .asn1 .ASN1ObjectIdentifier .class , "ObjectId" },
531
531
{ "OBJECT_DESCRIPTOR" , null , null },
532
532
{ "EXTERNAL" , null , null },
533
533
{ "REAL" , null , null },
534
534
// OpenSSL::ASN1::ENUMERATED (10) :
535
- { "ENUMERATED" , org .bouncycastle .asn1 .DEREnumerated .class , "Enumerated" },
535
+ { "ENUMERATED" , org .bouncycastle .asn1 .ASN1Enumerated .class , "Enumerated" },
536
536
{ "EMBEDDED_PDV" , null , null },
537
537
// OpenSSL::ASN1::UTF8STRING (12) :
538
538
{ "UTF8STRING" , org .bouncycastle .asn1 .DERUTF8String .class , "UTF8String" },
@@ -1589,19 +1589,16 @@ ASN1Encodable toASN1(final ThreadContext context) {
1589
1589
}
1590
1590
}
1591
1591
1592
- final IRubyObject val = callMethod (context , "value" );
1593
- if ( type == ASN1ObjectIdentifier .class || type == DERObjectIdentifier . class ) {
1592
+ final IRubyObject val = value (context );
1593
+ if ( type == ASN1ObjectIdentifier .class ) {
1594
1594
return getObjectID (context .runtime , val .toString ());
1595
1595
}
1596
1596
if ( type == DERNull .class || type == ASN1Null .class ) {
1597
1597
return DERNull .INSTANCE ;
1598
1598
}
1599
- if ( ASN1Boolean .class .isAssignableFrom ( type ) ) {
1599
+ if ( ASN1Boolean .class .isAssignableFrom (type ) ) {
1600
1600
return ASN1Boolean .getInstance (val .isTrue ());
1601
1601
}
1602
- if ( type == DERBoolean .class ) {
1603
- return DERBoolean .getInstance (val .isTrue ());
1604
- }
1605
1602
if ( type == DERUTCTime .class ) {
1606
1603
if ( val instanceof RubyTime ) {
1607
1604
return new DERUTCTime (((RubyTime ) val ).getJavaDate ());
@@ -1614,20 +1611,13 @@ ASN1Encodable toASN1(final ThreadContext context) {
1614
1611
}
1615
1612
return DERGeneralizedTime .getInstance ( val .asString ().getBytes () );
1616
1613
}
1617
- if ( type == DERInteger .class ) {
1618
- return new DERInteger ( bigIntegerValue (val ) );
1619
- }
1620
- if ( ASN1Integer .class .isAssignableFrom ( type ) ) {
1614
+ if ( ASN1Integer .class .isAssignableFrom (type ) ) {
1621
1615
return new ASN1Integer ( bigIntegerValue (val ) );
1622
1616
}
1623
- if ( type == DEREnumerated .class ) {
1624
- return new DEREnumerated ( bigIntegerValue (val ) );
1625
- }
1626
- if ( type == ASN1Enumerated .class ) {
1617
+ if ( ASN1Enumerated .class .isAssignableFrom (type ) ) {
1627
1618
return new ASN1Enumerated ( bigIntegerValue (val ) );
1628
1619
}
1629
- //if ( type == DEROctetString.class ) {
1630
- if ( ASN1OctetString .class .isAssignableFrom ( type ) ) {
1620
+ if ( ASN1OctetString .class .isAssignableFrom (type ) ) {
1631
1621
return new DEROctetString ( val .asString ().getBytes () );
1632
1622
}
1633
1623
if ( type == DERBitString .class ) {
0 commit comments