From 330339e35d6f7d308433b055062be44fcbcf872b Mon Sep 17 00:00:00 2001 From: zhek Date: Tue, 20 Aug 2024 14:15:32 +0500 Subject: [PATCH] Allow to parse email from EMAILADDRESS attribute --- src/main/java/kz/ncanode/wrapper/CertificateWrapper.java | 4 ++-- .../kz/ncanode/unit/service/CertificateServiceTest.groovy | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/kz/ncanode/wrapper/CertificateWrapper.java b/src/main/java/kz/ncanode/wrapper/CertificateWrapper.java index 366137a6..a1c832c5 100644 --- a/src/main/java/kz/ncanode/wrapper/CertificateWrapper.java +++ b/src/main/java/kz/ncanode/wrapper/CertificateWrapper.java @@ -259,7 +259,7 @@ private static Optional createCertificateSubjectFromDn(Strin subjectBuilder.locality((String)rdn.getValue()); } else if (rdn.getType().equalsIgnoreCase("S")) { subjectBuilder.state((String)rdn.getValue()); - } else if (rdn.getType().equalsIgnoreCase("E")) { + } else if ((rdn.getType().equalsIgnoreCase("E")) || (rdn.getType().equalsIgnoreCase("EMAILADDRESS"))) { subjectBuilder.email((String)rdn.getValue()); } else if (rdn.getType().equalsIgnoreCase("O")) { subjectBuilder.organization((String)rdn.getValue()); @@ -276,7 +276,7 @@ private static Optional createCertificateSubjectFromDn(Strin return Optional.of(subjectBuilder.build()); } catch (InvalidNameException e) { - log.warn("Distinguished name parseing error", e); + log.warn("Distinguished name parsing error", e); return Optional.empty(); } } diff --git a/src/test/groovy/kz/ncanode/unit/service/CertificateServiceTest.groovy b/src/test/groovy/kz/ncanode/unit/service/CertificateServiceTest.groovy index a34c7905..2d270365 100644 --- a/src/test/groovy/kz/ncanode/unit/service/CertificateServiceTest.groovy +++ b/src/test/groovy/kz/ncanode/unit/service/CertificateServiceTest.groovy @@ -26,7 +26,7 @@ class CertificateServiceTest extends Specification implements WithTestData { result.signers.size() == 1 } - def "invalid cetificate info method"() { + def "invalid certificate info method"() { given: def certs = [ "YXNkYXNk"