List of usage examples for java.security.cert X509Certificate getSubjectX500Principal
public X500Principal getSubjectX500Principal()
From source file:co.runrightfast.core.security.cert.CAIssuedX509V3CertRequest.java
public CAIssuedX509V3CertRequest(@NonNull final X509Certificate caCert, @NonNull final BigInteger serialNumber, @NonNull final Instant notBefore, @NonNull final Instant notAfter, @NonNull final X500Principal subjectPrincipal, @NonNull final PublicKey subjectPublicKey, @NonNull final Collection<X509CertExtension> extensions, @NonNull final BasicConstraints basicConstraints) { checkArgs(caCert, extensions);/*from www.j a v a 2s.c om*/ this.x509V3CertRequest = new X509V3CertRequest(caCert.getSubjectX500Principal(), serialNumber, notBefore, notAfter, subjectPrincipal, subjectPublicKey, augmentExtensions(extensions, caCert), basicConstraints); }
From source file:org.atricore.idbus.capabilities.clientcertauthn.X509CertificateAuthScheme.java
/** * Instantiates a Principal for the user X509 Certificate. * Used as the primary key to obtain the known credentials from the associated * store./*from ww w .j a v a2 s . c o m*/ * * @return the Principal associated with the input credentials. */ public Principal getPrincipal(Credential[] credentials) { X509Certificate certificate = getX509Certificate(credentials); X500Principal p = certificate.getSubjectX500Principal(); CertificatePrincipal targetPrincipal = null; if (_uidOID == null) { HashMap compoundName = parseCompoundName(p.getName()); // Extract from the Distinguished Name (DN) only the Common Name (CN) since its // the store who sets the root naming context to be used based on the // store configuration. String cn = (String) compoundName.get("cn"); if (cn == null) logger.error("Invalid Subject DN. Cannot create Principal : " + p.getName()); targetPrincipal = new CertificatePrincipal(cn, certificate); } else { try { byte[] oidValue = getOIDBitStringValueFromCert(certificate, _uidOID); if (oidValue == null) logger.error( "No value obtained for OID " + _uidOID + ". Cannot create Principal : " + p.getName()); // TODO: what if the OID is a compound value? targetPrincipal = new CertificatePrincipal(new String(oidValue), certificate); } catch (Exception e) { logger.error("Fatal error obtaining UID value using OID " + _uidOID + ". Cannot create Principal : " + p.getName(), e); } } return targetPrincipal; }
From source file:test.unit.be.fedict.eid.applet.service.signer.OOXMLSignatureVerifierTest.java
public void testOffice2010TechnicalPreview() throws Exception { // setup/* w w w . j ava 2 s .com*/ URL url = OOXMLSignatureVerifierTest.class.getResource("/hello-world-office-2010-technical-preview.docx"); // operate OOXMLSignatureVerifier verifier = new OOXMLSignatureVerifier(); List<X509Certificate> result = verifier.getSigners(url); // verify assertNotNull(result); assertEquals(1, result.size()); X509Certificate signer = result.get(0); LOG.debug("signer: " + signer.getSubjectX500Principal()); }
From source file:test.unit.be.fedict.eid.applet.service.signer.OOXMLSignatureVerifierTest.java
public void testGetSignerPowerpoint() throws Exception { // setup/* w w w . j a va 2 s. c om*/ URL url = OOXMLSignatureVerifierTest.class.getResource("/hello-world-signed.pptx"); // operate OOXMLSignatureVerifier verifier = new OOXMLSignatureVerifier(); List<X509Certificate> result = verifier.getSigners(url); // verify assertNotNull(result); assertEquals(1, result.size()); X509Certificate signer = result.get(0); LOG.debug("signer: " + signer.getSubjectX500Principal()); }
From source file:test.unit.be.fedict.eid.applet.service.signer.OOXMLSignatureVerifierTest.java
@Test public void testGetSigner() throws Exception { // setup//from w w w. j av a 2s . c om URL url = OOXMLSignatureVerifierTest.class.getResource("/hello-world-signed.docx"); // operate OOXMLSignatureVerifier verifier = new OOXMLSignatureVerifier(); List<X509Certificate> result = verifier.getSigners(url); // verify assertNotNull(result); assertEquals(1, result.size()); X509Certificate signer = result.get(0); LOG.debug("signer: " + signer.getSubjectX500Principal()); }
From source file:test.unit.be.fedict.eid.applet.service.signer.OOXMLSignatureVerifierTest.java
@Test public void testSignedOOXML() throws Exception { // setup//from w w w . j a va 2 s .c om URL url = OOXMLSignatureVerifierTest.class.getResource("/signed-ooxml.docx"); // operate OOXMLSignatureVerifier verifier = new OOXMLSignatureVerifier(); List<X509Certificate> result = verifier.getSigners(url); // verify assertNotNull(result); assertEquals(1, result.size()); X509Certificate signer = result.get(0); LOG.debug("signer: " + signer.getSubjectX500Principal()); }
From source file:test.unit.be.fedict.eid.applet.service.signer.OOXMLSignatureVerifierTest.java
@Test public void testSignedOOXMLOffice2010() throws Exception { // setup// w w w . ja v a 2 s. com URL url = OOXMLSignatureVerifierTest.class.getResource("/ms-office-2010-signed.docx"); // operate OOXMLSignatureVerifier verifier = new OOXMLSignatureVerifier(); List<X509Certificate> result = verifier.getSigners(url); // verify assertNotNull(result); assertEquals(1, result.size()); X509Certificate signer = result.get(0); LOG.debug("signer: " + signer.getSubjectX500Principal()); }
From source file:test.unit.be.fedict.eid.applet.service.signer.OOXMLSignatureVerifierTest.java
@Test public void testSignedOOXMLOffice2010Powerpoint() throws Exception { // setup//w w w . j a v a2 s . c o m URL url = OOXMLSignatureVerifierTest.class.getResource("/ms-office-2010-signed.pptx"); // operate OOXMLSignatureVerifier verifier = new OOXMLSignatureVerifier(); List<X509Certificate> result = verifier.getSigners(url); // verify assertNotNull(result); assertEquals(1, result.size()); X509Certificate signer = result.get(0); LOG.debug("signer: " + signer.getSubjectX500Principal()); }
From source file:test.unit.be.fedict.eid.applet.service.signer.OOXMLSignatureVerifierTest.java
@Test public void testSignedOOXMLOffice2010Excel() throws Exception { // setup//from w w w . ja va2 s . c o m URL url = OOXMLSignatureVerifierTest.class.getResource("/ms-office-2010-signed.xlsx"); // operate OOXMLSignatureVerifier verifier = new OOXMLSignatureVerifier(); List<X509Certificate> result = verifier.getSigners(url); // verify assertNotNull(result); assertEquals(1, result.size()); X509Certificate signer = result.get(0); LOG.debug("signer: " + signer.getSubjectX500Principal()); }
From source file:test.unit.be.fedict.eid.applet.service.signer.OOXMLSignatureVerifierTest.java
@Test public void testGetSignerExcel() throws Exception { // setup/*from www.j a va 2 s . c o m*/ URL url = OOXMLSignatureVerifierTest.class.getResource("/hello-world-signed.xlsx"); // operate OOXMLSignatureVerifier verifier = new OOXMLSignatureVerifier(); List<X509Certificate> result = verifier.getSigners(url); // verify assertNotNull(result); assertEquals(1, result.size()); X509Certificate signer = result.get(0); LOG.debug("signer: " + signer.getSubjectX500Principal()); }