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

com.github.nagyesta.lowkeyvault.service.certificate.impl.CertificatePolicy Maven / Gradle / Ivy

The newest version!
package com.github.nagyesta.lowkeyvault.service.certificate.impl;

import com.github.nagyesta.lowkeyvault.model.v7_2.key.constants.KeyCurveName;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.constants.KeyType;
import lombok.Data;
import lombok.NonNull;

import java.time.OffsetDateTime;
import java.util.Set;

@Data
public class CertificatePolicy implements ReadOnlyCertificatePolicy {

    private String name;
    private CertAuthorityType certAuthorityType;
    private String subject;
    private Set dnsNames;
    private Set emails;
    private Set upns;
    private int validityMonths;
    private OffsetDateTime validityStart;
    private CertContentType contentType;
    private boolean reuseKeyOnRenewal;
    private boolean exportablePrivateKey;
    private KeyType keyType;
    private KeyCurveName keyCurveName;
    private Integer keySize;
    private boolean enableTransparency;
    private String certificateType;
    private Set keyUsage;
    private Set extendedKeyUsage;

    public CertificatePolicy(@NonNull final ReadOnlyCertificatePolicy source) {
        this.name = source.getName();
        this.certAuthorityType = source.getCertAuthorityType();
        this.subject = source.getSubject();
        this.dnsNames = Set.copyOf(source.getDnsNames());
        this.emails = Set.copyOf(source.getEmails());
        this.upns = Set.copyOf(source.getUpns());
        this.validityMonths = source.getValidityMonths();
        this.validityStart = source.getValidityStart();
        this.contentType = source.getContentType();
        this.reuseKeyOnRenewal = source.isReuseKeyOnRenewal();
        this.exportablePrivateKey = source.isExportablePrivateKey();
        this.keyType = source.getKeyType();
        this.keyCurveName = source.getKeyCurveName();
        this.keySize = source.getKeySize();
        this.enableTransparency = source.isEnableTransparency();
        this.certificateType = source.getCertificateType();
        this.keyUsage = Set.copyOf(source.getKeyUsage());
        this.extendedKeyUsage = Set.copyOf(source.getExtendedKeyUsage());
    }

    public void setDnsNames(@NonNull final Set dnsNames) {
        this.dnsNames = Set.copyOf(dnsNames);
    }

    public void setEmails(@NonNull final Set emails) {
        this.emails = Set.copyOf(emails);
    }

    public void setUpns(@NonNull final Set upns) {
        this.upns = Set.copyOf(upns);
    }

    public void setKeyUsage(@NonNull final Set keyUsage) {
        this.keyUsage = Set.copyOf(keyUsage);
    }

    public void setExtendedKeyUsage(@NonNull final Set extendedKeyUsage) {
        this.extendedKeyUsage = Set.copyOf(extendedKeyUsage);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy