Iterator<ASN1ObjectIdentifier> extensionsOids = Arrays.asList(extensionsOidsArray).iterator();
// Order is important, which is why a list is used.
ArrayList<Extension> outputExtensions = new ArrayList<Extension>();
while (extensionsOids.hasNext()) {
ASN1ObjectIdentifier extn = extensionsOids.next();
String extnId = extn.getId();
if (extnId.equals(CTConstants.POISON_EXTENSION_OID)) {
// Do nothing - skip copying this extension
} else if ((extnId.equals(X509_AUTHORITY_KEY_IDENTIFIER)) &&
(replacementX509authorityKeyIdentifier != null)) {
// Use the real issuer's authority key identifier, since it's present.