Package org.keyczar.exceptions

Examples of org.keyczar.exceptions.KeyczarException


  void revoke(int versionNumber) throws KeyczarException {
    KeyVersion version = getVersion(versionNumber);
    if (version.getStatus() == KeyStatus.INACTIVE) {
      kmd.removeVersion(versionNumber);
    } else {
      throw new KeyczarException(Messages.getString("Keyczar.CantRevoke"));
    }
  }
View Full Code Here


            break;
        }
        break;
    }
    if (publicKmd == null) {
      throw new KeyczarException(
          Messages.getString("KeyczarTool.CannotExportPubKey",
              kmd.getType(), kmd.getPurpose()));
    }

    for (KeyVersion version : getVersions()) {
View Full Code Here

    try {
      FileWriter writer = new FileWriter(outputFile);
      writer.write(data);
      writer.close();
    } catch (IOException e) {
      throw new KeyczarException(
          Messages.getString("KeyczarTool.UnableToWrite",
              outputFile.toString()), e);
    }
  }
View Full Code Here

   */
  public String sign(String input) throws KeyczarException {
    try {
      return Base64Coder.encode(sign(input.getBytes(DEFAULT_ENCODING)));
    } catch (UnsupportedEncodingException e) {
      throw new KeyczarException(e);
    }
  }
View Full Code Here

        return new String(contents);
      } finally {
        fis.close();
      }
    } catch (IOException e) {
      throw new KeyczarException(
          Messages.getString("KeyczarFileReader.FileError", filename), e);
    }
  }
View Full Code Here

  public boolean verify(String data, String signature) throws KeyczarException {
    try {
      return verify(data.getBytes(Keyczar.DEFAULT_ENCODING),
          Base64Coder.decodeWebSafe(signature));
    } catch (UnsupportedEncodingException e) {
      throw new KeyczarException(e);
    }
  }
View Full Code Here

   */
  public String sign(String input) throws KeyczarException {
    try {
      return Base64Coder.encode(sign(input.getBytes(Keyczar.DEFAULT_ENCODING)));
    } catch (UnsupportedEncodingException e) {
      throw new KeyczarException(e);
    }
  }
View Full Code Here

   */
  public Keyczar(KeyczarReader reader) throws KeyczarException {
    // Reads keys from the KeyczarReader
    kmd = KeyMetadata.read(reader.getMetadata());
    if (!isAcceptablePurpose(kmd.getPurpose())) {
      throw new KeyczarException(
          Messages.getString("Keyczar.UnacceptablePurpose", kmd.getPurpose()));
    }

    if (kmd.isEncrypted() && !(reader instanceof EncryptedReader)) {
      throw new KeyczarException(
          Messages.getString("Keyczar.NeedEncryptedReader"));
    }
    for (KeyVersion version : kmd.getVersions()) {
      if (version.getStatus() == KeyStatus.PRIMARY) {
        if (primaryVersion != null) {
          throw new KeyczarException(
              Messages.getString("Keyczar.SinglePrimary"));
        }
        primaryVersion = version;
      }
      String keyString = reader.getKey(version.getVersionNumber());
View Full Code Here

  public boolean verify(String data, String signature) throws KeyczarException {
    try {
      return verify(data.getBytes(Keyczar.DEFAULT_ENCODING),
          Base64Coder.decode(signature));
    } catch (UnsupportedEncodingException e) {
      throw new KeyczarException(e);
    }
  }
View Full Code Here

      throws KeyczarException {
    try {
      RSAPublicKeySpec spec = new RSAPublicKeySpec(publicModulus, publicExponent);
      jcePublicKey = (RSAPublicKey) KeyFactory.getInstance(KEY_GEN_ALGORITHM).generatePublic(spec);
    } 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.