use of com.github.zhenwei.core.asn1.ocsp.Signature in project LinLong-Java by zhenwei1108.
the class StandardDSAEncoding method decode.
public BigInteger[] decode(BigInteger n, byte[] encoding) throws IOException {
ASN1Sequence seq = (ASN1Sequence) ASN1Primitive.fromByteArray(encoding);
if (seq.size() == 2) {
BigInteger r = decodeValue(n, seq, 0);
BigInteger s = decodeValue(n, seq, 1);
byte[] expectedEncoding = encode(n, r, s);
if (Arrays.areEqual(expectedEncoding, encoding)) {
return new BigInteger[] { r, s };
}
}
throw new IllegalArgumentException("Malformed signature");
}
Aggregations