当前位置: 首页>>代码示例>>Java>>正文


Java InvalidParameterSpecException类代码示例

本文整理汇总了Java中java.security.spec.InvalidParameterSpecException的典型用法代码示例。如果您正苦于以下问题:Java InvalidParameterSpecException类的具体用法?Java InvalidParameterSpecException怎么用?Java InvalidParameterSpecException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InvalidParameterSpecException类属于java.security.spec包,在下文中一共展示了InvalidParameterSpecException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import java.security.spec.InvalidParameterSpecException; //导入依赖的package包/类
public static void main(final String[] argv) throws IOException, InvalidKeySpecException, NoSuchPaddingException, 
        InvalidKeyException, InvalidParameterSpecException, IllegalBlockSizeException, BadPaddingException,
        InvalidAlgorithmParameterException, ClassNotFoundException, GeneralSecurityException {
    
    if(argv.length >= 2) {
        ip = argv[0];
        port = Integer.parseInt(argv[1]);
    } else {
        Logger.getLogger(Main.class.getName()).log(Level.INFO, "Default ip and port were applied.");
        ip = Parameters.RELAY_IP;
        port = Parameters.RELAY_PORT_WALLET_LISTENER;
    }
    
    // Init connection with relay
    try {
        RelayConnection.getInstance();
    } catch(IOException ex) {
        Logger.getLogger(Main.class.getName()).severe(ex.getMessage());
        return;
    }
    
    new ClientApplication();

}
 
开发者ID:StanIsAdmin,项目名称:CrashCoin,代码行数:25,代码来源:Main.java

示例2: engineInit

import java.security.spec.InvalidParameterSpecException; //导入依赖的package包/类
@Override
protected void engineInit(int opmode, Key key,
        AlgorithmParameters params, SecureRandom random)
    throws InvalidKeyException, InvalidAlgorithmParameterException {

    AlgorithmParameterSpec spec;

    try {

        spec = params.getParameterSpec(IvParameterSpec.class);

        if (debug.DEBUG)
            log("initialized with key and AlgorithmParameters");

    } catch (InvalidParameterSpecException ipe) {
        throw new InvalidAlgorithmParameterException(ipe);
    }

    wolfCryptCipherInit(opmode, key, spec, random);
}
 
开发者ID:wolfSSL,项目名称:wolfcrypt-jni,代码行数:21,代码来源:WolfCryptCipher.java

示例3: engineInit

