All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.mmm.crypto.asymmetric.cert.CertificatePathGeneric Maven / Gradle / Ivy

package io.github.mmm.crypto.asymmetric.cert;

import java.security.cert.Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * Generic implementation of {@link CertificatePath}.
 *
 * @author Joerg Hohwiller (hohwille at users.sourceforge.net)
 * @since 1.0.0
 */
public class CertificatePathGeneric implements CertificatePath {

  private final List certificates;

  /**
   * The constructor.
   *
   * @param certificates the {@link #getCertificates() certificates}.
   */
  public CertificatePathGeneric(Collection certificates) {

    super();
    List certificateList;
    if (certificates instanceof List) {
      certificateList = (List) certificates;
    } else {
      certificateList = new ArrayList<>(certificates);
    }
    this.certificates = Collections.unmodifiableList(certificateList);
  }

  /**
   * The constructor.
   *
   * @param certificates the {@link #getCertificates() certificates}.
   */
  public CertificatePathGeneric(Certificate... certificates) {

    super();
    this.certificates = Collections.unmodifiableList(Arrays.asList(certificates));
  }

  @Override
  public List getCertificates() {

    return this.certificates;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy