Project OIOSAML使用Bouncy Castle API,由Apache Ivy管理。
ive .xml部分:
...
<dependency org="org.bouncycastle" name="bcprov-jdk15on" rev="1.49" conf="*->*,!sources,!javadoc"/>
<dependency org="org.bouncycastle" name="bcpkix-jdk15on" rev="1.49" conf="*->*,!sources,!javadoc"/>
...
我使用具有相同依赖关系的Maven。部分pom.xml:
...
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.49</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.49</version>
</dependency>
...
但是,我在X509Extension
类中找不到subjectKeyIdentifier
和authorityKeyIdentifier
字段。
部分SecurityHelper
类:
package dk.itst.oiosaml.security;
public class SecurityHelper {
...
public static X509Certificate generateCertificate(Credential credential, String entityId) throws Exception {
...
gen.addExtension(X509Extension.subjectKeyIdentifier, false, new JcaX509ExtensionUtils().createSubjectKeyIdentifier(credential.getPublicKey()));
gen.addExtension(X509Extension.authorityKeyIdentifier, false, new JcaX509ExtensionUtils().createAuthorityKeyIdentifier(credential.getPublicKey()));
...
}
}
X509Extension
class:
package org.bouncycastle.asn1.x509;
public class X509Extension {
boolean critical;
org.bouncycastle.asn1.ASN1OctetString value;
public X509Extension(org.bouncycastle.asn1.DERBoolean derBoolean, org.bouncycastle.asn1.ASN1OctetString asn1OctetString) { /* compiled code */ }
public X509Extension(boolean b, org.bouncycastle.asn1.ASN1OctetString asn1OctetString) { /* compiled code */ }
public boolean isCritical() { /* compiled code */ }
public org.bouncycastle.asn1.ASN1OctetString getValue() { /* compiled code */ }
public int hashCode() { /* compiled code */ }
public boolean equals(java.lang.Object o) { /* compiled code */ }
public static org.bouncycastle.asn1.ASN1Object convertValueToObject(org.bouncycastle.asn1.x509.X509Extension x509Extension) throws java.lang.IllegalArgumentException { /* compiled code */ }
}
需要使用哪个版本的Bouncy Castle API来与OIOSAML一起工作?
是org.bouncycastle-bcprov-jdk15.jar
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15</artifactId>
<version>1.46</version>
</dependency>