diff -Naur ./sun/security/ec/ECParameters.java ../src/sun/security/ec/ECParameters.java --- ./sun/security/ec/ECParameters.java 2008-07-10 21:57:44.000000000 +0200 +++ ../src/sun/security/ec/ECParameters.java 2008-09-11 14:15:44.000000000 +0200 @@ -84,17 +84,24 @@ // Used by SunPKCS11 and SunJSSE. public static ECPoint decodePoint(byte[] data, EllipticCurve curve) throws IOException { - if ((data.length == 0) || (data[0] != 4)) { + final int offset; + if ( data.length>2 && data[0]==4 && data[1]+2==data.length ) + offset = 2; + else if ( data.length>3 && data[0]==4 && (0xff&data[1])==0x81 && (0xff&data[2])+3==data.length ) + offset = 3; + else + offset = 0; + if ((data.length <= offset) || (data[offset] != 4)) { throw new IOException("Only uncompressed point format supported"); } int n = (curve.getField().getFieldSize() + 7 ) >> 3; - if (data.length != (n * 2) + 1) { + if (data.length != (n * 2) + 1+offset) { throw new IOException("Point does not match field size"); } byte[] xb = new byte[n]; byte[] yb = new byte[n]; - System.arraycopy(data, 1, xb, 0, n); - System.arraycopy(data, n + 1, yb, 0, n); + System.arraycopy(data, offset+1, xb, 0, n); + System.arraycopy(data, offset+n + 1, yb, 0, n); return new ECPoint(new BigInteger(1, xb), new BigInteger(1, yb)); }