Package org.keyczar.exceptions

Examples of org.keyczar.exceptions.KeyczarException


    RsaStream() throws KeyczarException {
      try {
        signature = Signature.getInstance(SIG_ALGORITHM);
        cipher = Cipher.getInstance(getPadding().getCryptAlgorithm());
      } catch (GeneralSecurityException e) {
        throw new KeyczarException(e);
      }
    }
View Full Code Here


          // Websphere) which outputs ciphertext that's one byte too long, appending
          // a trailing zero.  We need to trim this byte.
          output.put(tmpOutput.array(), 0, outputCapacity);

        } else {
          throw new KeyczarException("Expected " + outputCapacity + " bytes from encryption "
              + "operation but got " + ciphertextSize);
        }

        return outputCapacity;
      } catch (GeneralSecurityException e) {
        throw new KeyczarException(e);
      }
    }
View Full Code Here

    @Override
    public int initEncrypt(ByteBuffer output) throws KeyczarException {
      try {
        cipher.init(Cipher.ENCRYPT_MODE, jcePublicKey);
      } catch (InvalidKeyException e) {
        throw new KeyczarException(e);
      }
      return 0;
    }
View Full Code Here

    @Override
    public void initVerify() throws KeyczarException {
      try {
        signature.initVerify(jcePublicKey);
      } catch (GeneralSecurityException e) {
        throw new KeyczarException(e);
      }
    }
View Full Code Here

    public int updateEncrypt(ByteBuffer input, ByteBuffer output)
        throws KeyczarException {
      try {
        return cipher.update(input, output);
      } catch (ShortBufferException e) {
        throw new KeyczarException(e);
      }
    }
View Full Code Here

        return RsaPrivateKey.generate(keySize);
      // Currently unsupported. See "unofficial" directory.
      //case EC_PRIV:
      //    return EcPrivateKey.generate(keySize);
      case RSA_PUB: case DSA_PUB:
        throw new KeyczarException(
            Messages.getString("KeyczarKey.PublicKeyExport", type));
    }
    throw new UnsupportedTypeException(type);
  }
View Full Code Here

    @Override
    public void updateVerify(ByteBuffer input) throws KeyczarException {
      try {
        signature.update(input);
      } catch (SignatureException e) {
        throw new KeyczarException(e);
      }
    }
View Full Code Here

    public boolean verify(ByteBuffer sig) throws KeyczarException {
      try {
        return signature.verify(sig.array(), sig.position(), sig.limit()
            - sig.position());
      } catch (GeneralSecurityException e) {
        throw new KeyczarException(e);
      }
    }
View Full Code Here

    public HmacStream() throws KeyczarException {
      try {
        hmac = Mac.getInstance(MAC_ALGORITHM);
      } catch (GeneralSecurityException e) {
        throw new KeyczarException(e);
      }
    }
View Full Code Here

    @Override
    public void initSign() throws KeyczarException {
      try {
        hmac.init(hmacKey);
      } catch (GeneralSecurityException e) {
        throw new KeyczarException(e);
      }
    }
View Full Code Here

TOP

Related Classes of org.keyczar.exceptions.KeyczarException

Copyright © 2018 www.massapicom. 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.