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

no.ks.fiks.bekymringsmelding.produsent.klient.model.Nokkel Maven / Gradle / Ivy

There is a newer version: 2.0.1
Show newest version
package no.ks.fiks.bekymringsmelding.produsent.klient.model;

import lombok.Data;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.time.LocalDateTime;

@Data
public class Nokkel {
    private String nokkel;
    private LocalDateTime validFrom;
    private LocalDateTime validTo;
    private String serial;
    private String subjectDN;
    private String issuerDN;

    public X509Certificate getX509Certificate() {
        try {
            InputStream targetStream = new ByteArrayInputStream(nokkel.getBytes());
            return (X509Certificate) CertificateFactory
                    .getInstance("X509")
                    .generateCertificate(targetStream);
        } catch (CertificateException e) {
            throw new IllegalArgumentException(e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy