@@ -755,7 +755,7 @@ static ASN1ObjectIdentifier getObjectID(final Ruby runtime, final String nameOrO
755755 return new ASN1ObjectIdentifier ( nameOrOid );
756756 }
757757
758- static ASN1ObjectIdentifier toObjectID (final String oid , final boolean silent )
758+ private static ASN1ObjectIdentifier toObjectID (final String oid , final boolean silent )
759759 throws IllegalArgumentException {
760760 try {
761761 return new ASN1ObjectIdentifier (oid );
@@ -766,6 +766,11 @@ static ASN1ObjectIdentifier toObjectID(final String oid, final boolean silent)
766766 }
767767 }
768768
769+ static String shortName (final Ruby runtime , final ASN1ObjectIdentifier oid ) {
770+ final String name = oid2name (runtime , oid , true );
771+ return name == null ? oid .getId () : name ;
772+ }
773+
769774 @ JRubyMethod (name ="Boolean" , module =true , rest =true )
770775 public static IRubyObject fact_Boolean (ThreadContext context , IRubyObject self , IRubyObject [] args ) {
771776 return newInstance (context , self , "Boolean" , args );
@@ -1554,7 +1559,7 @@ boolean isEoc() {
15541559 }
15551560
15561561 public static RaiseException newASN1Error (Ruby runtime , String message ) {
1557- return newError (runtime , _ASN1 (runtime ). getClass ( "ASN1Error" ), message , false );
1562+ return newError (runtime , _ASN1Error (runtime ), message , false );
15581563 }
15591564
15601565 static RaiseException newASN1Error (Ruby runtime , Throwable ex ) {
@@ -1565,6 +1570,10 @@ static RubyModule _ASN1(final Ruby runtime) {
15651570 return (RubyModule ) runtime .getModule ("OpenSSL" ).getConstant ("ASN1" );
15661571 }
15671572
1573+ static RubyClass _ASN1Error (final Ruby runtime ) {
1574+ return _ASN1 (runtime ).getClass ("ASN1Error" );
1575+ }
1576+
15681577 static org .bouncycastle .asn1 .ASN1Primitive readObject (final byte [] bytes )
15691578 throws IOException {
15701579 return new ASN1InputStream (new ByteArrayInputStream (bytes )).readObject ();
0 commit comments