@Test(expected = CodedException.class) public void shouldFailIfOrgMissing() throws GeneralSecurityException, IOException, OperatorCreationException { final X509Certificate cert = generateSelfSignedCertificate( "C=FI, CN=1234567-8, serialNumber=FI-TEST/serverCode/PUB", keyPair); FISubjectClientIdDecoder.getSubjectClientId(cert); }
public static ClientId getSubjectClientId(X509Certificate cert) { X500Principal principal = cert.getSubjectX500Principal(); X500Name x500name = new X500Name(principal.getName()); if (getRDNValue(x500name, BCStyle.SERIALNUMBER) == null) { if (getRDNValue(x500name, BCStyle.OU) == null) { return CertUtils.getSubjectClientId(cert); } return parseClientIdFromLegacyName(x500name); } return parseClientId(x500name); }
FISubjectClientIdDecoder { public static ClientId getSubjectClientId(X509Certificate cert) { X500Principal principal = cert.getSubjectX500Principal(); X500Name x500name = new X500Name(principal.getName()); if (getRDNValue(x500name, BCStyle.SERIALNUMBER) == null) { if (getRDNValue(x500name, BCStyle.OU) == null) { return CertUtils.getSubjectClientId(cert); } return parseClientIdFromLegacyName(x500name); } return parseClientId(x500name); } }
FISubjectClientIdDecoder { public static ClientId getSubjectClientId(X509Certificate cert) { X500Principal principal = cert.getSubjectX500Principal(); X500Name x500name = new X500Name(principal.getName()); if (getRDNValue(x500name, BCStyle.SERIALNUMBER) == null) { if (getRDNValue(x500name, BCStyle.OU) == null) { return CertUtils.getSubjectClientId(cert); } return parseClientIdFromLegacyName(x500name); } return parseClientId(x500name); } private  FISubjectClientIdDecoder(); }
FISubjectClientIdDecoder { public static ClientId getSubjectClientId(X509Certificate cert) { X500Principal principal = cert.getSubjectX500Principal(); X500Name x500name = new X500Name(principal.getName()); if (getRDNValue(x500name, BCStyle.SERIALNUMBER) == null) { if (getRDNValue(x500name, BCStyle.OU) == null) { return CertUtils.getSubjectClientId(cert); } return parseClientIdFromLegacyName(x500name); } return parseClientId(x500name); } private  FISubjectClientIdDecoder(); static ClientId getSubjectClientId(X509Certificate cert); }
FISubjectClientIdDecoder { public static ClientId getSubjectClientId(X509Certificate cert) { X500Principal principal = cert.getSubjectX500Principal(); X500Name x500name = new X500Name(principal.getName()); if (getRDNValue(x500name, BCStyle.SERIALNUMBER) == null) { if (getRDNValue(x500name, BCStyle.OU) == null) { return CertUtils.getSubjectClientId(cert); } return parseClientIdFromLegacyName(x500name); } return parseClientId(x500name); } private  FISubjectClientIdDecoder(); static ClientId getSubjectClientId(X509Certificate cert); static final int NUM_COMPONENTS; }