Examples of KeyParameter


Examples of org.bouncycastle.crypto.params.KeyParameter

    public SkeinMac() {
    }

    public void init(CipherParameters params) throws IllegalArgumentException {
        ParametersForSkein p = (ParametersForSkein) params;
        KeyParameter kp = (KeyParameter) (p.getParameters());

        skein = new Skein(p.getStateSize(), p.getMacSize(), 0, kp.getKey());
        Xsave = skein.getState();
    }
View Full Code Here

Examples of org.bouncycastle.crypto.params.KeyParameter

            if (kr.restOfLine.contains("Tree")) {
                notProcessed++;
                continue;
            }
            if (kr.restOfLine.contains("MAC")) {
                pfs = new ParametersForSkein(new KeyParameter(kr.macKey),
                        kr.stateSize, kr.hashBitLength);
                SkeinMac sm = new SkeinMac();

                sm.init(pfs);
                sm.updateBits(kr.msg, 0, kr.msgLength);
View Full Code Here

Examples of org.bouncycastle.crypto.params.KeyParameter

            throw new GeneralSecurityException("MAC is incorrect");
          }
        }
        ParametersWithIV tempPram = null;
        try{
            KeyParameter cipherKey = new KeyParameter(KeyGenUtils.deriveSecretKey(unencryptedBaseKey,
              getClass(), kdfInput.underlyingKey.input,
              type.encryptKey).getEncoded());
            tempPram = new ParametersWithIV(cipherKey,
              KeyGenUtils.deriveIvParameterSpec(unencryptedBaseKey, getClass(),
                  kdfInput.underlyingIV.input, type.encryptKey).getIV());
View Full Code Here

Examples of org.bouncycastle.crypto.params.KeyParameter

    public AEADOutputStream(OutputStream os, byte[] key, byte[] nonce, BlockCipher hashCipher,
            BlockCipher mainCipher) throws IOException {
        super(os);
        os.write(nonce);
        cipher = new OCBBlockCipher_v149(hashCipher, mainCipher);
        KeyParameter keyParam = new KeyParameter(key);
        AEADParameters params = new AEADParameters(keyParam, MAC_SIZE_BITS, nonce);
        cipher.init(true, params);
    }
View Full Code Here

Examples of org.bouncycastle.crypto.params.KeyParameter

                  SecureRandom rng = NodeStarter.getGlobalSecureRandom();
                  rng.nextBytes(key);
                  rng.nextBytes(iv);
                  AESFastEngine e = new AESFastEngine();
                  SICBlockCipher ctr = new SICBlockCipher(e);
                  ctr.init(true, new ParametersWithIV(new KeyParameter(key),iv));
                  cis = new CipherInputStream(zis, new BufferedBlockCipher(ctr));
                  cisCounter = 0;
              }
              read = cis.read(buffer, 0, ((remaining > BUFFER_SIZE) || (remaining == -1)) ? BUFFER_SIZE : (int) remaining);
              cisCounter += read;
View Full Code Here

Examples of org.bouncycastle.crypto.params.KeyParameter

            BlockCipher mainCipher) throws IOException {
        super(is);
        byte[] nonce = new byte[mainCipher.getBlockSize()];
        new DataInputStream(is).readFully(nonce);
        cipher = new OCBBlockCipher_v149(hashCipher, mainCipher);
        KeyParameter keyParam = new KeyParameter(key);
        AEADParameters params = new AEADParameters(keyParam, MAC_SIZE_BITS, nonce);
        cipher.init(false, params);
        excess = new byte[mainCipher.getBlockSize()];
        excessEnd = 0;
        excessPtr = 0;
View Full Code Here

Examples of org.bouncycastle.crypto.params.KeyParameter

    }

    private void setupKeys() {
        ParametersWithIV tempPram = null;
        try{
            KeyParameter cipherKey = new KeyParameter(KeyGenUtils.deriveSecretKey(unencryptedBaseKey,
                    EncryptedRandomAccessBuffer.class, kdfInput.underlyingKey.input,
                    type.encryptKey).getEncoded());
            tempPram = new ParametersWithIV(cipherKey,
                    KeyGenUtils.deriveIvParameterSpec(unencryptedBaseKey, EncryptedRandomAccessBuffer.class,
                            kdfInput.underlyingIV.input, type.encryptKey).getIV());
View Full Code Here

Examples of org.bouncycastle.crypto.params.KeyParameter

        throws IllegalArgumentException
    {
        this.forEncryption = forEncryption;
        this.macBlock = null;

        KeyParameter keyParameter;

        byte[] N;
        if (parameters instanceof AEADParameters)
        {
            AEADParameters aeadParameters = (AEADParameters)parameters;
View Full Code Here

Examples of org.bouncycastle.crypto.params.KeyParameter

                ivParam = (ParametersWithIV)param;
            }
        }
        else if (params == null)
        {
            param = new KeyParameter(key.getEncoded());
        }
        else if (params instanceof IvParameterSpec)
        {
            if (ivLength != 0)
            {
                param = new ParametersWithIV(new KeyParameter(key.getEncoded()), ((IvParameterSpec)params).getIV());
                ivParam = (ParametersWithIV)param;
            }
            else
            {
                param = new KeyParameter(key.getEncoded());
            }
        }
        else if (params instanceof RC2ParameterSpec)
        {
            RC2ParameterSpec    rc2Param = (RC2ParameterSpec)params;
View Full Code Here

Examples of org.bouncycastle.crypto.params.KeyParameter

     */
    public TlsMac(TlsContext context, Digest digest, byte[] key, int keyOff, int keyLen)
    {
        this.context = context;

        KeyParameter keyParameter = new KeyParameter(key, keyOff, keyLen);

        this.secret = Arrays.clone(keyParameter.getKey());

        // TODO This should check the actual algorithm, not rely on the engine type
        if (digest instanceof LongDigest)
        {
            this.digestBlockSize = 128;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.