crossingtud / cognicrypt_testgen Goto Github PK
View Code? Open in Web Editor NEWA Test Generator for Java Crypto APIs
A Test Generator for Java Crypto APIs
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.security.AlgorithmParameters;
import java.security.DigestException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.KeyManagementException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.KeyStore;
import java.security.KeyStore.Entry;
import java.security.KeyStore.LoadStoreParameter;
import java.security.KeyStore.ProtectionParameter;
import java.security.KeyStoreException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.Provider;
import java.security.SecureRandom;
import java.security.UnrecoverableEntryException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertSelector;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.PKIXBuilderParameters;
import java.security.spec.DSAParameterSpec;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.InvalidParameterSpecException;
import java.util.Set;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.Mac;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.ShortBufferException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.net.ssl.CertPathTrustManagerParameters;
import javax.net.ssl.KeyManager;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.ManagerFactoryParameters;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLParameters;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import org.junit.Test;
import crypto.analysis.CrySLRulesetSelector.Ruleset;
import test.UsagePatternTestingFramework;
import test.assertions.Assertions;
public class AllFailingCasesTest extends UsagePatternTestingFramework {
protected Ruleset getRuleSet() {
return Ruleset.JavaCryptographicArchitecture;
}
@Test
public void pKIXBuilderParametersValidTest2() throws InvalidAlgorithmParameterException {
Set trustAnchors = null;
CertSelector certSelector = null;
PKIXBuilderParameters pKIXBuilderParameters0 = new PKIXBuilderParameters(trustAnchors, certSelector);
Assertions.hasEnsuredPredicate(pKIXBuilderParameters0); // FAILS
Assertions.mustBeInAcceptingState(pKIXBuilderParameters0); // FAILS
}
@Test
public void trustManagerFactoryValidTest4()
throws NoSuchAlgorithmException, IOException, KeyStoreException, CertificateException {
InputStream fileinput = null;
String keyStoreAlgorithm = null;
char[] passwordIn = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(fileinput, passwordIn);
Assertions.hasEnsuredPredicate(keyStore0);
Assertions.mustBeInAcceptingState(keyStore0);
TrustManagerFactory trustManagerFactory0 = TrustManagerFactory.getInstance("PKIX");
trustManagerFactory0.init(keyStore0);
TrustManager[] trustManager = trustManagerFactory0.getTrustManagers();
Assertions.hasEnsuredPredicate(trustManagerFactory0); // FAILS
Assertions.mustBeInAcceptingState(trustManagerFactory0);
}
@Test
public void trustManagerFactoryValidTest5() throws NoSuchAlgorithmException, IOException, KeyStoreException,
CertificateException, NoSuchProviderException {
InputStream fileinput = null;
String keyStoreAlgorithm = null;
char[] passwordIn = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(fileinput, passwordIn);
Assertions.hasEnsuredPredicate(keyStore0);
Assertions.mustBeInAcceptingState(keyStore0);
TrustManagerFactory trustManagerFactory0 = TrustManagerFactory.getInstance("PKIX", (String) null);
trustManagerFactory0.init(keyStore0);
TrustManager[] trustManager = trustManagerFactory0.getTrustManagers();
Assertions.hasEnsuredPredicate(trustManagerFactory0); // FAILS
Assertions.mustBeInAcceptingState(trustManagerFactory0);
}
@Test
public void trustManagerFactoryValidTest6() throws NoSuchAlgorithmException, IOException, KeyStoreException,
CertificateException, InvalidAlgorithmParameterException {
InputStream fileinput = null;
String keyStoreAlgorithm = null;
char[] passwordIn = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(fileinput, passwordIn);
Assertions.hasEnsuredPredicate(keyStore0);
Assertions.mustBeInAcceptingState(keyStore0);
CertSelector certSelector = null;
PKIXBuilderParameters pKIXBuilderParameters0 = new PKIXBuilderParameters(keyStore0, certSelector);
Assertions.hasEnsuredPredicate(pKIXBuilderParameters0);
Assertions.mustBeInAcceptingState(pKIXBuilderParameters0);
CertPathTrustManagerParameters certPathTrustManagerParameters0 = new CertPathTrustManagerParameters(
pKIXBuilderParameters0);
Assertions.hasEnsuredPredicate(certPathTrustManagerParameters0);
Assertions.mustBeInAcceptingState(certPathTrustManagerParameters0);
TrustManagerFactory trustManagerFactory0 = TrustManagerFactory.getInstance("PKIX");
trustManagerFactory0.init(certPathTrustManagerParameters0);
TrustManager[] trustManager = trustManagerFactory0.getTrustManagers();
Assertions.hasEnsuredPredicate(trustManagerFactory0); // FAILS
Assertions.mustBeInAcceptingState(trustManagerFactory0);
}
@Test
public void secureRandomValidTest6() throws NoSuchAlgorithmException {
int num = 0;
SecureRandom secureRandom1 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom1.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom1);
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
secureRandom0.setSeed(genSeed);
Assertions.hasEnsuredPredicate(secureRandom0); // FAILS
Assertions.mustBeInAcceptingState(secureRandom0);
}
@Test
public void secureRandomValidTest7() throws NoSuchAlgorithmException, NoSuchProviderException {
int num = 0;
SecureRandom secureRandom1 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom1.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom1);
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG", (String) null);
secureRandom0.setSeed(genSeed);
Assertions.hasEnsuredPredicate(secureRandom0); // FAILS
Assertions.mustBeInAcceptingState(secureRandom0);
}
@Test
public void secureRandomValidTest8() throws NoSuchAlgorithmException {
int num = 0;
SecureRandom secureRandom1 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom1.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom1);
SecureRandom secureRandom0 = SecureRandom.getInstanceStrong();
secureRandom0.setSeed(genSeed);
Assertions.hasEnsuredPredicate(secureRandom0); // FAILS
Assertions.mustBeInAcceptingState(secureRandom0);
}
@Test
public void secureRandomValidTest9() throws NoSuchAlgorithmException {
int num = 0;
SecureRandom secureRandom1 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom1.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom1);
SecureRandom secureRandom0 = new SecureRandom();
secureRandom0.setSeed(genSeed);
Assertions.hasEnsuredPredicate(secureRandom0); // FAILS
Assertions.mustBeInAcceptingState(secureRandom0);
}
@Test
public void secureRandomValidTest10() throws NoSuchAlgorithmException {
int num = 0;
SecureRandom secureRandom1 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom1.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom1);
SecureRandom secureRandom0 = new SecureRandom(genSeed);
secureRandom0.setSeed(genSeed);
Assertions.hasEnsuredPredicate(secureRandom0); // FAILS
Assertions.mustBeInAcceptingState(secureRandom0);
}
@Test
public void secureRandomValidTest11() throws NoSuchAlgorithmException {
long lSeed = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
secureRandom0.setSeed(lSeed);
Assertions.hasEnsuredPredicate(secureRandom0); // FAILS
Assertions.mustBeInAcceptingState(secureRandom0);
}
@Test
public void sSLContextValidTest1() throws NoSuchAlgorithmException, KeyManagementException {
TrustManager[] tms = null;
KeyManager[] kms = null;
SSLContext sSLContext0 = SSLContext.getInstance("TLSv1.2");
sSLContext0.init(kms, tms, (SecureRandom) null);
Assertions.hasEnsuredPredicate(sSLContext0); // FAILS
Assertions.mustBeInAcceptingState(sSLContext0);
}
@Test
public void sSLContextValidTest2()
throws NoSuchAlgorithmException, KeyManagementException, NoSuchProviderException {
TrustManager[] tms = null;
KeyManager[] kms = null;
SSLContext sSLContext0 = SSLContext.getInstance("TLSv1.2", (String) null);
sSLContext0.init(kms, tms, (SecureRandom) null);
Assertions.hasEnsuredPredicate(sSLContext0); // FAILS
Assertions.mustBeInAcceptingState(sSLContext0);
}
@Test
public void sSLContextValidTest3() throws NoSuchAlgorithmException, KeyManagementException {
TrustManager[] tms = null;
KeyManager[] kms = null;
SSLContext sSLContext0 = SSLContext.getInstance("TLSv1.2");
sSLContext0.init(kms, tms, (SecureRandom) null);
SSLEngine sSLEngine = sSLContext0.createSSLEngine();
Assertions.hasEnsuredPredicate(sSLContext0); // FAILS
Assertions.mustBeInAcceptingState(sSLContext0);
}
@Test
public void sSLContextValidTest4()
throws NoSuchAlgorithmException, KeyManagementException, NoSuchProviderException {
TrustManager[] tms = null;
KeyManager[] kms = null;
SSLContext sSLContext0 = SSLContext.getInstance("TLSv1.2", (String) null);
sSLContext0.init(kms, tms, (SecureRandom) null);
SSLEngine sSLEngine = sSLContext0.createSSLEngine();
Assertions.hasEnsuredPredicate(sSLContext0); // FAILS
Assertions.mustBeInAcceptingState(sSLContext0);
}
@Test
public void sSLContextValidTest5() throws NoSuchAlgorithmException, KeyManagementException {
TrustManager[] tms = null;
KeyManager[] kms = null;
SSLContext sSLContext0 = SSLContext.getInstance("TLSv1.2");
sSLContext0.init(kms, tms, (SecureRandom) null);
SSLEngine sSLEngine = sSLContext0.createSSLEngine((String) null, 0);
Assertions.hasEnsuredPredicate(sSLContext0); // FAILS
Assertions.mustBeInAcceptingState(sSLContext0);
}
@Test
public void sSLParametersValidTest1() {
SSLParameters sSLParameters0 = new SSLParameters(new String[] { "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" },
new String[] { "TLSv1.2" });
Assertions.hasEnsuredPredicate(sSLParameters0); // FAILS
Assertions.mustBeInAcceptingState(sSLParameters0); // FAILS
}
@Test
public void sSLParametersValidTest2() {
SSLParameters sSLParameters0 = new SSLParameters(new String[] { "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" });
sSLParameters0.setProtocols(new String[] { "TLSv1.2" });
Assertions.hasEnsuredPredicate(sSLParameters0); // FAILS
Assertions.mustBeInAcceptingState(sSLParameters0); // FAILS
}
@Test
public void sSLParametersInvalidTest2() {
SSLParameters sSLParameters0 = new SSLParameters(new String[] { "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" });
Assertions.notHasEnsuredPredicate(sSLParameters0); // FAILS
Assertions.mustNotBeInAcceptingState(sSLParameters0); // FAILS
}
@Test
public void macInvalidTest9() throws IllegalStateException, BadPaddingException, NoSuchPaddingException,
IllegalBlockSizeException, NoSuchAlgorithmException, InvalidKeyException, ShortBufferException {
Certificate cert = null;
byte[] plainText = null;
byte[] pre_plaintext = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, cert);
byte[] pre_ciphertext = cipher0.update(pre_plaintext);
byte[] cipherText = cipher0.doFinal(plainText);
Assertions.hasEnsuredPredicate(cipherText);
Assertions.mustBeInAcceptingState(cipher0);
int outOffset = 0;
Mac mac0 = Mac.getInstance("HmacMD5");
mac0.doFinal(cipherText, outOffset);
Assertions.notHasEnsuredPredicate(cipherText); // FAILS
Assertions.mustNotBeInAcceptingState(mac0);
}
@Test
public void macValidTest10() throws IllegalStateException, NoSuchAlgorithmException, InvalidKeyException {
int offset = 0;
int len = 0;
byte[] pre_input = null;
Key key = null;
Mac mac0 = Mac.getInstance("HmacMD5");
mac0.init(key);
mac0.update(pre_input, offset, len);
byte[] output1 = mac0.doFinal();
Assertions.hasEnsuredPredicate(output1); // FAILS
Assertions.mustBeInAcceptingState(mac0);
}
@Test
public void macInvalidTest22() throws IllegalStateException, BadPaddingException, NoSuchPaddingException,
IllegalBlockSizeException, NoSuchAlgorithmException, InvalidKeyException, ShortBufferException {
Certificate cert = null;
byte[] plainText = null;
byte[] pre_plaintext = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, cert);
byte[] pre_ciphertext = cipher0.update(pre_plaintext);
byte[] cipherText = cipher0.doFinal(plainText);
Assertions.hasEnsuredPredicate(cipherText);
Assertions.mustBeInAcceptingState(cipher0);
int outOffset = 0;
byte inp = 0;
Mac mac0 = Mac.getInstance("HmacMD5");
mac0.update(inp);
mac0.doFinal(cipherText, outOffset);
Assertions.notHasEnsuredPredicate(cipherText); // FAILS
Assertions.mustNotBeInAcceptingState(mac0);
}
@Test
public void keyPairGeneratorValidTest4() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
BigInteger q = null;
DSAParameterSpec dSAParameterSpec0 = new DSAParameterSpec(BigInteger.valueOf(2), q, BigInteger.valueOf(1));
Assertions.hasEnsuredPredicate(dSAParameterSpec0);
Assertions.mustBeInAcceptingState(dSAParameterSpec0);
KeyPairGenerator keyPairGenerator0 = KeyPairGenerator.getInstance("RSA");
keyPairGenerator0.initialize(dSAParameterSpec0);
KeyPair keyPair = keyPairGenerator0.generateKeyPair();
Assertions.hasEnsuredPredicate(keyPair); // FAILS
Assertions.mustBeInAcceptingState(keyPairGenerator0);
}
@Test
public void keyPairGeneratorValidTest5() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
BigInteger q = null;
DSAParameterSpec dSAParameterSpec0 = new DSAParameterSpec(BigInteger.valueOf(2), q, BigInteger.valueOf(1));
Assertions.hasEnsuredPredicate(dSAParameterSpec0);
Assertions.mustBeInAcceptingState(dSAParameterSpec0);
KeyPairGenerator keyPairGenerator0 = KeyPairGenerator.getInstance("RSA");
keyPairGenerator0.initialize(dSAParameterSpec0, (SecureRandom) null);
KeyPair keyPair = keyPairGenerator0.generateKeyPair();
Assertions.hasEnsuredPredicate(keyPair); // FAILS
Assertions.mustBeInAcceptingState(keyPairGenerator0);
}
@Test
public void keyManagerFactoryValidTest4() throws NoSuchAlgorithmException, UnrecoverableKeyException, IOException,
KeyStoreException, CertificateException {
InputStream fileinput = null;
String keyStoreAlgorithm = null;
char[] passwordIn = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(fileinput, passwordIn);
Assertions.hasEnsuredPredicate(keyStore0);
Assertions.mustBeInAcceptingState(keyStore0);
char[] password = null;
KeyManagerFactory keyManagerFactory0 = KeyManagerFactory.getInstance("PKIX");
keyManagerFactory0.init(keyStore0, password);
KeyManager[] keyManager = keyManagerFactory0.getKeyManagers();
Assertions.notHasEnsuredPredicate(keyManager); // FAILS
Assertions.mustBeInAcceptingState(keyManagerFactory0);
}
@Test
public void keyManagerFactoryValidTest5() throws NoSuchAlgorithmException, UnrecoverableKeyException, IOException,
KeyStoreException, CertificateException, NoSuchProviderException {
InputStream fileinput = null;
String keyStoreAlgorithm = null;
char[] passwordIn = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(fileinput, passwordIn);
Assertions.hasEnsuredPredicate(keyStore0);
Assertions.mustBeInAcceptingState(keyStore0);
char[] password = null;
KeyManagerFactory keyManagerFactory0 = KeyManagerFactory.getInstance("PKIX", (String) null);
keyManagerFactory0.init(keyStore0, password);
KeyManager[] keyManager = keyManagerFactory0.getKeyManagers();
Assertions.notHasEnsuredPredicate(keyManager); // FAILS
Assertions.mustBeInAcceptingState(keyManagerFactory0);
}
@Test
public void keyManagerFactoryValidTest6() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
ManagerFactoryParameters params = null;
KeyManagerFactory keyManagerFactory0 = KeyManagerFactory.getInstance("PKIX");
keyManagerFactory0.init(params);
KeyManager[] keyManager = keyManagerFactory0.getKeyManagers();
Assertions.notHasEnsuredPredicate(keyManager); // FAILS
Assertions.mustBeInAcceptingState(keyManagerFactory0);
}
@Test
public void messageDigestInvalidTest3() throws NoSuchAlgorithmException {
byte pre_inbyte = 0;
MessageDigest messageDigest0 = MessageDigest.getInstance("SHA-256");
messageDigest0.update(pre_inbyte);
byte[] out = messageDigest0.digest();
Assertions.notHasEnsuredPredicate(out); // FAILS
Assertions.mustNotBeInAcceptingState(messageDigest0); // FAILS
}
@Test
public void messageDigestInvalidTest4() throws NoSuchAlgorithmException, NoSuchProviderException {
byte pre_inbyte = 0;
MessageDigest messageDigest0 = MessageDigest.getInstance("SHA-256", (Provider) null);
messageDigest0.update(pre_inbyte);
byte[] out = messageDigest0.digest();
Assertions.notHasEnsuredPredicate(out); // FAILS
Assertions.mustNotBeInAcceptingState(messageDigest0); // FAILS
}
@Test
public void messageDigestInvalidTest5() throws NoSuchAlgorithmException {
byte[] pre_inbytearr = null;
MessageDigest messageDigest0 = MessageDigest.getInstance("SHA-256");
messageDigest0.update(pre_inbytearr);
byte[] out = messageDigest0.digest();
Assertions.notHasEnsuredPredicate(out); // FAILS
Assertions.mustNotBeInAcceptingState(messageDigest0); // FAILS
}
@Test
public void messageDigestInvalidTest6() throws NoSuchAlgorithmException {
byte[] pre_inbytearr = null;
int pre_off = 0;
int pre_len = 0;
MessageDigest messageDigest0 = MessageDigest.getInstance("SHA-256");
messageDigest0.update(pre_inbytearr, pre_off, pre_len);
byte[] out = messageDigest0.digest();
Assertions.notHasEnsuredPredicate(out); // FAILS
Assertions.mustNotBeInAcceptingState(messageDigest0); // FAILS
}
@Test
public void messageDigestInvalidTest7() throws NoSuchAlgorithmException {
ByteBuffer pre_inpBuf = null;
MessageDigest messageDigest0 = MessageDigest.getInstance("SHA-256");
messageDigest0.update(pre_inpBuf);
byte[] out = messageDigest0.digest();
Assertions.notHasEnsuredPredicate(out); // FAILS
Assertions.mustNotBeInAcceptingState(messageDigest0); // FAILS
}
@Test
public void messageDigestInvalidTest8() throws NoSuchAlgorithmException, DigestException {
int off = 0;
byte pre_inbyte = 0;
int len = 0;
byte[] out = null;
MessageDigest messageDigest0 = MessageDigest.getInstance("SHA-256");
messageDigest0.update(pre_inbyte);
messageDigest0.digest(out, off, len);
Assertions.notHasEnsuredPredicate(out); // FAILS
Assertions.mustNotBeInAcceptingState(messageDigest0); // FAILS
}
@Test
public void messageDigestInvalidTest9() throws NoSuchAlgorithmException {
byte pre_inbyte = 0;
byte[] inbytearr = null;
MessageDigest messageDigest0 = MessageDigest.getInstance("SHA-256");
messageDigest0.update(pre_inbyte);
byte[] out = messageDigest0.digest(inbytearr);
Assertions.notHasEnsuredPredicate(out); // FAILS
Assertions.mustNotBeInAcceptingState(messageDigest0); // FAILS
}
@Test
public void messageDigestInvalidTest10() throws NoSuchAlgorithmException {
byte[] inbytearr = null;
MessageDigest messageDigest0 = MessageDigest.getInstance("SHA-256");
byte[] out = messageDigest0.digest(inbytearr);
out = messageDigest0.digest();
Assertions.hasEnsuredPredicate(out); // FAILS
Assertions.mustNotBeInAcceptingState(messageDigest0);
}
@Test
public void messageDigestInvalidTest11() throws NoSuchAlgorithmException, NoSuchProviderException {
byte[] inbytearr = null;
MessageDigest messageDigest0 = MessageDigest.getInstance("SHA-256", (Provider) null);
byte[] out = messageDigest0.digest(inbytearr);
out = messageDigest0.digest();
Assertions.hasEnsuredPredicate(out); // FAILS
Assertions.mustNotBeInAcceptingState(messageDigest0);
}
@Test
public void messageDigestInvalidTest12() throws NoSuchAlgorithmException, DigestException {
int off = 0;
byte[] inbytearr = null;
int len = 0;
byte[] out = null;
MessageDigest messageDigest0 = MessageDigest.getInstance("SHA-256");
out = messageDigest0.digest(inbytearr);
messageDigest0.digest(out, off, len);
Assertions.hasEnsuredPredicate(out); // FAILS
Assertions.mustNotBeInAcceptingState(messageDigest0);
}
@Test
public void messageDigestInvalidTest13() throws NoSuchAlgorithmException {
byte[] inbytearr = null;
MessageDigest messageDigest0 = MessageDigest.getInstance("SHA-256");
byte[] out = messageDigest0.digest(inbytearr);
out = messageDigest0.digest(inbytearr);
Assertions.hasEnsuredPredicate(out); // FAILS
Assertions.mustNotBeInAcceptingState(messageDigest0);
}
@Test
public void messageDigestValidTest6() throws NoSuchAlgorithmException {
byte[] pre_inbytearr = null;
int pre_off = 0;
byte[] inbytearr = null;
int pre_len = 0;
MessageDigest messageDigest0 = MessageDigest.getInstance("SHA-256");
byte[] out = messageDigest0.digest(inbytearr);
messageDigest0.update(pre_inbytearr, pre_off, pre_len);
out = messageDigest0.digest();
Assertions.hasEnsuredPredicate(out); // FAILS
Assertions.mustBeInAcceptingState(messageDigest0);
}
@Test
public void messageDigestValidTest8() throws NoSuchAlgorithmException, DigestException {
int off = 0;
byte[] inbytearr = null;
byte pre_inbyte = 0;
int len = 0;
byte[] out = null;
MessageDigest messageDigest0 = MessageDigest.getInstance("SHA-256");
out = messageDigest0.digest(inbytearr);
messageDigest0.update(pre_inbyte);
messageDigest0.digest(out, off, len);
Assertions.hasEnsuredPredicate(out); // FAILS
Assertions.mustBeInAcceptingState(messageDigest0);
}
@Test
public void cipherInvalidTest23()
throws NoSuchPaddingException, InvalidKeySpecException, NoSuchAlgorithmException, InvalidKeyException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 29198, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
byte[] pre_plaintext = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey);
byte[] pre_ciphertext = cipher0.update(pre_plaintext);
Assertions.hasEnsuredPredicate(pre_ciphertext); // FAILS
Assertions.mustNotBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherInvalidTest24()
throws NoSuchPaddingException, InvalidKeySpecException, NoSuchAlgorithmException, InvalidKeyException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 12457, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
byte[] pre_plaintext = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey, secureRandom0);
byte[] pre_ciphertext = cipher0.update(pre_plaintext);
Assertions.hasEnsuredPredicate(pre_ciphertext); // FAILS
Assertions.mustNotBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherInvalidTest25() throws NoSuchPaddingException, InvalidKeySpecException, NoSuchAlgorithmException,
InvalidKeyException, InvalidAlgorithmParameterException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 25312, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
IvParameterSpec ivParameterSpec0 = new IvParameterSpec(genSeed);
Assertions.hasEnsuredPredicate(ivParameterSpec0);
Assertions.mustBeInAcceptingState(ivParameterSpec0);
byte[] pre_plaintext = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey, ivParameterSpec0);
byte[] pre_ciphertext = cipher0.update(pre_plaintext);
Assertions.hasEnsuredPredicate(pre_ciphertext); // FAILS
Assertions.mustNotBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherInvalidTest26() throws NoSuchPaddingException, InvalidKeySpecException, NoSuchAlgorithmException,
InvalidParameterSpecException, InvalidKeyException, InvalidAlgorithmParameterException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 25146, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
IvParameterSpec ivParameterSpec0 = new IvParameterSpec(genSeed);
Assertions.hasEnsuredPredicate(ivParameterSpec0);
Assertions.mustBeInAcceptingState(ivParameterSpec0);
AlgorithmParameters algorithmParameters0 = AlgorithmParameters.getInstance("AES");
algorithmParameters0.init(ivParameterSpec0);
Assertions.hasEnsuredPredicate(algorithmParameters0);
Assertions.mustBeInAcceptingState(algorithmParameters0);
byte[] pre_plaintext = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey, algorithmParameters0);
byte[] pre_ciphertext = cipher0.update(pre_plaintext);
Assertions.hasEnsuredPredicate(pre_ciphertext); // FAILS
Assertions.mustNotBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherInvalidTest27() throws NoSuchPaddingException, InvalidKeySpecException, NoSuchAlgorithmException,
InvalidKeyException, InvalidAlgorithmParameterException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 12045, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
IvParameterSpec ivParameterSpec0 = new IvParameterSpec(genSeed);
Assertions.hasEnsuredPredicate(ivParameterSpec0);
Assertions.mustBeInAcceptingState(ivParameterSpec0);
byte[] pre_plaintext = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey, ivParameterSpec0, secureRandom0);
byte[] pre_ciphertext = cipher0.update(pre_plaintext);
Assertions.hasEnsuredPredicate(pre_ciphertext); // FAILS
Assertions.mustNotBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherInvalidTest28() throws NoSuchPaddingException, InvalidKeySpecException, NoSuchAlgorithmException,
InvalidParameterSpecException, InvalidKeyException, InvalidAlgorithmParameterException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 25314, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
IvParameterSpec ivParameterSpec0 = new IvParameterSpec(genSeed);
Assertions.hasEnsuredPredicate(ivParameterSpec0);
Assertions.mustBeInAcceptingState(ivParameterSpec0);
AlgorithmParameters algorithmParameters0 = AlgorithmParameters.getInstance("AES");
algorithmParameters0.init(ivParameterSpec0);
Assertions.hasEnsuredPredicate(algorithmParameters0);
Assertions.mustBeInAcceptingState(algorithmParameters0);
byte[] pre_plaintext = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey, algorithmParameters0, secureRandom0);
byte[] pre_ciphertext = cipher0.update(pre_plaintext);
Assertions.hasEnsuredPredicate(pre_ciphertext); // FAILS
Assertions.mustNotBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherValidTest13() throws BadPaddingException, NoSuchPaddingException, InvalidKeySpecException,
IllegalBlockSizeException, NoSuchAlgorithmException, InvalidKeyException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 15583, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
byte[] plainText = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey);
byte[] cipherText = cipher0.doFinal(plainText);
Assertions.hasEnsuredPredicate(cipherText); // FAILS
Assertions.mustBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherValidTest14() throws BadPaddingException, NoSuchPaddingException, InvalidKeySpecException,
IllegalBlockSizeException, NoSuchAlgorithmException, InvalidKeyException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 28745, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
byte[] plainText = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey, secureRandom0);
byte[] cipherText = cipher0.doFinal(plainText);
Assertions.hasEnsuredPredicate(cipherText); // FAILS
Assertions.mustBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherValidTest15()
throws BadPaddingException, NoSuchPaddingException, InvalidKeySpecException, IllegalBlockSizeException,
NoSuchAlgorithmException, InvalidKeyException, InvalidAlgorithmParameterException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 22583, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
IvParameterSpec ivParameterSpec0 = new IvParameterSpec(genSeed);
Assertions.hasEnsuredPredicate(ivParameterSpec0);
Assertions.mustBeInAcceptingState(ivParameterSpec0);
byte[] plainText = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey, ivParameterSpec0);
byte[] cipherText = cipher0.doFinal(plainText);
Assertions.hasEnsuredPredicate(cipherText); // FAILS
Assertions.mustBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherValidTest16() throws BadPaddingException, NoSuchPaddingException, InvalidKeySpecException,
IllegalBlockSizeException, NoSuchAlgorithmException, InvalidParameterSpecException, InvalidKeyException,
InvalidAlgorithmParameterException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 27010, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
IvParameterSpec ivParameterSpec0 = new IvParameterSpec(genSeed);
Assertions.hasEnsuredPredicate(ivParameterSpec0);
Assertions.mustBeInAcceptingState(ivParameterSpec0);
AlgorithmParameters algorithmParameters0 = AlgorithmParameters.getInstance("AES");
algorithmParameters0.init(ivParameterSpec0);
Assertions.hasEnsuredPredicate(algorithmParameters0);
Assertions.mustBeInAcceptingState(algorithmParameters0);
byte[] plainText = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey, algorithmParameters0);
byte[] cipherText = cipher0.doFinal(plainText);
Assertions.hasEnsuredPredicate(cipherText); // FAILS
Assertions.mustBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherValidTest17()
throws BadPaddingException, NoSuchPaddingException, InvalidKeySpecException, IllegalBlockSizeException,
NoSuchAlgorithmException, InvalidKeyException, InvalidAlgorithmParameterException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 25855, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
IvParameterSpec ivParameterSpec0 = new IvParameterSpec(genSeed);
Assertions.hasEnsuredPredicate(ivParameterSpec0);
Assertions.mustBeInAcceptingState(ivParameterSpec0);
byte[] plainText = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey, ivParameterSpec0, secureRandom0);
byte[] cipherText = cipher0.doFinal(plainText);
Assertions.hasEnsuredPredicate(cipherText); // FAILS
Assertions.mustBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherValidTest18() throws BadPaddingException, NoSuchPaddingException, InvalidKeySpecException,
IllegalBlockSizeException, NoSuchAlgorithmException, InvalidParameterSpecException, InvalidKeyException,
InvalidAlgorithmParameterException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 23220, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
IvParameterSpec ivParameterSpec0 = new IvParameterSpec(genSeed);
Assertions.hasEnsuredPredicate(ivParameterSpec0);
Assertions.mustBeInAcceptingState(ivParameterSpec0);
AlgorithmParameters algorithmParameters0 = AlgorithmParameters.getInstance("AES");
algorithmParameters0.init(ivParameterSpec0);
Assertions.hasEnsuredPredicate(algorithmParameters0);
Assertions.mustBeInAcceptingState(algorithmParameters0);
byte[] plainText = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey, algorithmParameters0, secureRandom0);
byte[] cipherText = cipher0.doFinal(plainText);
Assertions.hasEnsuredPredicate(cipherText); // FAILS
Assertions.mustBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherValidTest26() throws BadPaddingException, NoSuchPaddingException, InvalidKeySpecException,
IllegalBlockSizeException, NoSuchAlgorithmException, InvalidKeyException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 19117, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
byte[] plainText = null;
byte[] pre_plaintext = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey);
byte[] pre_ciphertext = cipher0.update(pre_plaintext);
byte[] cipherText = cipher0.doFinal(plainText);
Assertions.hasEnsuredPredicate(cipherText); // FAILS
Assertions.mustBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherValidTest27() throws BadPaddingException, NoSuchPaddingException, InvalidKeySpecException,
IllegalBlockSizeException, NoSuchAlgorithmException, InvalidKeyException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 14953, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
byte[] plainText = null;
byte[] pre_plaintext = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey, secureRandom0);
byte[] pre_ciphertext = cipher0.update(pre_plaintext);
byte[] cipherText = cipher0.doFinal(plainText);
Assertions.hasEnsuredPredicate(cipherText); // FAILS
Assertions.mustBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherValidTest28()
throws BadPaddingException, NoSuchPaddingException, InvalidKeySpecException, IllegalBlockSizeException,
NoSuchAlgorithmException, InvalidKeyException, InvalidAlgorithmParameterException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 26455, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
IvParameterSpec ivParameterSpec0 = new IvParameterSpec(genSeed);
Assertions.hasEnsuredPredicate(ivParameterSpec0);
Assertions.mustBeInAcceptingState(ivParameterSpec0);
byte[] plainText = null;
byte[] pre_plaintext = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey, ivParameterSpec0);
byte[] pre_ciphertext = cipher0.update(pre_plaintext);
byte[] cipherText = cipher0.doFinal(plainText);
Assertions.hasEnsuredPredicate(cipherText); // FAILS
Assertions.mustBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherValidTest29() throws BadPaddingException, NoSuchPaddingException, InvalidKeySpecException,
IllegalBlockSizeException, NoSuchAlgorithmException, InvalidParameterSpecException, InvalidKeyException,
InvalidAlgorithmParameterException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 11221, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
IvParameterSpec ivParameterSpec0 = new IvParameterSpec(genSeed);
Assertions.hasEnsuredPredicate(ivParameterSpec0);
Assertions.mustBeInAcceptingState(ivParameterSpec0);
AlgorithmParameters algorithmParameters0 = AlgorithmParameters.getInstance("AES");
algorithmParameters0.init(ivParameterSpec0);
Assertions.hasEnsuredPredicate(algorithmParameters0);
Assertions.mustBeInAcceptingState(algorithmParameters0);
byte[] plainText = null;
byte[] pre_plaintext = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey, algorithmParameters0);
byte[] pre_ciphertext = cipher0.update(pre_plaintext);
byte[] cipherText = cipher0.doFinal(plainText);
Assertions.hasEnsuredPredicate(cipherText); // FAILS
Assertions.mustBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherValidTest30()
throws BadPaddingException, NoSuchPaddingException, InvalidKeySpecException, IllegalBlockSizeException,
NoSuchAlgorithmException, InvalidKeyException, InvalidAlgorithmParameterException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 21043, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
IvParameterSpec ivParameterSpec0 = new IvParameterSpec(genSeed);
Assertions.hasEnsuredPredicate(ivParameterSpec0);
Assertions.mustBeInAcceptingState(ivParameterSpec0);
byte[] plainText = null;
byte[] pre_plaintext = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey, ivParameterSpec0, secureRandom0);
byte[] pre_ciphertext = cipher0.update(pre_plaintext);
byte[] cipherText = cipher0.doFinal(plainText);
Assertions.hasEnsuredPredicate(cipherText); // FAILS
Assertions.mustBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void cipherValidTest31() throws BadPaddingException, NoSuchPaddingException, InvalidKeySpecException,
IllegalBlockSizeException, NoSuchAlgorithmException, InvalidParameterSpecException, InvalidKeyException,
InvalidAlgorithmParameterException {
int num = 0;
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom0);
int keylength = 0;
char[] password = null;
PBEKeySpec pBEKeySpec0 = new PBEKeySpec(password, genSeed, 25456, keylength);
Assertions.hasEnsuredPredicate(pBEKeySpec0);
SecretKeyFactory secretKeyFactory0 = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
SecretKey secretKey = secretKeyFactory0.generateSecret(pBEKeySpec0);
Assertions.hasEnsuredPredicate(secretKey);
Assertions.mustBeInAcceptingState(secretKeyFactory0);
IvParameterSpec ivParameterSpec0 = new IvParameterSpec(genSeed);
Assertions.hasEnsuredPredicate(ivParameterSpec0);
Assertions.mustBeInAcceptingState(ivParameterSpec0);
AlgorithmParameters algorithmParameters0 = AlgorithmParameters.getInstance("AES");
algorithmParameters0.init(ivParameterSpec0);
Assertions.hasEnsuredPredicate(algorithmParameters0);
Assertions.mustBeInAcceptingState(algorithmParameters0);
byte[] plainText = null;
byte[] pre_plaintext = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, secretKey, algorithmParameters0, secureRandom0);
byte[] pre_ciphertext = cipher0.update(pre_plaintext);
byte[] cipherText = cipher0.doFinal(plainText);
Assertions.hasEnsuredPredicate(cipherText); // FAILS
Assertions.mustBeInAcceptingState(cipher0);
pBEKeySpec0.clearPassword();
Assertions.mustBeInAcceptingState(pBEKeySpec0);
}
@Test
public void keyStoreInvalidTest10() throws NoSuchAlgorithmException, UnrecoverableKeyException, IOException,
KeyStoreException, CertificateException {
char[] passwordKey = null;
String alias = null;
Entry entry = null;
InputStream fileinput = null;
String keyStoreAlgorithm = null;
String aliasSet = null;
ProtectionParameter protParamSet = null;
char[] passwordIn = null;
LoadStoreParameter paramStore = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(fileinput, passwordIn);
Key key = keyStore0.getKey(alias, passwordKey);
keyStore0.setEntry(aliasSet, entry, protParamSet);
keyStore0.store(paramStore);
Assertions.hasEnsuredPredicate(key); // FAILS
Assertions.mustNotBeInAcceptingState(keyStore0);
}
@Test
public void keyStoreInvalidTest11() throws NoSuchAlgorithmException, UnrecoverableKeyException, IOException,
KeyStoreException, CertificateException, NoSuchProviderException {
char[] passwordKey = null;
String alias = null;
Entry entry = null;
InputStream fileinput = null;
String keyStoreAlgorithm = null;
String aliasSet = null;
ProtectionParameter protParamSet = null;
char[] passwordIn = null;
LoadStoreParameter paramStore = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm, (Provider) null);
keyStore0.load(fileinput, passwordIn);
Key key = keyStore0.getKey(alias, passwordKey);
keyStore0.setEntry(aliasSet, entry, protParamSet);
keyStore0.store(paramStore);
Assertions.hasEnsuredPredicate(key); // FAILS
Assertions.mustNotBeInAcceptingState(keyStore0);
}
@Test
public void keyStoreInvalidTest12() throws NoSuchAlgorithmException, UnrecoverableKeyException, IOException,
KeyStoreException, CertificateException {
char[] passwordKey = null;
String alias = null;
Entry entry = null;
LoadStoreParameter paramLoad = null;
String keyStoreAlgorithm = null;
String aliasSet = null;
ProtectionParameter protParamSet = null;
LoadStoreParameter paramStore = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(paramLoad);
Key key = keyStore0.getKey(alias, passwordKey);
keyStore0.setEntry(aliasSet, entry, protParamSet);
keyStore0.store(paramStore);
Assertions.hasEnsuredPredicate(key); // FAILS
Assertions.mustNotBeInAcceptingState(keyStore0);
}
@Test
public void keyStoreInvalidTest13() throws NoSuchAlgorithmException, UnrecoverableKeyException, IOException,
KeyStoreException, CertificateException {
char[] passwordKey = null;
String alias = null;
Entry entry = null;
InputStream fileinput = null;
String keyStoreAlgorithm = null;
String aliasSet = null;
ProtectionParameter protParamSet = null;
OutputStream fileoutput = null;
char[] passwordOut = null;
char[] passwordIn = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(fileinput, passwordIn);
Key key = keyStore0.getKey(alias, passwordKey);
keyStore0.setEntry(aliasSet, entry, protParamSet);
keyStore0.store(fileoutput, passwordOut);
Assertions.hasEnsuredPredicate(key); // FAILS
Assertions.mustNotBeInAcceptingState(keyStore0);
}
@Test
public void keyStoreInvalidTest14() throws NoSuchAlgorithmException, IOException, KeyStoreException,
CertificateException, UnrecoverableEntryException {
String aliasGet = null;
Entry entry = null;
InputStream fileinput = null;
String keyStoreAlgorithm = null;
String aliasSet = null;
ProtectionParameter protParamSet = null;
char[] passwordIn = null;
LoadStoreParameter paramStore = null;
ProtectionParameter protParamGet = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(fileinput, passwordIn);
keyStore0.getEntry(aliasGet, protParamGet);
keyStore0.setEntry(aliasSet, entry, protParamSet);
keyStore0.store(paramStore);
Assertions.hasEnsuredPredicate(keyStore0); // FAILS
Assertions.mustNotBeInAcceptingState(keyStore0);
}
@Test
public void keyStoreInvalidTest15() throws NoSuchAlgorithmException, IOException, KeyStoreException,
CertificateException, NoSuchProviderException, UnrecoverableEntryException {
String aliasGet = null;
Entry entry = null;
InputStream fileinput = null;
String keyStoreAlgorithm = null;
String aliasSet = null;
ProtectionParameter protParamSet = null;
char[] passwordIn = null;
LoadStoreParameter paramStore = null;
ProtectionParameter protParamGet = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm, (Provider) null);
keyStore0.load(fileinput, passwordIn);
keyStore0.getEntry(aliasGet, protParamGet);
keyStore0.setEntry(aliasSet, entry, protParamSet);
keyStore0.store(paramStore);
Assertions.hasEnsuredPredicate(keyStore0);
Assertions.mustNotBeInAcceptingState(keyStore0);
}
@Test
public void keyStoreInvalidTest16() throws NoSuchAlgorithmException, IOException, KeyStoreException,
CertificateException, UnrecoverableEntryException {
String aliasGet = null;
Entry entry = null;
LoadStoreParameter paramLoad = null;
String keyStoreAlgorithm = null;
String aliasSet = null;
ProtectionParameter protParamSet = null;
LoadStoreParameter paramStore = null;
ProtectionParameter protParamGet = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(paramLoad);
keyStore0.getEntry(aliasGet, protParamGet);
keyStore0.setEntry(aliasSet, entry, protParamSet);
keyStore0.store(paramStore);
Assertions.hasEnsuredPredicate(keyStore0);
Assertions.mustNotBeInAcceptingState(keyStore0);
}
@Test
public void keyStoreInvalidTest17() throws NoSuchAlgorithmException, IOException, KeyStoreException,
CertificateException, UnrecoverableEntryException {
String aliasGet = null;
Entry entry = null;
InputStream fileinput = null;
String keyStoreAlgorithm = null;
String aliasSet = null;
ProtectionParameter protParamSet = null;
OutputStream fileoutput = null;
char[] passwordOut = null;
char[] passwordIn = null;
ProtectionParameter protParamGet = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(fileinput, passwordIn);
keyStore0.getEntry(aliasGet, protParamGet);
keyStore0.setEntry(aliasSet, entry, protParamSet);
keyStore0.store(fileoutput, passwordOut);
Assertions.hasEnsuredPredicate(keyStore0);
Assertions.mustNotBeInAcceptingState(keyStore0);
}
@Test
public void keyStoreInvalidTest7() throws NoSuchAlgorithmException, UnrecoverableKeyException, IOException,
KeyStoreException, CertificateException, UnrecoverableEntryException {
char[] passwordKey = null;
String aliasGet = null;
String alias = null;
Entry entry = null;
String keyStoreAlgorithm = null;
String aliasSet = null;
ProtectionParameter protParamSet = null;
LoadStoreParameter paramStore = null;
ProtectionParameter protParamGet = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.getEntry(aliasGet, protParamGet);
Key key = keyStore0.getKey(alias, passwordKey);
keyStore0.setEntry(aliasSet, entry, protParamSet);
keyStore0.store(paramStore);
Assertions.notHasEnsuredPredicate(key);
Assertions.mustNotBeInAcceptingState(keyStore0); // FAILS
}
@Test
public void keyStoreInvalidTest8() throws NoSuchAlgorithmException, UnrecoverableKeyException, IOException,
KeyStoreException, CertificateException, NoSuchProviderException, UnrecoverableEntryException {
char[] passwordKey = null;
String aliasGet = null;
String alias = null;
Entry entry = null;
String keyStoreAlgorithm = null;
String aliasSet = null;
ProtectionParameter protParamSet = null;
LoadStoreParameter paramStore = null;
ProtectionParameter protParamGet = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm, (Provider) null);
keyStore0.getEntry(aliasGet, protParamGet);
Key key = keyStore0.getKey(alias, passwordKey);
keyStore0.setEntry(aliasSet, entry, protParamSet);
keyStore0.store(paramStore);
Assertions.notHasEnsuredPredicate(key);
Assertions.mustNotBeInAcceptingState(keyStore0); // FAILS
}
@Test
public void keyStoreInvalidTest9() throws NoSuchAlgorithmException, UnrecoverableKeyException, IOException,
KeyStoreException, CertificateException, UnrecoverableEntryException {
char[] passwordKey = null;
String aliasGet = null;
String alias = null;
Entry entry = null;
String keyStoreAlgorithm = null;
String aliasSet = null;
ProtectionParameter protParamSet = null;
OutputStream fileoutput = null;
char[] passwordOut = null;
ProtectionParameter protParamGet = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.getEntry(aliasGet, protParamGet);
Key key = keyStore0.getKey(alias, passwordKey);
keyStore0.setEntry(aliasSet, entry, protParamSet);
keyStore0.store(fileoutput, passwordOut);
Assertions.notHasEnsuredPredicate(key);
Assertions.mustNotBeInAcceptingState(keyStore0); // FAILS
}
}
void
classnameEmptyStackException
StackOverFlow
TrustManager[] tms = null; // must ensure generatedTrustManager
KeyManager[] kms = null; // must ensure generatedKeyManager
SSLContext sSLContext0 = SSLContext.getInstance("TLSv1.2");
sSLContext0.init(kms, tms, (SecureRandom) null);
Assertions.hasEnsuredPredicate(sSLContext0);
Assertions.mustBeInAcceptingState(sSLContext0);
Following test cases are failing for above reason
void
classname@Test
public void keyPairGeneratorValidTest4() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
BigInteger q = null;
DSAParameterSpec dSAParameterSpec0 = new DSAParameterSpec(BigInteger.valueOf(2), q, BigInteger.valueOf(1));
Assertions.hasEnsuredPredicate(dSAParameterSpec0);
Assertions.mustBeInAcceptingState(dSAParameterSpec0);
KeyPairGenerator keyPairGenerator0 = KeyPairGenerator.getInstance("RSA");
keyPairGenerator0.initialize(dSAParameterSpec0); // RSAKeyGenParameterSpec must be generated
KeyPair keyPair = keyPairGenerator0.generateKeyPair();
Assertions.hasEnsuredPredicate(keyPair);
Assertions.mustBeInAcceptingState(keyPairGenerator0);
}
@Test
public void keyPairGeneratorValidTest5() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
BigInteger q = null;
DSAParameterSpec dSAParameterSpec0 = new DSAParameterSpec(BigInteger.valueOf(2), q, BigInteger.valueOf(1));
Assertions.hasEnsuredPredicate(dSAParameterSpec0);
Assertions.mustBeInAcceptingState(dSAParameterSpec0);
KeyPairGenerator keyPairGenerator0 = KeyPairGenerator.getInstance("RSA");
keyPairGenerator0.initialize(dSAParameterSpec0, (SecureRandom) null); // RSAKeyGenParameterSpec must be generated
KeyPair keyPair = keyPairGenerator0.generateKeyPair();
Assertions.hasEnsuredPredicate(keyPair);
Assertions.mustBeInAcceptingState(keyPairGenerator0);
}
@Test
public void keyManagerFactoryValidTest4() throws NoSuchAlgorithmException, UnrecoverableKeyException, IOException,
KeyStoreException, CertificateException {
InputStream fileinput = null;
String keyStoreAlgorithm = null;
char[] passwordIn = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(fileinput, passwordIn);
Assertions.hasEnsuredPredicate(keyStore0);
Assertions.mustBeInAcceptingState(keyStore0);
char[] password = null;
KeyManagerFactory keyManagerFactory0 = KeyManagerFactory.getInstance("PKIX");
keyManagerFactory0.init(keyStore0, password);
KeyManager[] keyManager = keyManagerFactory0.getKeyManagers();
Assertions.notHasEnsuredPredicate(keyManager); // hasEnsuredPredicate is correct
Assertions.mustBeInAcceptingState(keyManagerFactory0);
}
@Test
public void keyManagerFactoryValidTest5() throws NoSuchAlgorithmException, UnrecoverableKeyException, IOException,
KeyStoreException, CertificateException, NoSuchProviderException {
InputStream fileinput = null;
String keyStoreAlgorithm = null;
char[] passwordIn = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(fileinput, passwordIn);
Assertions.hasEnsuredPredicate(keyStore0);
Assertions.mustBeInAcceptingState(keyStore0);
char[] password = null;
KeyManagerFactory keyManagerFactory0 = KeyManagerFactory.getInstance("PKIX", (String) null);
keyManagerFactory0.init(keyStore0, password);
KeyManager[] keyManager = keyManagerFactory0.getKeyManagers();
Assertions.notHasEnsuredPredicate(keyManager); // hasEnsuredPredicate is correct
Assertions.mustBeInAcceptingState(keyManagerFactory0);
}
@Test
public void keyManagerFactoryValidTest6() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
ManagerFactoryParameters params = null;
KeyManagerFactory keyManagerFactory0 = KeyManagerFactory.getInstance("PKIX");
keyManagerFactory0.init(params);
KeyManager[] keyManager = keyManagerFactory0.getKeyManagers();
Assertions.notHasEnsuredPredicate(keyManager); // hasEnsuredPredicate is correct
Assertions.mustBeInAcceptingState(keyManagerFactory0);
}
Though the predicate encrypted[pre_ciphertext, pre_plaintext]
is ensured after update
method, the test generator selects a update(pre_plainBuffer, pre_cipherBuffer)
method that doesn't contain those parameters. This results in assertion with wrong parameter as shown below.
@Test
public void cipherInvalidTest32()
throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, ShortBufferException {
ByteBuffer pre_plainBuffer = null;
Certificate cert = null;
ByteBuffer pre_cipherBuffer = null;
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(1, cert);
cipher0.update(pre_plainBuffer, pre_cipherBuffer);
Assertions.hasEnsuredPredicate(pre_ciphertext); // incorrect parameter
Assertions.mustNotBeInAcceptingState(cipher0);
}
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom0.generateSeed(0);
Assertions.hasEnsuredPredicate(randInt); // genSeed should be asserted
Assertions.mustBeInAcceptingState(secureRandom0);
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.DigestInputStream;
import java.security.DigestOutputStream;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStore.Entry;
import java.security.KeyStore.LoadStoreParameter;
import java.security.KeyStore.ProtectionParameter;
import java.security.KeyStoreException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.UnrecoverableEntryException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import javax.crypto.Mac;
import javax.net.ssl.KeyManager;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLParameters;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import org.junit.Test;
import crypto.analysis.CrySLRulesetSelector.Ruleset;
import test.UsagePatternTestingFramework;
import test.assertions.Assertions;
public class AllFailingCasesTest extends UsagePatternTestingFramework {
protected Ruleset getRuleSet() {
return Ruleset.JavaCryptographicArchitecture;
}
@Test
public void secureRandomValidTest2() throws NoSuchAlgorithmException {
int num = 0;
SecureRandom secureRandom1 = SecureRandom.getInstance("SHA1PRNG");
byte[] genSeed = secureRandom1.generateSeed(num);
Assertions.hasEnsuredPredicate(genSeed);
Assertions.mustBeInAcceptingState(secureRandom1);
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG");
secureRandom0.setSeed(genSeed);
Assertions.hasEnsuredPredicate(secureRandom0);
Assertions.mustBeInAcceptingState(secureRandom0);
}
@Test
public void trustManagerFactoryValidTest2()
throws NoSuchAlgorithmException, IOException, KeyStoreException, CertificateException {
InputStream fileinput = null;
String keyStoreAlgorithm = null;
char[] passwordIn = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(fileinput, passwordIn);
Assertions.hasEnsuredPredicate(keyStore0);
Assertions.mustBeInAcceptingState(keyStore0);
TrustManagerFactory trustManagerFactory0 = TrustManagerFactory.getInstance("PKIX");
trustManagerFactory0.init(keyStore0);
TrustManager[] trustManager = trustManagerFactory0.getTrustManagers();
Assertions.hasEnsuredPredicate(trustManagerFactory0);
Assertions.mustBeInAcceptingState(trustManagerFactory0);
}
@Test
public void macValidTest1() throws IllegalStateException, NoSuchAlgorithmException, InvalidKeyException {
Key key = null;
Mac mac0 = Mac.getInstance("HmacMD5");
mac0.init(key);
byte[] output1 = mac0.doFinal();
Assertions.hasEnsuredPredicate(output1);
Assertions.mustBeInAcceptingState(mac0);
}
@Test
public void macValidTest2() throws IllegalStateException, NoSuchAlgorithmException, InvalidKeyException {
byte inp = 0;
Key key = null;
Mac mac0 = Mac.getInstance("HmacMD5");
mac0.init(key);
mac0.update(inp);
byte[] output1 = mac0.doFinal();
Assertions.hasEnsuredPredicate(output1);
Assertions.mustBeInAcceptingState(mac0);
}
@Test
public void sSLContextValidTest1() throws NoSuchAlgorithmException, KeyManagementException {
TrustManager[] tms = null;
KeyManager[] kms = null;
SSLContext sSLContext0 = SSLContext.getInstance("TLSv1.2");
sSLContext0.init(kms, tms, (SecureRandom) null);
Assertions.hasEnsuredPredicate(sSLContext0);
Assertions.mustBeInAcceptingState(sSLContext0);
}
@Test
public void sSLContextValidTest2() throws NoSuchAlgorithmException, KeyManagementException {
TrustManager[] tms = null;
KeyManager[] kms = null;
SSLContext sSLContext0 = SSLContext.getInstance("TLSv1.2");
sSLContext0.init(kms, tms, (SecureRandom) null);
SSLEngine sSLEngine = sSLContext0.createSSLEngine();
Assertions.hasEnsuredPredicate(sSLContext0);
Assertions.mustBeInAcceptingState(sSLContext0);
}
@Test
public void sSLParametersValidTest1() {
SSLParameters sSLParameters0 = new SSLParameters(new String[] { "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" },
new String[] { "TLSv1.2" });
Assertions.hasEnsuredPredicate(sSLParameters0);
Assertions.mustBeInAcceptingState(sSLParameters0);
}
@Test
public void sSLParametersValidTest2() {
SSLParameters sSLParameters0 = new SSLParameters(new String[] { "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" });
sSLParameters0.setProtocols(new String[] { "TLSv1.2" });
Assertions.hasEnsuredPredicate(sSLParameters0);
Assertions.mustBeInAcceptingState(sSLParameters0);
}
@Test
public void sSLParametersInvalidTest2() {
SSLParameters sSLParameters0 = new SSLParameters(new String[] { "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" });
Assertions.notHasEnsuredPredicate(sSLParameters0);
Assertions.mustNotBeInAcceptingState(sSLParameters0);
}
@Test
public void keyManagerFactoryValidTest2() throws NoSuchAlgorithmException, UnrecoverableKeyException, IOException,
KeyStoreException, CertificateException {
InputStream fileinput = null;
String keyStoreAlgorithm = null;
char[] passwordIn = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(fileinput, passwordIn);
Assertions.hasEnsuredPredicate(keyStore0);
Assertions.mustBeInAcceptingState(keyStore0);
char[] password = null;
KeyManagerFactory keyManagerFactory0 = KeyManagerFactory.getInstance("PKIX");
keyManagerFactory0.init(keyStore0, password);
KeyManager[] keyManager = keyManagerFactory0.getKeyManagers();
Assertions.notHasEnsuredPredicate(keyManager);
Assertions.mustBeInAcceptingState(keyManagerFactory0);
}
@Test
public void digestOutputStreamValidTest1() throws IOException {
MessageDigest md = null;
OutputStream os = null;
int b = 0;
DigestOutputStream digestOutputStream0 = new DigestOutputStream(os, md);
digestOutputStream0.write(b);
Assertions.hasEnsuredPredicate(os);
Assertions.mustBeInAcceptingState(digestOutputStream0);
}
@Test
public void keyStoreInvalidTest4() throws NoSuchAlgorithmException, UnrecoverableKeyException, IOException,
KeyStoreException, CertificateException, UnrecoverableEntryException {
char[] passwordKey = null;
String aliasGet = null;
String alias = null;
Entry entry = null;
String keyStoreAlgorithm = null;
String aliasSet = null;
ProtectionParameter protParamSet = null;
LoadStoreParameter paramStore = null;
ProtectionParameter protParamGet = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.getEntry(aliasGet, protParamGet);
Key key = keyStore0.getKey(alias, passwordKey);
keyStore0.setEntry(aliasSet, entry, protParamSet);
keyStore0.store(paramStore);
Assertions.notHasEnsuredPredicate(key);
Assertions.mustNotBeInAcceptingState(keyStore0);
}
@Test
public void keyStoreInvalidTest5() throws NoSuchAlgorithmException, UnrecoverableKeyException, IOException,
KeyStoreException, CertificateException {
char[] passwordKey = null;
String alias = null;
Entry entry = null;
InputStream fileinput = null;
String keyStoreAlgorithm = null;
String aliasSet = null;
ProtectionParameter protParamSet = null;
char[] passwordIn = null;
LoadStoreParameter paramStore = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(fileinput, passwordIn);
Key key = keyStore0.getKey(alias, passwordKey);
keyStore0.setEntry(aliasSet, entry, protParamSet);
keyStore0.store(paramStore);
Assertions.hasEnsuredPredicate(key);
Assertions.mustNotBeInAcceptingState(keyStore0);
}
@Test
public void keyStoreInvalidTest6() throws NoSuchAlgorithmException, IOException, KeyStoreException,
CertificateException, UnrecoverableEntryException {
String aliasGet = null;
Entry entry = null;
InputStream fileinput = null;
String keyStoreAlgorithm = null;
String aliasSet = null;
ProtectionParameter protParamSet = null;
char[] passwordIn = null;
LoadStoreParameter paramStore = null;
ProtectionParameter protParamGet = null;
KeyStore keyStore0 = KeyStore.getInstance(keyStoreAlgorithm);
keyStore0.load(fileinput, passwordIn);
keyStore0.getEntry(aliasGet, protParamGet);
keyStore0.setEntry(aliasSet, entry, protParamSet);
keyStore0.store(paramStore);
Assertions.hasEnsuredPredicate(keyStore0);
Assertions.mustNotBeInAcceptingState(keyStore0);
}
@Test
public void digestInputStreamValidTest1() throws IOException {
MessageDigest md = null;
InputStream is = null;
DigestInputStream digestInputStream0 = new DigestInputStream(is, md);
digestInputStream0.read();
Assertions.hasEnsuredPredicate(is);
Assertions.mustBeInAcceptingState(digestInputStream0);
}
@Test
public void messageDigestInvalidTest2() throws NoSuchAlgorithmException {
byte pre_inbyte = 0;
MessageDigest messageDigest0 = MessageDigest.getInstance("SHA-256");
messageDigest0.update(pre_inbyte);
byte[] out = messageDigest0.digest();
Assertions.notHasEnsuredPredicate(out);
Assertions.mustNotBeInAcceptingState(messageDigest0);
}
@Test
public void messageDigestInvalidTest3() throws NoSuchAlgorithmException {
byte[] inbytearr = null;
MessageDigest messageDigest0 = MessageDigest.getInstance("SHA-256");
byte[] out = messageDigest0.digest(inbytearr);
out = messageDigest0.digest();
Assertions.hasEnsuredPredicate(out);
Assertions.mustNotBeInAcceptingState(messageDigest0);
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.