import java.security.spec.InvalidParameterSpecException; //导入依赖的package包/类
protected void engineInit(AlgorithmParameterSpec paramSpec)
    throws InvalidParameterSpecException {

    if (!(paramSpec instanceof RC2ParameterSpec)) {
        throw new InvalidParameterSpecException
            ("Inappropriate parameter specification");
    }
    RC2ParameterSpec rps = (RC2ParameterSpec) paramSpec;

    // check effective key size (a value of 0 means it is unspecified)
    effectiveKeySize = rps.getEffectiveKeyBits();
    if (effectiveKeySize != 0) {
        if (effectiveKeySize < 1 || effectiveKeySize > 1024) {
            throw new InvalidParameterSpecException("RC2 effective key " +
                "size must be between 1 and 1024 bits");
        }
        if (effectiveKeySize < 256) {
            version = EKB_TABLE[effectiveKeySize];
        } else {
            version = effectiveKeySize;
        }
    }
    this.iv = rps.getIV();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:RC2Parameters.java

示例4: localEngineGetParameterSpec

import java.security.spec.InvalidParameterSpecException; //导入依赖的package包/类
protected AlgorithmParameterSpec localEngineGetParameterSpec(
    Class paramSpec)
    throws InvalidParameterSpecException
{
    if (paramSpec == RC2ParameterSpec.class)
    {
        if (parameterVersion != -1)
        {
            if (parameterVersion < 256)
            {
                return new RC2ParameterSpec(ekb[parameterVersion], iv);
            }
            else
            {
                return new RC2ParameterSpec(parameterVersion, iv);
            }
        }
    }

    if (paramSpec == IvParameterSpec.class)
    {
        return new IvParameterSpec(iv);
    }

    throw new InvalidParameterSpecException("unknown parameter spec passed to RC2 parameters object.");
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:27,代码来源:RC2.java

示例5: getParams

import java.security.spec.InvalidParameterSpecException; //导入依赖的package包/类
/**
 * Returns the DSA parameters associated with this key, or null if the
 * parameters could not be parsed.
 */
public DSAParams getParams() {
    try {
        if (algid instanceof DSAParams) {
            return (DSAParams)algid;
        } else {
            DSAParameterSpec paramSpec;
            AlgorithmParameters algParams = algid.getParameters();
            if (algParams == null) {
                return null;
            }
            paramSpec = algParams.getParameterSpec(DSAParameterSpec.class);
            return (DSAParams)paramSpec;
        }
    } catch (InvalidParameterSpecException e) {
        return null;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:22,代码来源:DSAPrivateKey.java

示例6: engineGetParameterSpec

import java.security.spec.InvalidParameterSpecException; //导入依赖的package包/类
protected <T extends AlgorithmParameterSpec>
    T engineGetParameterSpec(Class<T> paramSpec)
    throws InvalidParameterSpecException
{
        try {
            Class<?> dsaParamSpec = Class.forName
                ("java.security.spec.DSAParameterSpec");
            if (dsaParamSpec.isAssignableFrom(paramSpec)) {
                return paramSpec.cast(
                        new DSAParameterSpec(this.p, this.q, this.g));
            } else {
                throw new InvalidParameterSpecException
                    ("Inappropriate parameter Specification");
            }
        } catch (ClassNotFoundException e) {
            throw new InvalidParameterSpecException
                ("Unsupported parameter specification: " + e.getMessage());
        }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:DSAParameters.java

示例7: engineInit

import java.security.spec.InvalidParameterSpecException; //导入依赖的package包/类
protected void engineInit(
    AlgorithmParameterSpec paramSpec)
    throws InvalidParameterSpecException
{
    if (!(paramSpec instanceof ElGamalParameterSpec) && !(paramSpec instanceof DHParameterSpec))
    {
        throw new InvalidParameterSpecException("DHParameterSpec required to initialise a ElGamal algorithm parameters object");
    }

    if (paramSpec instanceof ElGamalParameterSpec)
    {
        this.currentSpec = (ElGamalParameterSpec)paramSpec;
    }
    else
    {
        DHParameterSpec s = (DHParameterSpec)paramSpec;

        this.currentSpec = new ElGamalParameterSpec(s.getP(), s.getG());
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:21,代码来源:AlgorithmParametersSpi.java

示例8: engineGetParameters

import java.security.spec.InvalidParameterSpecException; //导入依赖的package包/类
protected AlgorithmParameters engineGetParameters() {
    if (spec != null && spec instanceof OAEPParameterSpec) {
        try {
            AlgorithmParameters params =
                AlgorithmParameters.getInstance("OAEP",
                    SunJCE.getInstance());
            params.init(spec);
            return params;
        } catch (NoSuchAlgorithmException nsae) {
            // should never happen
            throw new RuntimeException("Cannot find OAEP " +
                " AlgorithmParameters implementation in SunJCE provider");
        } catch (InvalidParameterSpecException ipse) {
            // should never happen
            throw new RuntimeException("OAEPParameterSpec not supported");
        }
    } else {
        return null;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:RSACipher.java

示例9: engineInit

import java.security.spec.InvalidParameterSpecException; //导入依赖的package包/类
protected void engineInit(int opmode, Key key,
        AlgorithmParameters params, SecureRandom random)
        throws InvalidKeyException, InvalidAlgorithmParameterException {
    if (params == null) {
        init(opmode, key, random, null);
    } else {
        try {
            OAEPParameterSpec spec =
                    params.getParameterSpec(OAEPParameterSpec.class);
            init(opmode, key, random, spec);
        } catch (InvalidParameterSpecException ipse) {
            InvalidAlgorithmParameterException iape =
                new InvalidAlgorithmParameterException("Wrong parameter");
            iape.initCause(ipse);
            throw iape;
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:RSACipher.java

示例10: checkCryptoPerm

import java.security.spec.InvalidParameterSpecException; //导入依赖的package包/类
private void checkCryptoPerm(CipherSpi checkSpi, Key key,
        AlgorithmParameters params)
        throws InvalidKeyException, InvalidAlgorithmParameterException {
    if (cryptoPerm == CryptoAllPermission.INSTANCE) {
        return;
    }
    // Convert the specified parameters into specs and then delegate.
    AlgorithmParameterSpec pSpec;
    try {
        pSpec = getAlgorithmParameterSpec(params);
    } catch (InvalidParameterSpecException ipse) {
        throw new InvalidAlgorithmParameterException
            ("Failed to retrieve algorithm parameter specification");
    }
    checkCryptoPerm(checkSpi, key, pSpec);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:Cipher.java

示例11: writeWalletFile

import java.security.spec.InvalidParameterSpecException; //导入依赖的package包/类
/**
 * Methods used to write the current ClientWallent into a generated file.
 * @param userPassword
 * @param accountName
 * @param keyPair
 * @throws InvalidKeyException
 * @throws InvalidParameterSpecException
 * @throws IllegalBlockSizeException
 * @throws BadPaddingException
 * @throws FileNotFoundException
 * @throws IOException 
 */
public static void writeWalletFile(final char[] userPassword, final String accountName, final KeyPair keyPair) 
        throws InvalidKeyException,
        InvalidParameterSpecException, IllegalBlockSizeException, BadPaddingException, FileNotFoundException,
        IOException {
    
    // Write wallet information in the wallet file
    final WalletInformation walletInformation = Cryptography.walletInformationFromKeyPair(userPassword, keyPair);

    // Creates wallet folder if not exists
    final File walletFolder = new File(Parameters.WALLETS_PATH);
    if (!walletFolder.exists()) {
        walletFolder.mkdir();
    }

    // Creates new wallet file
    final File f = new File(Parameters.WALLETS_PATH + accountName + ".wallet");
    final ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(f));
    oos.writeObject(walletInformation);
    oos.flush();
    oos.close();

    System.out.println("The creation of your wallet completed successfully");
    System.out.println("Please sign in and start crashing coins");
}
 
开发者ID:StanIsAdmin,项目名称:CrashCoin,代码行数:37,代码来源:WalletClient.java

示例12: actionMenuNotRegistered

import java.security.spec.InvalidParameterSpecException; //导入依赖的package包/类
private void actionMenuNotRegistered(final int choice) throws ClassNotFoundException, IOException, FileNotFoundException,
        InvalidKeyException, InvalidAlgorithmParameterException,
        InvalidKeySpecException, IllegalBlockSizeException, BadPaddingException, InvalidParameterSpecException {
    switch (choice) {
        case 1:
            signIn();
            break;

        case 2:
            signUp();
            break;
            
        case 3: // close with condition in while
            break;

        default:
            System.out.println("Unknow choice " + choice + "\n");
            break;

    }
}
 
开发者ID:StanIsAdmin,项目名称:CrashCoin,代码行数:22,代码来源:ClientApplication.java

示例13: engineInit

import java.security.spec.InvalidParameterSpecException; //导入依赖的package包/类
@Override
protected void engineInit(int opmode, Key key, AlgorithmParameters params,
		SecureRandom random) throws InvalidKeyException,
		InvalidAlgorithmParameterException {
	
	try {
		engineInit(opmode, key, params.getParameterSpec(AlgorithmParameterSpec.class), random);
	} catch (InvalidParameterSpecException e) {
		throw new InvalidAlgorithmParameterException(e);
	}

}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:13,代码来源:NativeAESCipherSpi.java

示例14: engineGetParameterSpec

import java.security.spec.InvalidParameterSpecException; //导入依赖的package包/类
protected <T extends AlgorithmParameterSpec>
        T engineGetParameterSpec(Class<T> paramSpec)
    throws InvalidParameterSpecException {

    if (GCMParameterSpec.class.isAssignableFrom(paramSpec)) {
        return paramSpec.cast(new GCMParameterSpec(tLen * 8, iv));
    } else {
        throw new InvalidParameterSpecException
            ("Inappropriate parameter specification");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:GCMParameters.java

示例15: engineInit

import java.security.spec.InvalidParameterSpecException; //导入依赖的package包/类
protected void engineInit(
    AlgorithmParameterSpec paramSpec)
    throws InvalidParameterSpecException
{
    if (!(paramSpec instanceof PBEParameterSpec))
    {
        throw new InvalidParameterSpecException("PBEParameterSpec required to initialise a PKCS12 PBE parameters algorithm parameters object");
    }

    PBEParameterSpec pbeSpec = (PBEParameterSpec)paramSpec;

    this.params = new PKCS12PBEParams(pbeSpec.getSalt(),
        pbeSpec.getIterationCount());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:15,代码来源:PBEPKCS12.java


注:本文中的java.security.spec.InvalidParameterSpecException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。