diff --git a/src/main/java/kz/ncanode/wrapper/CertificateWrapper.java b/src/main/java/kz/ncanode/wrapper/CertificateWrapper.java index a1c832c..299200f 100644 --- a/src/main/java/kz/ncanode/wrapper/CertificateWrapper.java +++ b/src/main/java/kz/ncanode/wrapper/CertificateWrapper.java @@ -193,19 +193,23 @@ public PublicKey getPublicKey() { return x509Certificate.getPublicKey(); } - private Set getKeyUser() { + public List getExtendedKeyUsage() { try { - return getX509Certificate().getExtendedKeyUsage().stream() - .map(CertificateKeyUser::fromOID) - .filter(Optional::isPresent) - .map(Optional::get) - .collect(Collectors.toSet()); + return getX509Certificate().getExtendedKeyUsage(); } catch (CertificateParsingException e) { log.error("Certificate key user extracting error", e); - return Collections.emptySet(); + return Collections.emptyList(); } } + private Set getKeyUser() { + return getExtendedKeyUsage().stream() + .map(CertificateKeyUser::fromOID) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(Collectors.toSet()); + } + public static Optional fromBase64(final String encodedCert) { return fromBytes(Base64.getDecoder().decode(encodedCert.replaceAll("\\s", ""))); }