[java-identity-provider COMMIT] in /trunk/idp-profile-spring/src: main/java/net/shibboleth/idp/profile/spring/relying...
noreply at shibboleth.net
noreply at shibboleth.net
Mon May 5 05:07:06 EDT 2014
Author: rdw
Date: Mon May 5 05:07:06 2014
New Revision: 5834
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5834&view=rev
Log:
IDP-390 As per discussion 5/5/14 inline certificates are Base64Encoded DER with no header/footer
Modified:
trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/X509InlineCredentialFactoryBean.java
trunk/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/security/credential/inlineCertOnly.xml
trunk/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/security/credential/inlineKeyCertCrl.xml
Modified: trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/X509InlineCredentialFactoryBean.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/X509InlineCredentialFactoryBean.java?rev=5834&r1=5833&r2=5834&view=diff
==============================================================================
--- trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/X509InlineCredentialFactoryBean.java (original)
+++ trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/X509InlineCredentialFactoryBean.java Mon May 5 05:07:06 2014
@@ -22,7 +22,6 @@
import java.security.cert.CertificateException;
import java.security.cert.X509CRL;
import java.security.cert.X509Certificate;
-import java.util.Collection;
import java.util.List;
import javax.annotation.Nonnull;
@@ -46,24 +45,24 @@
private final Logger log = LoggerFactory.getLogger(X509InlineCredentialFactoryBean.class);
/** The entity certificate. */
- private byte[] entityCertificate;
+ private String entityCertificate;
/** The certificates. */
- private List<byte[]> certificates;
+ private List<String> certificates;
/** The private key. */
private byte[] privateKey;
/** The crls. */
- private List<byte[]> crls;
+ private List<String> crls;
/**
* Set the file with the entity certificate.
*
- * @param file The file to set.
+ * @param entityCert The file to set.
*/
- public void setEntity(@Nonnull final byte[] file) {
- entityCertificate = file;
+ public void setEntity(@Nonnull final String entityCert) {
+ entityCertificate = entityCert;
}
/**
@@ -71,7 +70,7 @@
*
* @param certs The value to set.
*/
- public void setCertificates(@Nullable @NotEmpty final List<byte[]> certs) {
+ public void setCertificates(@Nullable @NotEmpty final List<String> certs) {
certificates = certs;
}
@@ -89,7 +88,7 @@
*
* @param list The value to set.
*/
- public void setCrls(@Nullable @NotEmpty final List<byte[]> list) {
+ public void setCrls(@Nullable @NotEmpty final List<String> list) {
crls = list;
}
@@ -100,14 +99,7 @@
return null;
}
try {
- final Collection<X509Certificate> certs = X509Support.decodeCertificates(entityCertificate);
- if (certs.size() > 1) {
- log.error("{}: Configuration element indicated an entityCertificate,"
- + " but multiple certificates were decoded");
- throw new FatalBeanException("Configuration element indicated an entityCertificate,"
- + " but multiple certificates were decoded");
- }
- return certs.iterator().next();
+ return X509Support.decodeCertificate(entityCertificate);
} catch (CertificateException e) {
log.error("{}: Could not decode provided Entity Certificate:{}", getConfigFile(), e);
throw new FatalBeanException("Could not decode provided Entity Certificate", e);
@@ -117,9 +109,9 @@
/** {@inheritDoc} */
@Override @Nonnull protected List<X509Certificate> getCertificates() {
List<X509Certificate> certs = new LazyList<>();
- for (byte[] cert : certificates) {
+ for (String cert : certificates) {
try {
- certs.addAll(X509Support.decodeCertificates(cert));
+ certs.add(X509Support.decodeCertificate(cert.trim()));
} catch (CertificateException e) {
log.error("{}: Could not decode provided Certificate:{}", getConfigFile(), e);
throw new FatalBeanException("Could not decode provided Certificate", e);
@@ -142,10 +134,10 @@
return null;
}
List<X509CRL> result = new LazyList<>();
- for (byte[] crl : crls) {
+ for (String crl : crls) {
try {
- result.addAll(X509Support.decodeCRLs(crl));
- } catch (CRLException e) {
+ result.add(X509Support.decodeCRL(crl));
+ } catch (CRLException | CertificateException e) {
[... 318 lines stripped ...]
More information about the commits
mailing list