Class CertificateTest


  • public class CertificateTest
    extends java.lang.Object
    • Constructor Detail

      • CertificateTest

        public CertificateTest()
    • Method Detail

      • beforeClass

        public static void beforeClass()
      • testCertRSA1024

        public void testCertRSA1024()
                             throws java.security.cert.CertificateException,
                                    java.io.IOException
        Throws:
        java.io.IOException
        java.security.cert.CertificateException
      • testCertPem

        public void testCertPem()
                         throws java.security.cert.CertificateException,
                                java.io.IOException
        Throws:
        java.io.IOException
        java.security.cert.CertificateException
      • testCertRSA2048

        public void testCertRSA2048()
                             throws java.security.cert.CertificateException,
                                    java.io.IOException
        Throws:
        java.io.IOException
        java.security.cert.CertificateException
      • testCertECC192

        public void testCertECC192()
                            throws java.security.cert.CertificateException,
                                   java.io.IOException
        Throws:
        java.io.IOException
        java.security.cert.CertificateException
      • testCertECC224

        public void testCertECC224()
                            throws java.security.cert.CertificateException,
                                   java.io.IOException
        Throws:
        java.io.IOException
        java.security.cert.CertificateException
      • testCertECC256

        public void testCertECC256()
                            throws java.security.cert.CertificateException,
                                   java.io.IOException
        Throws:
        java.io.IOException
        java.security.cert.CertificateException
      • checkValidityDoesNotThrowExceptionForValidCertificate

        public void checkValidityDoesNotThrowExceptionForValidCertificate()
                                                                   throws java.security.cert.CertificateException,
                                                                          java.io.IOException
        Uses a known certificate valid for a long time, uses current time to check the certificate validity.
        The test succeeds if there is no exception.
        Throws:
        java.security.cert.CertificateException - for any certificate related error
        java.io.IOException - for any file related error
      • checkValidityThrowsExceptionForCertificateNotYetValid

        public void checkValidityThrowsExceptionForCertificateNotYetValid()
                                                                   throws java.security.cert.CertificateException,
                                                                          java.io.IOException
        Uses a known valid in the future certificate, uses current time to check the certificate validity.
        The test expects a CertificateNotYetValidException exception.
        Throws:
        java.security.cert.CertificateException - for any certificate related error
        java.io.IOException - for any file related error
      • checkValidityThrowsExceptionForExpiredCertificate

        public void checkValidityThrowsExceptionForExpiredCertificate()
                                                               throws java.security.cert.CertificateException,
                                                                      java.io.IOException
        Uses a known old certificate, uses current time to check the certificate validity.
        The test expects a CertificateExpiredException exception.
        Throws:
        java.security.cert.CertificateException - for any certificate related error
        java.io.IOException - for any file related error
      • verifyCertificateWithValidKey_EC_P256

        public void verifyCertificateWithValidKey_EC_P256()
                                                   throws java.lang.Exception
        Verifies the signature of a certificate using the public part of the key that was used to sign it. The test succeed if the signature is valid. PK: EC P-256
        Throws:
        java.lang.Exception
      • verifyCertificateWithValidKey_EC_P224

        public void verifyCertificateWithValidKey_EC_P224()
                                                   throws java.lang.Exception
        Verifies the signature of a certificate using the public part of the key that was used to sign it. The test succeed if the signature is valid. PK: EC P-224
        Throws:
        java.lang.Exception
      • verifyCertificateWithValidKey_EC_P192

        public void verifyCertificateWithValidKey_EC_P192()
                                                   throws java.lang.Exception
        Verifies the signature of a certificate using the public part of the key that was used to sign it. The test succeed if the signature is valid PK: EC P-192
        Throws:
        java.lang.Exception
      • verifyCertificateWithValidKey_RSA_1024

        public void verifyCertificateWithValidKey_RSA_1024()
                                                    throws java.lang.Exception
        Verifies the signature of a certificate using the public part of the key that was used to sign it. The test succeed if the signature is valid PK: RSA 1024 bits
        Throws:
        java.lang.Exception
      • verifyCertificateWithValidKey_RSA_2048

        public void verifyCertificateWithValidKey_RSA_2048()
                                                    throws java.lang.Exception
        Verifies the signature of a certificate using the public part of the key that was used to sign it. The test succeed if the signature is valid PK: RSA 2048 bits
        Throws:
        java.lang.Exception
      • verifyCertificateWithInvalidKey_EC_P256

        public void verifyCertificateWithInvalidKey_EC_P256()
                                                     throws java.lang.Exception
        Verifies the signature of a certificate using an unrelated public key. The test succeed if the signature is invalid. PK: EC P-256
        Throws:
        java.lang.Exception
      • verifyCertificateWithInvalidKey_EC_P224

        public void verifyCertificateWithInvalidKey_EC_P224()
                                                     throws java.lang.Exception
        Verifies the signature of a certificate using an unrelated public key. The test succeed if the signature is invalid. PK: EC P-224
        Throws:
        java.lang.Exception
      • verifyCertificateWithInvalidKey_EC_P192

        public void verifyCertificateWithInvalidKey_EC_P192()
                                                     throws java.lang.Exception
        Verifies the signature of a certificate using an unrelated public key. The test succeed if the signature is invalid. PK: EC P-192
        Throws:
        java.lang.Exception
      • verifyCertificateWithInvalidKey_RSA_1024

        public void verifyCertificateWithInvalidKey_RSA_1024()
                                                      throws java.lang.Exception
        Verifies the signature of a certificate using an unrelated public key. The test succeed if the signature is invalid. PK: RSA 1024 bits
        Throws:
        java.lang.Exception
      • verifyCertificateWithInvalidKey_RSA_2048

        public void verifyCertificateWithInvalidKey_RSA_2048()
                                                      throws java.lang.Exception
        Verifies the signature of a certificate using an unrelated public key. The test succeed if the signature is invalid. PK: RSA 2048 bits
        Throws:
        java.lang.Exception