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 org.opensaml.core.testing.XMLObjectBaseTestCase
Test to exercise the KeyInfoSupport methods to convert between XMLObject's contained within KeyInfo and Java security native types.
  • Field Details

    • certNoExtensions

      private final String certNoExtensions
      Cert which contains no X.509 v3 extensions.
      See Also:
    • cert1SubjectDN

      private final String cert1SubjectDN
      Test cert subject DN 1.
      See Also:
    • 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:
    • cert1DigestBase64

      private final String cert1DigestBase64
      Test cert 1 SHA-1 digest.
      See Also:
    • cert1

      private final String cert1
      Test cert 1.
      See Also:
    • cert2SubjectDN

      private final String cert2SubjectDN
      Test cert subject DN 2.
      See Also:
    • cert2

      private final String cert2
      Test cert 2.
      See Also:
    • crl1IssuerDN

      private final String crl1IssuerDN
      Test cert issuer DN 1.
      See Also:
    • crl1

      private final String crl1
      Test CRL 1.
      See Also:
    • rsaPubKey1

      private final String rsaPubKey1
      Test RSA key 1.
      See Also:
    • dsaPubKey1

      private final String dsaPubKey1
      Test DSA key 1.
      See Also:
    • dhPubKey1

      private final String dhPubKey1
      Test DH key 1.
      See Also:
    • 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:
    • ecPubKey_NamedCurve1_OID

      private final String ecPubKey_NamedCurve1_OID
      OID of the curve for ecPubKey_NamedCurve1, curve: secp256r1.
      See Also:
    • 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:
    • ecPubKey_ExplicitParams1_OID

      private final String ecPubKey_ExplicitParams1_OID
      OID of the curve for ecPubKey_ExplicitParams1, curve: secp256r1.
      See Also:
    • 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
  • Constructor Details

    • KeyInfoSupportTest

      public KeyInfoSupportTest()
      Constructor.
  • Method Details

    • setUp

      @BeforeMethod protected void setUp() throws Exception
      Throws:
      Exception
    • testCertConversionXMLtoJava

      public void testCertConversionXMLtoJava() throws CertificateException
      Test converting XML X509Certificate to java.security.cert.X509Certificate.
      Throws:
      CertificateException - ...
    • testCRLConversionXMLtoJava

      public void testCRLConversionXMLtoJava() throws CertificateException, CRLException
      Test converting XML X509CRL to java.security.cert.X509CRL.
      Throws:
      CRLException - ...
      CertificateException - ...
    • testCertConversionJavaToXML

      public void testCertConversionJavaToXML() throws CertificateException
      Test converting java.security.cert.X509Certificate to XML X509Certificate.
      Throws:
      CertificateException - ...
    • testCRLConversionJavaToXML

      public void testCRLConversionJavaToXML() throws CertificateException, CRLException
      Test 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 EncodingException
      Test conversion of DH public keys from Java security native type to XML.
      Throws:
      EncodingException - on base64 encoding error
    • testDSAConversionJavaToXML

      public void testDSAConversionJavaToXML() throws EncodingException
      Test conversion of DSA public keys from Java security native type to XML.
      Throws:
      EncodingException - on base64 encoding error
    • testRSAConversionJavaToXML

      public void testRSAConversionJavaToXML() throws EncodingException
      Test 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, DecodingException
      Test conversion of EC public keys from Java security native type to XML.
      Throws:
      EncodingException - on base64 encoding error
      DecodingException
      KeyException
    • testECConversionJavaToXMLWithExplicitParameters

      public void testECConversionJavaToXMLWithExplicitParameters() throws EncodingException, KeyException, DecodingException
      Test conversion of EC public keys from Java security native type to XML.
      Throws:
      EncodingException - on base64 encoding error
      DecodingException
      KeyException
    • 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 EncodingException
      Tests adding a public key as a KeyValue to KeyInfo.
      Throws:
      EncodingException - on base64 encoding error
    • testAddDHPublicKey

      public void testAddDHPublicKey() throws EncodingException
      Tests adding a public key as a KeyValue to KeyInfo.
      Throws:
      EncodingException - on base64 encoding error
    • testAddRSAPublicKey

      public void testAddRSAPublicKey() throws EncodingException
      Tests adding a public key as a KeyValue to KeyInfo.
      Throws:
      EncodingException - on base64 encoding error
    • testAddECPublicKeyWithNamedCurve

      public void testAddECPublicKeyWithNamedCurve() throws EncodingException
      Tests adding a public key as a KeyValue to KeyInfo.
      Throws:
      EncodingException - on base64 encoding error
    • testAddECPublicKeyWithExplicitParams

      public void testAddECPublicKeyWithExplicitParams() throws EncodingException
      Tests 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 CertificateException
      Tests adding a certificate as a X509Data/X509Certificate to KeyInfo.
      Throws:
      CertificateException - ...
    • testAddX509CRL

      public void testAddX509CRL() throws CRLException
      Tests 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, SecurityException
      Tests building a new X509SKI from a certificate containing an SKI value.
      Throws:
      CertificateException - ...
      DecodingException - if an issue base64-decoding SKI values
      SecurityException - if an issue building X509SKI.
    • testBuildDigest

      public void testBuildDigest() throws CertificateException, DecodingException
      Tests 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