Package mykeynote.exceptions.keynote

Examples of mykeynote.exceptions.keynote.MalformedKeyException


    if (array.size() == 1) {
      String check = array.get(0);
      while (!check.startsWith(getKNAlgorithmIdentifierHelper(i))) {
        i++;
        if (getKNAlgorithmIdentifierHelper(i) == null) {
          throw new MalformedKeyException(unique, report, String.format(ExceptionString.MALFORMEDKEYEXCEPTION.getExceptionString(),"only one line and no known algorithm identifier"));
        }
      }
      // it seems that we have the key in right format
      return true;
    }
View Full Code Here


   * array size == 0.
   */
  private void arraySize(String unique, Report report, ArrayList<String> array)
      throws MalformedKeyException {
    if (array.size() == 0) {
      throw new MalformedKeyException(unique, report, String.format(ExceptionString.MALFORMEDKEYEXCEPTION.getExceptionString(),"the key file is empty"));
    }

    if (array.size() == 2) { // check if the last line is not just empty
      if (array.get(1).length() < 1) {
        array.remove(1); // if so, remove it
View Full Code Here

    int i = getPEM(unique, report, array);
    String pemString = getKNAlgorithmIdentifierHelper(i);
    if(pemString != null){
      return pemString;
    }
    throw new MalformedKeyException(unique, report, String.format(
        ExceptionString.MALFORMEDKEYEXCEPTION
        .getExceptionString(), "unknown pem type"));
  }
View Full Code Here

      throws MalformedKeyException {
    int i = 0;
    while (!array.get(0).equalsIgnoreCase(getBeginingCertificate(i))) {
      i++;
      if (getBeginingCertificate(i) == null) {
        throw new MalformedKeyException(unique, report, String.format(
            ExceptionString.MALFORMEDKEYEXCEPTION
                .getExceptionString(), "unknown key type"));
      }
    }
    array.remove(0); // remote the first line, no use for it any more
View Full Code Here

    while (!array.get(i2).equalsIgnoreCase(getEndCertificate(i))) {
      if (array.get(i2).length() > 1 || i2 <= 1) {
        // i2 <=1, because if we remove the last element, that means
        // there was no ending to the certificat
        throw new MalformedKeyException(unique, report, String.format(
            ExceptionString.MALFORMEDKEYEXCEPTION
                .getExceptionString(),
            "no appropriate ending for the key"));
      }
      array.remove(i2);
View Full Code Here

  public String getKNAlgorithmIdentifier(String unique, Report report, File keyFile) throws FileNotFoundException, IOException, MalformedKeyException{
    ArrayList<String> array = common.readFile(keyFile);

    int i = 0;
    if(array.size() < 1){
      throw new MalformedKeyException(unique, report, String.format(ExceptionString.MALFORMEDKEYEXCEPTIONZEROLINES.getExceptionString()));
    }
    boolean iterate;
   
    for(String line : array){
      line = line.trim();
      if(line.startsWith("\"")){
        line = (String) line.subSequence(1, line.length());
      }
      iterate = true;
      i = 0;
      while(iterate){
        if (!line.startsWith(getKNAlgorithmIdentifierHelper(i))) {
          i++;
          if (getKNAlgorithmIdentifierHelper(i) == null) {
            iterate = false;
          }
        } else {
          return getKNAlgorithmIdentifierHelper(i);
        }
      }
    }
   

    throw new MalformedKeyException(unique, report, String.format(ExceptionString.MALFORMEDKEYEXCEPTIONNOKEY.getExceptionString()));
  }
View Full Code Here

       i = i-3;
     }
    
     keyPem = getKNAlgorithmIdentifierHelper(i);
     if(keyPem == null){
       throw new MalformedKeyException(unique, report, String.format(ExceptionString.MALFORMEDKEYEXCEPTIONZEROLINES.getExceptionString()));
     }
     return keyPem;
  }
View Full Code Here

TOP

Related Classes of mykeynote.exceptions.keynote.MalformedKeyException

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.