Class KeyInfoSupportTest
- java.lang.Object
-
- org.opensaml.core.testing.OpenSAMLInitBaseTestCase
-
- org.opensaml.core.testing.XMLObjectBaseTestCase
-
- org.opensaml.xmlsec.keyinfo.tests.KeyInfoSupportTest
-
public class KeyInfoSupportTest extends XMLObjectBaseTestCase
Test to exercise the KeyInfoSupport methods to convert between XMLObject's contained within KeyInfo and Java security native types.
-
-
Field Summary
Fields Modifier and Type Field Description private Stringcert1Test cert 1.private Stringcert1DigestBase64Test cert 1 SHA-1 digest.private Stringcert1SKIPlainBase64Test cert 1 SKI value.private Stringcert1SubjectDNTest cert subject DN 1.private Stringcert2Test cert 2.private Stringcert2SubjectDNTest cert subject DN 2.private StringcertNoExtensionsCert which contains no X.509 v3 extensions.private Stringcrl1Test CRL 1.private Stringcrl1IssuerDNTest cert issuer DN 1.private StringdhPubKey1Test DH key 1.private StringdsaPubKey1Test DSA key 1.private StringecPubKey_ExplicitParams1Test EC key with explicit params variant 1, curve: secp256r1, OID: 1.2.840.10045.3.1.7private StringecPubKey_ExplicitParams1_OIDOID of the curve for ecPubKey_ExplicitParams1, curve: secp256r1.private StringecPubKey_NamedCurve1Test EC key with named curve variant 1, curve: secp256r1, OID: 1.2.840.10045.3.1.7private StringecPubKey_NamedCurve1_OIDOID of the curve for ecPubKey_NamedCurve1, curve: secp256r1.private X509CertificatejavaCert1private X509CRLjavaCRL1private DHPublicKeyjavaDHPubKey1private DSAParamsjavaDSAParams1private DSAPublicKeyjavaDSAPubKey1private ECPublicKeyjavaECPubKey_ExplicitParams1private ECPublicKeyjavaECPubKey_NamedCurve1private RSAPublicKeyjavaRSAPubKey1private KeyInfokeyInfoprivate KeyValuekeyValueprivate intnumExpectedCertsprivate intnumExpectedCRLsprivate StringrsaPubKey1Test RSA key 1.private X509CertificatexmlCert1private X509CertificatexmlCert2private X509CRLxmlCRL1private DHKeyValuexmlDHKeyValue1private DSAKeyValuexmlDSAKeyValue1private DSAKeyValuexmlDSAKeyValue1NoParamsprivate ECKeyValuexmlECKeyValue_ExplicitParams1private ECKeyValuexmlECKeyValue_NamedCurve1private RSAKeyValuexmlRSAKeyValue1private X509DataxmlX509Data-
Fields inherited from class org.opensaml.core.testing.XMLObjectBaseTestCase
builderFactory, marshallerFactory, parserPool, simpleXMLObjectQName, unmarshallerFactory
-
-
Constructor Summary
Constructors Constructor Description KeyInfoSupportTest()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ECPublicKeybuildECPublicKeyWithExplicitParams(String encodedKey)protected voidsetUp()voidtestAddDEREncodedDHPublicKey()Tests adding a public key as a DEREncodedKeyValue to KeyInfo.voidtestAddDEREncodedDSAPublicKey()Tests adding a public key as a DEREncodedKeyValue to KeyInfo.voidtestAddDEREncodedECPublicKeyWithExplictParams()Tests adding a public key as a DEREncodedKeyValue to KeyInfo.voidtestAddDEREncodedECPublicKeyWithNamedCurve()Tests adding a public key as a DEREncodedKeyValue to KeyInfo.voidtestAddDEREncodedRSAPublicKey()Tests adding a public key as a DEREncodedKeyValue to KeyInfo.voidtestAddDHPublicKey()Tests adding a public key as a KeyValue to KeyInfo.voidtestAddDSAPublicKey()Tests adding a public key as a KeyValue to KeyInfo.voidtestAddECPublicKeyWithExplicitParams()Tests adding a public key as a KeyValue to KeyInfo.voidtestAddECPublicKeyWithNamedCurve()Tests adding a public key as a KeyValue to KeyInfo.voidtestAddRSAPublicKey()Tests adding a public key as a KeyValue to KeyInfo.voidtestAddX509Certificate()Tests adding a certificate as a X509Data/X509Certificate to KeyInfo.voidtestAddX509CRL()Tests adding a CRL as a X509Data/X509CRL to KeyInfo.voidtestBuildDigest()Tests building a new X509Digest from a certificate.voidtestBuildIssuerSerial()Tests building a new X509IssuerSerial.voidtestBuildSubjectKeyIdentifier()Tests building a new X509SKI from a certificate containing an SKI value.voidtestBuildSubjectName()Tests building a new X509SubjectName.voidtestCertConversionJavaToXML()Test converting java.security.cert.X509Certificate to XML X509Certificate.voidtestCertConversionXMLtoJava()Test converting XML X509Certificate to java.security.cert.X509Certificate.voidtestCRLConversionJavaToXML()Test converting java.security.cert.X509CRL to XML X509CRL.voidtestCRLConversionXMLtoJava()Test converting XML X509CRL to java.security.cert.X509CRL.voidtestDHConversionJavaToXML()Test conversion of DH public keys from Java security native type to XML.voidtestDHConversionXMLToJava()Test conversion of DH public keys from XML to Java security native type.voidtestDSAConversionJavaToXML()Test conversion of DSA public keys from Java security native type to XML.voidtestDSAConversionXMLToJava()Test conversion of DSA public keys from XML to Java security native type.voidtestECConversionJavaToXMLWithExplicitParameters()Test conversion of EC public keys from Java security native type to XML.voidtestECConversionJavaToXMLWithNamedCurve()Test conversion of EC public keys from Java security native type to XML.voidtestECConversionXMLToJavaWithExplicitParameters()Test conversion of EC public keys from XML to Java security native type.voidtestECConversionXMLToJavaWithNamedCurve()Test conversion of EC public keys from XML to Java security native type.voidtestGetDHKey()Tests extracting a DH public key from a KeyValue.voidtestGetDSAKey()Tests extracting a DSA public key from a KeyValue.voidtestGetRSAKey()Tests extracting a RSA public key from a KeyValue.voidtestRSAConversionJavaToXML()Test conversion of RSA public keys from Java security native type to XML.voidtestRSAConversionXMLToJava()Test conversion of RSA public keys from XML to Java security native type.-
Methods inherited from class org.opensaml.core.testing.XMLObjectBaseTestCase
assertXMLEquals, assertXMLEquals, buildXMLObject, getBuilder, getMarshaller, getMarshaller, getUnmarshaller, getUnmarshaller, getUnmarshaller, initXMLObjectSupport, parseXMLDocument, printXML, printXML, unmarshallElement, unmarshallElement
-
Methods inherited from class org.opensaml.core.testing.OpenSAMLInitBaseTestCase
initOpenSAML
-
-
-
-
Field Detail
-
certNoExtensions
private final String certNoExtensions
Cert which contains no X.509 v3 extensions.- See Also:
- Constant Field Values
-
cert1SubjectDN
private final String cert1SubjectDN
Test cert subject DN 1.- See Also:
- Constant Field Values
-
cert1SKIPlainBase64
private final String cert1SKIPlainBase64
Test cert 1 SKI value. Base64 encoded version of cert's plain (non-DER encoded) subject key identifier, which is: AF:B9:F9:1D:C2:45:18:CC:B8:21:E2:A7:47:BC:49:BD:19:B5:78:28- See Also:
- Constant Field Values
-
cert1DigestBase64
private final String cert1DigestBase64
Test cert 1 SHA-1 digest.- See Also:
- Constant Field Values
-
cert1
private final String cert1
Test cert 1.- See Also:
- Constant Field Values
-
cert2SubjectDN
private final String cert2SubjectDN
Test cert subject DN 2.- See Also:
- Constant Field Values
-
cert2
private final String cert2
Test cert 2.- See Also:
- Constant Field Values
-
crl1IssuerDN
private final String crl1IssuerDN
Test cert issuer DN 1.- See Also:
- Constant Field Values
-
crl1
private final String crl1
Test CRL 1.- See Also:
- Constant Field Values
-
rsaPubKey1
private final String rsaPubKey1
Test RSA key 1.- See Also:
- Constant Field Values
-
dsaPubKey1
private final String dsaPubKey1
Test DSA key 1.- See Also:
- Constant Field Values
-
dhPubKey1
private final String dhPubKey1
Test DH key 1.- See Also:
- Constant Field Values
-
ecPubKey_NamedCurve1
private final String ecPubKey_NamedCurve1
Test EC key with named curve variant 1, curve: secp256r1, OID: 1.2.840.10045.3.1.7- See Also:
- Constant Field Values
-
ecPubKey_NamedCurve1_OID
private final String ecPubKey_NamedCurve1_OID
OID of the curve for ecPubKey_NamedCurve1, curve: secp256r1.- See Also:
- Constant Field Values
-
ecPubKey_ExplicitParams1
private final String ecPubKey_ExplicitParams1
Test EC key with explicit params variant 1, curve: secp256r1, OID: 1.2.840.10045.3.1.7- See Also:
- Constant Field Values
-
ecPubKey_ExplicitParams1_OID
private final String ecPubKey_ExplicitParams1_OID
OID of the curve for ecPubKey_ExplicitParams1, curve: secp256r1.- See Also:
- Constant Field Values
-
xmlCert1
private X509Certificate xmlCert1
-
xmlCert2
private X509Certificate xmlCert2
-
xmlCRL1
private X509CRL xmlCRL1
-
xmlX509Data
private X509Data xmlX509Data
-
keyInfo
private KeyInfo keyInfo
-
keyValue
private KeyValue keyValue
-
xmlDSAKeyValue1
private DSAKeyValue xmlDSAKeyValue1
-
xmlDSAKeyValue1NoParams
private DSAKeyValue xmlDSAKeyValue1NoParams
-
xmlDHKeyValue1
private DHKeyValue xmlDHKeyValue1
-
xmlRSAKeyValue1
private RSAKeyValue xmlRSAKeyValue1
-
xmlECKeyValue_NamedCurve1
private ECKeyValue xmlECKeyValue_NamedCurve1
-
xmlECKeyValue_ExplicitParams1
private ECKeyValue xmlECKeyValue_ExplicitParams1
-
numExpectedCerts
private int numExpectedCerts
-
numExpectedCRLs
private int numExpectedCRLs
-
javaCert1
private X509Certificate javaCert1
-
javaCRL1
private X509CRL javaCRL1
-
javaRSAPubKey1
private RSAPublicKey javaRSAPubKey1
-
javaDSAPubKey1
private DSAPublicKey javaDSAPubKey1
-
javaDHPubKey1
private DHPublicKey javaDHPubKey1
-
javaECPubKey_NamedCurve1
private ECPublicKey javaECPubKey_NamedCurve1
-
javaECPubKey_ExplicitParams1
private ECPublicKey javaECPubKey_ExplicitParams1
-
javaDSAParams1
private DSAParams javaDSAParams1
-
-
Method Detail
-
setUp
@BeforeMethod protected void setUp() throws Exception
- Throws:
Exception
-
testCertConversionXMLtoJava
public void testCertConversionXMLtoJava() throws CertificateExceptionTest converting XML X509Certificate to java.security.cert.X509Certificate.- Throws:
CertificateException- ...
-
testCRLConversionXMLtoJava
public void testCRLConversionXMLtoJava() throws CertificateException, CRLExceptionTest converting XML X509CRL to java.security.cert.X509CRL.- Throws:
CRLException- ...CertificateException- ...
-
testCertConversionJavaToXML
public void testCertConversionJavaToXML() throws CertificateExceptionTest converting java.security.cert.X509Certificate to XML X509Certificate.- Throws:
CertificateException- ...
-
testCRLConversionJavaToXML
public void testCRLConversionJavaToXML() throws CertificateException, CRLExceptionTest converting java.security.cert.X509CRL to XML X509CRL.- Throws:
CRLException- ...CertificateException- ...
-
testDSAConversionXMLToJava
public void testDSAConversionXMLToJava()
Test conversion of DSA public keys from XML to Java security native type.
-
testDHConversionXMLToJava
public void testDHConversionXMLToJava()
Test conversion of DH public keys from XML to Java security native type.
-
testRSAConversionXMLToJava
public void testRSAConversionXMLToJava()
Test conversion of RSA public keys from XML to Java security native type.
-
testECConversionXMLToJavaWithNamedCurve
public void testECConversionXMLToJavaWithNamedCurve()
Test conversion of EC public keys from XML to Java security native type.
-
testECConversionXMLToJavaWithExplicitParameters
public void testECConversionXMLToJavaWithExplicitParameters()
Test conversion of EC public keys from XML to Java security native type.
-
testDHConversionJavaToXML
public void testDHConversionJavaToXML() throws EncodingExceptionTest conversion of DH public keys from Java security native type to XML.- Throws:
EncodingException- on base64 encoding error
-
testDSAConversionJavaToXML
public void testDSAConversionJavaToXML() throws EncodingExceptionTest conversion of DSA public keys from Java security native type to XML.- Throws:
EncodingException- on base64 encoding error
-
testRSAConversionJavaToXML
public void testRSAConversionJavaToXML() throws EncodingExceptionTest conversion of RSA public keys from Java security native type to XML.- Throws:
EncodingException- on base64 encoding error
-
testECConversionJavaToXMLWithNamedCurve
public void testECConversionJavaToXMLWithNamedCurve() throws EncodingException, KeyException, DecodingExceptionTest conversion of EC public keys from Java security native type to XML.- Throws:
EncodingException- on base64 encoding errorDecodingExceptionKeyException
-
testECConversionJavaToXMLWithExplicitParameters
public void testECConversionJavaToXMLWithExplicitParameters() throws EncodingException, KeyException, DecodingExceptionTest conversion of EC public keys from Java security native type to XML.- Throws:
EncodingException- on base64 encoding errorDecodingExceptionKeyException
-
testGetDHKey
public void testGetDHKey()
Tests extracting a DH public key from a KeyValue.
-
testGetDSAKey
public void testGetDSAKey()
Tests extracting a DSA public key from a KeyValue.
-
testGetRSAKey
public void testGetRSAKey()
Tests extracting a RSA public key from a KeyValue.
-
testAddDSAPublicKey
public void testAddDSAPublicKey() throws EncodingExceptionTests adding a public key as a KeyValue to KeyInfo.- Throws:
EncodingException- on base64 encoding error
-
testAddDHPublicKey
public void testAddDHPublicKey() throws EncodingExceptionTests adding a public key as a KeyValue to KeyInfo.- Throws:
EncodingException- on base64 encoding error
-
testAddRSAPublicKey
public void testAddRSAPublicKey() throws EncodingExceptionTests adding a public key as a KeyValue to KeyInfo.- Throws:
EncodingException- on base64 encoding error
-
testAddECPublicKeyWithNamedCurve
public void testAddECPublicKeyWithNamedCurve() throws EncodingExceptionTests adding a public key as a KeyValue to KeyInfo.- Throws:
EncodingException- on base64 encoding error
-
testAddECPublicKeyWithExplicitParams
public void testAddECPublicKeyWithExplicitParams() throws EncodingExceptionTests adding a public key as a KeyValue to KeyInfo.- Throws:
EncodingException- on base64 encoding error
-
testAddDEREncodedDSAPublicKey
public void testAddDEREncodedDSAPublicKey()
Tests adding a public key as a DEREncodedKeyValue to KeyInfo.
-
testAddDEREncodedRSAPublicKey
public void testAddDEREncodedRSAPublicKey()
Tests adding a public key as a DEREncodedKeyValue to KeyInfo.
-
testAddDEREncodedECPublicKeyWithNamedCurve
public void testAddDEREncodedECPublicKeyWithNamedCurve()
Tests adding a public key as a DEREncodedKeyValue to KeyInfo.
-
testAddDEREncodedECPublicKeyWithExplictParams
public void testAddDEREncodedECPublicKeyWithExplictParams()
Tests adding a public key as a DEREncodedKeyValue to KeyInfo.
-
testAddDEREncodedDHPublicKey
public void testAddDEREncodedDHPublicKey()
Tests adding a public key as a DEREncodedKeyValue to KeyInfo.
-
testAddX509Certificate
public void testAddX509Certificate() throws CertificateExceptionTests adding a certificate as a X509Data/X509Certificate to KeyInfo.- Throws:
CertificateException- ...
-
testAddX509CRL
public void testAddX509CRL() throws CRLExceptionTests adding a CRL as a X509Data/X509CRL to KeyInfo.- Throws:
CRLException- ...
-
testBuildSubjectName
public void testBuildSubjectName()
Tests building a new X509SubjectName.
-
testBuildIssuerSerial
public void testBuildIssuerSerial()
Tests building a new X509IssuerSerial.
-
testBuildSubjectKeyIdentifier
public void testBuildSubjectKeyIdentifier() throws CertificateException, DecodingException, SecurityExceptionTests building a new X509SKI from a certificate containing an SKI value.- Throws:
CertificateException- ...DecodingException- if an issue base64-decoding SKI valuesSecurityException- if an issue building X509SKI.
-
testBuildDigest
public void testBuildDigest() throws CertificateException, DecodingExceptionTests building a new X509Digest from a certificate.- Throws:
CertificateException- ...DecodingException- if an issue base64-decoding digests.
-
buildECPublicKeyWithExplicitParams
private ECPublicKey buildECPublicKeyWithExplicitParams(String encodedKey) throws KeyException
- Throws:
KeyException
-
-