Package com.microej.crypto.test
Class CertificateTest
- java.lang.Object
-
- com.microej.crypto.test.CertificateTest
-
public class CertificateTest extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description CertificateTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidbeforeClass()voidcheckValidityDoesNotThrowExceptionForValidCertificate()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.voidcheckValidityThrowsExceptionForCertificateNotYetValid()Uses a known valid in the future certificate, uses current time to check the certificate validity.
The test expects a CertificateNotYetValidException exception.voidcheckValidityThrowsExceptionForExpiredCertificate()Uses a known old certificate, uses current time to check the certificate validity.
The test expects a CertificateExpiredException exception.voidtestCertECC192()voidtestCertECC224()voidtestCertECC256()voidtestCertPem()voidtestCertRSA1024()voidtestCertRSA2048()voidverifyCertificateWithInvalidKey_EC_P192()Verifies the signature of a certificate using an unrelated public key.voidverifyCertificateWithInvalidKey_EC_P224()Verifies the signature of a certificate using an unrelated public key.voidverifyCertificateWithInvalidKey_EC_P256()Verifies the signature of a certificate using an unrelated public key.voidverifyCertificateWithInvalidKey_RSA_1024()Verifies the signature of a certificate using an unrelated public key.voidverifyCertificateWithInvalidKey_RSA_2048()Verifies the signature of a certificate using an unrelated public key.voidverifyCertificateWithValidKey_EC_P192()Verifies the signature of a certificate using the public part of the key that was used to sign it.voidverifyCertificateWithValidKey_EC_P224()Verifies the signature of a certificate using the public part of the key that was used to sign it.voidverifyCertificateWithValidKey_EC_P256()Verifies the signature of a certificate using the public part of the key that was used to sign it.voidverifyCertificateWithValidKey_RSA_1024()Verifies the signature of a certificate using the public part of the key that was used to sign it.voidverifyCertificateWithValidKey_RSA_2048()Verifies the signature of a certificate using the public part of the key that was used to sign it.
-
-
-
Method Detail
-
beforeClass
public static void beforeClass()
-
testCertRSA1024
public void testCertRSA1024() throws java.security.cert.CertificateException, java.io.IOException- Throws:
java.io.IOExceptionjava.security.cert.CertificateException
-
testCertPem
public void testCertPem() throws java.security.cert.CertificateException, java.io.IOException- Throws:
java.io.IOExceptionjava.security.cert.CertificateException
-
testCertRSA2048
public void testCertRSA2048() throws java.security.cert.CertificateException, java.io.IOException- Throws:
java.io.IOExceptionjava.security.cert.CertificateException
-
testCertECC192
public void testCertECC192() throws java.security.cert.CertificateException, java.io.IOException- Throws:
java.io.IOExceptionjava.security.cert.CertificateException
-
testCertECC224
public void testCertECC224() throws java.security.cert.CertificateException, java.io.IOException- Throws:
java.io.IOExceptionjava.security.cert.CertificateException
-
testCertECC256
public void testCertECC256() throws java.security.cert.CertificateException, java.io.IOException- Throws:
java.io.IOExceptionjava.security.cert.CertificateException
-
checkValidityDoesNotThrowExceptionForValidCertificate
public void checkValidityDoesNotThrowExceptionForValidCertificate() throws java.security.cert.CertificateException, java.io.IOExceptionUses 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 errorjava.io.IOException- for any file related error
-
checkValidityThrowsExceptionForCertificateNotYetValid
public void checkValidityThrowsExceptionForCertificateNotYetValid() throws java.security.cert.CertificateException, java.io.IOExceptionUses 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 errorjava.io.IOException- for any file related error
-
checkValidityThrowsExceptionForExpiredCertificate
public void checkValidityThrowsExceptionForExpiredCertificate() throws java.security.cert.CertificateException, java.io.IOExceptionUses 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 errorjava.io.IOException- for any file related error
-
verifyCertificateWithValidKey_EC_P256
public void verifyCertificateWithValidKey_EC_P256() throws java.lang.ExceptionVerifies 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.ExceptionVerifies 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.ExceptionVerifies 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.ExceptionVerifies 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.ExceptionVerifies 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.ExceptionVerifies 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.ExceptionVerifies 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.ExceptionVerifies 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.ExceptionVerifies 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.ExceptionVerifies 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
-
-