mirror of https://github.com/shred/acme4j
Return a copy of certificate chain array
parent
22ed05de8e
commit
ae4ef0f2ab
|
@ -19,6 +19,7 @@ import java.net.URL;
|
|||
import java.security.cert.CertificateEncodingException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.shredzone.acme4j.connector.Connection;
|
||||
|
@ -140,7 +141,7 @@ public class Certificate extends AcmeResource {
|
|||
|
||||
chain = certChain.toArray(new X509Certificate[certChain.size()]);
|
||||
}
|
||||
return chain;
|
||||
return Arrays.copyOf(chain, chain.length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -101,6 +101,11 @@ public class CertificateTest {
|
|||
assertThat(downloadedChain.length, is(1));
|
||||
assertThat(downloadedChain[0], is(sameInstance(originalCert)));
|
||||
|
||||
// Make sure the chain array is a local copy
|
||||
downloadedChain[0] = null;
|
||||
X509Certificate[] downloadedChain2 = cert.downloadChain();
|
||||
assertThat(downloadedChain2[0], is(sameInstance(originalCert)));
|
||||
|
||||
provider.close();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue