⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jcepbekey.java

📁 kmlnjlkj nlkjlkjkljl okopokipoipo oipipipo i
💻 JAVA
字号:
package org.bouncycastle.jce.provider;import javax.crypto.interfaces.PBEKey;import javax.crypto.spec.PBEKeySpec;import org.bouncycastle.asn1.DERObjectIdentifier;import org.bouncycastle.crypto.CipherParameters;import org.bouncycastle.crypto.PBEParametersGenerator;import org.bouncycastle.crypto.params.KeyParameter;import org.bouncycastle.crypto.params.ParametersWithIV;public class JCEPBEKey    implements PBEKey{    String              algorithm;    DERObjectIdentifier oid;    int                 type;    int                 digest;    int                 keySize;    int                 ivSize;    CipherParameters    param;    PBEKeySpec          pbeKeySpec;    boolean             tryWrong = false;    /**     * @param param     */    public JCEPBEKey(        String              algorithm,        DERObjectIdentifier oid,        int                 type,        int                 digest,        int                 keySize,        int                 ivSize,        PBEKeySpec          pbeKeySpec,        CipherParameters    param)    {        this.algorithm = algorithm;        this.oid = oid;        this.type = type;        this.digest = digest;        this.keySize = keySize;        this.ivSize = ivSize;        this.pbeKeySpec = pbeKeySpec;        this.param = param;    }    public String getAlgorithm()    {        return algorithm;    }    public String getFormat()    {        return "RAW";    }    public byte[] getEncoded()    {        if (param != null)        {            KeyParameter    kParam;                        if (param instanceof ParametersWithIV)            {                kParam = (KeyParameter)((ParametersWithIV)param).getParameters();            }            else            {                kParam = (KeyParameter)param;            }                        return kParam.getKey();        }        else        {            if (type == PBE.PKCS12)            {                return PBEParametersGenerator.PKCS12PasswordToBytes(pbeKeySpec.getPassword());            }            else            {                   return PBEParametersGenerator.PKCS5PasswordToBytes(pbeKeySpec.getPassword());            }        }    }        int getType()    {        return type;    }        int getDigest()    {        return digest;    }        int getKeySize()    {        return keySize;    }        int getIvSize()    {        return ivSize;    }        CipherParameters getParam()    {        return param;    }    /* (non-Javadoc)     * @see javax.crypto.interfaces.PBEKey#getPassword()     */    public char[] getPassword()    {        return pbeKeySpec.getPassword();    }    /* (non-Javadoc)     * @see javax.crypto.interfaces.PBEKey#getSalt()     */    public byte[] getSalt()    {        return pbeKeySpec.getSalt();    }    /* (non-Javadoc)     * @see javax.crypto.interfaces.PBEKey#getIterationCount()     */    public int getIterationCount()    {        return pbeKeySpec.getIterationCount();    }        public DERObjectIdentifier getOID()    {        return oid;    }        void setTryWrongPKCS12Zero(boolean tryWrong)    {        this.tryWrong = tryWrong;     }        boolean shouldTryWrongPKCS12()    {        return tryWrong;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -