Update to SpongyCastle 1.58.0.0.

This commit is contained in:
Andreas Schildbach
2017-08-22 17:53:17 +02:00
parent b9a31104af
commit fb54451c0b
2 changed files with 7 additions and 2 deletions

View File

@@ -196,7 +196,7 @@
<urn>com.google.protobuf:protobuf-java:2.6.1:jar:null:compile:d9521f2aecb909835746b7a5facf612af5e890e8</urn>
<urn>com.h2database:h2:1.3.167:jar:null:compile:d3867d586f087e53eb12fc65e5693d8ee9a5da17</urn>
<urn>com.lambdaworks:scrypt:1.4.0:jar:null:compile:906506b74f30c8c20bccd9ed4a11112d8941fe87</urn>
<urn>com.madgag.spongycastle:core:1.52.0.0:jar:null:compile:99976d02054732e513eb2d884d9e20bec539e283</urn>
<urn>com.madgag.spongycastle:core:1.58.0.0:jar:null:compile:e08789f8f1e74f155db8b69c3575b5cb213c156c</urn>
<urn>junit:junit:4.12:jar:null:test:2973d150c0dc1fefe998f834810d68f278ea58ec</urn>
<urn>mysql:mysql-connector-java:5.1.33:jar:null:compile:8af455a9a3267e6664cafc87ace71a4e4ef02837</urn>
<urn>net.jcip:jcip-annotations:1.0:jar:null:compile:afba4942caaeaf46aab0b976afd57cc7c181467e</urn>
@@ -386,7 +386,7 @@
<dependency>
<groupId>com.madgag.spongycastle</groupId>
<artifactId>core</artifactId>
<version>1.52.0.0</version>
<version>1.58.0.0</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>

View File

@@ -47,6 +47,7 @@ import org.spongycastle.math.ec.ECPoint;
import org.spongycastle.math.ec.FixedPointCombMultiplier;
import org.spongycastle.math.ec.FixedPointUtil;
import org.spongycastle.math.ec.custom.sec.SecP256K1Curve;
import org.spongycastle.util.Properties;
import org.spongycastle.util.encoders.Base64;
import javax.annotation.Nullable;
@@ -568,6 +569,9 @@ public class ECKey implements EncryptableItem {
public static ECDSASignature decodeFromDER(byte[] bytes) throws IllegalArgumentException {
ASN1InputStream decoder = null;
try {
// BouncyCastle by default is strict about parsing ASN.1 integers. We relax this check, because some
// Bitcoin signatures would not parse.
Properties.setThreadOverride("org.spongycastle.asn1.allow_unsafe_integer", true);
decoder = new ASN1InputStream(bytes);
final ASN1Primitive seqObj = decoder.readObject();
if (seqObj == null)
@@ -590,6 +594,7 @@ public class ECKey implements EncryptableItem {
} finally {
if (decoder != null)
try { decoder.close(); } catch (IOException x) {}
Properties.removeThreadOverride("org.spongycastle.asn1.allow_unsafe_integer");
}
}