@@ -785,18 +785,16 @@ public RubyString to_text() {
785785 final ECParameterSpec spec = getParamSpec ();
786786 result .append ("Private-Key: (" ).append (spec .getOrder ().bitLength ()).append (" bit)" ).append ('\n' );
787787
788- if (privateKey != null ) {
788+ if (privateKey instanceof ECPrivateKey ) {
789789 result .append ("priv:" );
790790 addSplittedAndFormatted (result , ((ECPrivateKey ) privateKey ).getS ());
791791 }
792792
793793 if (publicKey != null ) {
794794 result .append ("pub:" );
795- final byte [] pubBytes = encodeUncompressed ( getGroup ( true ). getBitLength (), publicKey .getW ());
795+ final byte [] pubBytes = encodeCompressed ( publicKey .getW ());
796796 final StringBuilder hexBytes = new StringBuilder (pubBytes .length * 2 );
797- for (byte b : pubBytes ) {
798- hexBytes .append (Integer .toHexString (Byte .toUnsignedInt (b )));
799- }
797+ for (byte b : pubBytes ) hexBytes .append (Integer .toHexString (Byte .toUnsignedInt (b )));
800798 addSplittedAndFormatted (result , hexBytes );
801799 }
802800 result .append ("ASN1 OID: " ).append (getCurveName ()).append ('\n' );
@@ -815,12 +813,8 @@ String toRubyString() {
815813 @ JRubyClass (name = "OpenSSL::PKey::EC::Group" )
816814 public static final class Group extends RubyObject {
817815
818- private static final ObjectAllocator ALLOCATOR = new ObjectAllocator () {
819- public Group allocate (Ruby runtime , RubyClass klass ) { return new Group (runtime , klass ); }
820- };
821-
822816 static void createGroup (final Ruby runtime , final RubyClass EC , final RubyClass OpenSSLError ) {
823- RubyClass Group = EC .defineClassUnder ("Group" , runtime .getObject (), ALLOCATOR );
817+ RubyClass Group = EC .defineClassUnder ("Group" , runtime .getObject (), Group :: new );
824818
825819 // OpenSSL::PKey::EC::Group::Error
826820 Group .defineClassUnder ("Error" , OpenSSLError , OpenSSLError .getAllocator ());
@@ -1006,12 +1000,8 @@ static PointConversion parse_point_conversion_form(final Ruby runtime, final IRu
10061000 @ JRubyClass (name = "OpenSSL::PKey::EC::Point" )
10071001 public static final class Point extends RubyObject {
10081002
1009- private static final ObjectAllocator ALLOCATOR = new ObjectAllocator () {
1010- public Point allocate (Ruby runtime , RubyClass klass ) { return new Point (runtime , klass ); }
1011- };
1012-
10131003 static void createPoint (final Ruby runtime , final RubyClass EC , final RubyClass OpenSSLError ) {
1014- RubyClass Point = EC .defineClassUnder ("Point" , runtime .getObject (), ALLOCATOR );
1004+ RubyClass Point = EC .defineClassUnder ("Point" , runtime .getObject (), Point :: new );
10151005
10161006 // OpenSSL::PKey::EC::Point::Error
10171007 Point .defineClassUnder ("Error" , OpenSSLError , OpenSSLError .getAllocator ());
0 commit comments