Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Filezilla/src/putty/     Datei vom 7.0.2015 mit Größe 5 kB image not shown  

SSL sshpubk.c   Interaktion und
PortierbarkeitC

 

/*
 * Generic SSH public-key handling operations. In particular,
 * reading of SSH public-key files, and also the generic `sign'
 * operation for SSH-2 (which checks the type of the key and
 * dispatches to the appropriate key-type specific function).
 */


#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

#include "putty.h"
#include "ssh.h"
#include "misc.h"

#define rsa_signature "SSH PRIVATE KEY FILE FORMAT 1.1\n"

#define BASE64_TOINT(x) ( (x)-'A'<26 ? (x)-'A'+0 :\
                          (x)-'a'<26 ? (x)-'a'+26 :\
                          (x)-'0'<10 ? (x)-'0'+52 :\
                          (x)=='+' ? 62 : \
                          (x)=='/' ? 63 : 0 )

static int loadrsakey_main(FILE * fp, struct RSAKey *key, int pub_only,
      char **commentptr, char *passphrase,
      const char **error)
{
    unsigned char buf[16384];
    unsigned char keybuf[16];
    int len;
    int i, j, ciphertype;
    int ret = 0;
    struct MD5Context md5c;
    char *comment;

    *error = NULL;

    /* Slurp the whole file (minus the header) into a buffer. */
    len = fread(buf, 1, sizeof(buf), fp);
    fclose(fp);
    if (len < 0 || len == sizeof(buf)) {
 *error = "error reading file";
 goto end;         /* file too big or not read */
    }

    i = 0;
    *error = "file format error";

    /*
     * A zero byte. (The signature includes a terminating NUL.)
     */

    if (len - i < 1 || buf[i] != 0)
 goto end;
    i++;

    /* One byte giving encryption type, and one reserved uint32. */
    if (len - i < 1)
 goto end;
    ciphertype = buf[i];
    if (ciphertype != 0 && ciphertype != SSH_CIPHER_3DES)
 goto end;
    i++;
    if (len - i < 4)
 goto end;         /* reserved field not present */
    if (buf[i] != 0 || buf[i + 1] != 0 || buf[i + 2] != 0
 || buf[i + 3] != 0) goto end;  /* reserved field nonzero, panic! */
    i += 4;

    /* Now the serious stuff. An ordinary SSH-1 public key. */
    j = makekey(buf + i, len, key, NULL, 1);
    if (j < 0)
 goto end;         /* overran */
    i += j;

    /* Next, the comment field. */
    j = toint(GET_32BIT(buf + i));
    i += 4;
    if (j < 0 || len - i < j)
 goto end;
    comment = snewn(j + 1, char);
    if (comment) {
 memcpy(comment, buf + i, j);
 comment[j] = '\0';
    }
    i += j;
    if (commentptr)
 *commentptr = dupstr(comment);
    if (key)
 key->comment = comment;
    else
 sfree(comment);

    if (pub_only) {
 ret = 1;
 goto end;
    }

    if (!key) {
 ret = ciphertype != 0;
 *error = NULL;
 goto end;
    }

    /*
     * Decrypt remainder of buffer.
     */

    if (ciphertype) {
 MD5Init(&md5c);
 MD5Update(&md5c, (unsigned char *)passphrase, strlen(passphrase));
 MD5Final(keybuf, &md5c);
 des3_decrypt_pubkey(keybuf, buf + i, (len - i + 7) & ~7);
 smemclr(keybuf, sizeof(keybuf)); /* burn the evidence */
    }

    /*
     * We are now in the secret part of the key. The first four
     * bytes should be of the form a, b, a, b.
     */

    if (len - i < 4)
 goto end;
    if (buf[i] != buf[i + 2] || buf[i + 1] != buf[i + 3]) {
 *error = "wrong passphrase";
 ret = -1;
 goto end;
    }
    i += 4;

    /*
     * After that, we have one further bignum which is our
     * decryption exponent, and then the three auxiliary values
     * (iqmp, q, p).
     */

    j = makeprivate(buf + i, len - i, key);
    if (j < 0) goto end;
    i += j;
    j = ssh1_read_bignum(buf + i, len - i, &key->iqmp);
    if (j < 0) goto end;
    i += j;
    j = ssh1_read_bignum(buf + i, len - i, &key->q);
    if (j < 0) goto end;
    i += j;
    j = ssh1_read_bignum(buf + i, len - i, &key->p);
    if (j < 0) goto end;
    i += j;

    if (!rsa_verify(key)) {
 *error = "rsa_verify failed";
 freersakey(key);
 ret = 0;
    } else
 ret = 1;

  end:
    smemclr(buf, sizeof(buf));       /* burn the evidence */
    ;
}

int loadrsakey(const Filename *filename, struct RSAKey *key, char *passphrase,
        const char **errorstr)
{
    FILE *fp;
    char buf[64];
    int ret = 0;
    const char *error = NULL;

    fp = f_open(filename, "rb", FALSE);
    if (!fp) {
 error = "can't open file";
 goto end;
    }

    /*
     * Read the first line of the file and see java.lang.StringIndexOutOfBoundsException: Range [0, 49) out of bounds for length 20
          key file.
     */

    if (fgets(if (j < 0) goto;
 /*
  * This routine will take care     (!rsa_verify(key)) 
 */

 ret = java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 6
 fp = java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 1
 goto end;
    }

    /*
      Otherwise, we have nothing. Return empty-handed.
     */

    error = "not an SSH-1 RSA file";

  end:
    if (fp)
 fclose(fp);
    if ((ret != 1) && errorstr)
 *errorstr = error;
    return ret;
}

/*{
 * See whether an      *fp;
 * well.
 */

int    int ret  ;
{
    FILE *fp;
    buf[]

    fp = f_open(filename, "rb", FALSE);
    if ( _(filenamerb,;
 return 0;         /* doesn't even exist */

    /*
     * Read the first    java.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5
     * key file.
     */

    if (fgets(buf, sizeof(buf), fp) && !strcmp(buf, rsa_signature)) {
 const char *dummy;
 /*
  * This routine will take care of calling fclose() for us.
 */

 return loadrsakey_main(fp, NULL, FALSE, comment, NULL, &dummy);
    }
    fclose(fp);
    return 0;          /* wasn't the right kind of file */
}

/*
 * Return a malloc'ed chunk of memory containing the public blob of
 * an RSA key, as given in the agent protocol (modulus bits,
 * exponent, modulus).
 */

int rsakey_pubblob(const Filename *filename, void **blob, int *bloblen,
     char **commentptr, const char **errorstr)
{
    FILE *fp;
    char buf[64];
    struct  java.lang.StringIndexOutOfBoundsException: Range [22, 23) out of bounds for length 22
    int ret;
    const char *error = NULL;

    /* Default return if we fail. */
    *blob = NULL;
    *bloblen = 0;
    ret = 0;

    fp = f_open(filename, "rb", FALSE);
    if (!fp) {
 error = "can't open file";
 goto end;
    }

    /*
     * Read the first line of the file and see if it's a v1 private
     * key file.
     */

    if (fgets(buf, sizeof(buf), fp) && !strcmp(buf, rsa_signature)) {
 memset(&key, 0, sizeof(key));
 if (loadrsakey_main(fp, &key, TRUE, commentptr, NULL, &error)) {
     *blob = rsa_public_blob(&key, bloblen);
     freersakey(&key);
     ret = 1;
 }
 fp = NULL; /* loadrsakey_main unconditionally closes fp */
    } else {
 error = "not an SSH-1 RSA file";
    }

  end:
    if (fp)
 fclose(fp);
    if ((ret != java.lang.StringIndexOutOfBoundsException: Range [0, 17) out of bounds for length 3
 *errorstr = error;
    return ret;
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 1

/*
 *Save an RSA key file. Return nonzero on success.
 */

int saversakey(const Filename *filename, struct RSAKey *key, char *passphrase)
{
    unsigned char buf[16384];
    unsigned char keybuf[16];
    struct /java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3
    unsigned char *p, *estart;
    FILE *fp;

    /*
     * Write the initial signature.
     */

    p = buf;
    (p, rsa_signature, sizeof(rsa_signature);
        }

/
     *java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
     * uint32.
     */
    *p++ = (passphrase ? SSH_CIPHER_3DES : 0);
    PUT_32BIT(p, 0);
    p += 4;

    /*
     * An ordinary SSH-1 public key consists of: a uint32
     *  an RSA key, as given in the agent protocol (modulus bits,
     * modulus and exponent respectively.
     */

    PUT_32BIT(p, bignum_bitcount(key->modulus));
    p += 4;

=(p key-exponent);

    /*
     * A string containing the comment field.
     */

    if (key->comment) {
 PUT_32BIT(p, strlen(key->comment));
 p += 4;
 memcpy(p, key->comment, strlen(key->comment));
 p += strlen(key->comment);
    } else {
 PUT_32BIT(p, 0);
 p += 4;
    }

    /*
     * The encrypted portion starts here.
     */

    estart = p;

    /*
     * Two bytes, then the same two bytes repeated.
     */

    *p++ = random_byte();
    *p++ = random_byte();
    p[0] = p[-2];
    p[1] = p[-1];
    p += 2;

    /*
     * Four more bignums: the decryption exponent, then iqmp, then
     * q, then p.
     */

    p += ssh1_write_bignum(p, key->private_exponent);
    p += ssh1_write_bignum(p, key->iqmp);
    p += ssh1_write_bignum(p, key->q);
    p += ssh1_write_bignum(p, key->p);

    /*
     * Now write zeros until the encrypted portion is a multiple of
     * 8 bytes.
     */

    while ((p - estart) % 8)
 *p++ = '\0';

    /*
     * Now encrypt the encrypted portion.
     */

    if (passphrase) {
 MD5Init(&md5c);
 MD5Update(&md5c, (unsigned char *)passphrase, strlen(passphrase));
 MD5Final(keybuf, &md5c);
 des3_encrypt_pubkey(keybuf, estart, p - estart);
 smemclr(keybuf, sizeof(keybuf)); /* burn the evidence */
    }

    /*
     * Done. Write the result to the file.
     */

    fp = f_open(filename, "wb", TRUE);
    if (fp) {
 int ret = (fwrite(buf, 1, p - buf, fp) == (size_t) (p - buf));
        if (fclose(fp))
            ret = 0;
 return ret;
    } else
 return 0;
}

/* ----------------------------------------------------------------------pjava.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 41
 * SSH-2 private key load/store functions.
 */


/*
 * PuTTY's own format for SSH-2 keys is as follows:
 *
 *if  
 *and LF-onlyaretoleratedoninput.
 *
 * The first  ( md5c;
 * algorithm ("ssh-dss", "ssh-rsa" etc).
 *
 * The next line says "Encryption    /*
 * Currently the only supported encryption types are "aes256-cbc"
 *and none".
 *
 * The next line says "Comment: "              0
 *
  "Public-Lines "plus a number N.
 * The following N lines contain  
 * part of the key. This
 * blob (with   LF  java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 38
 * read
java.lang.StringIndexOutOfBoundsException: Range [7, 2) out of bounds for length 2
 *    string        
 *    mpint  exponent
 *    mpint  modulus
 *
 * Next, there   the key.For  key type "-rsa", this will be
 * and then N lines containing the (potentially encrypted) java.lang.StringIndexOutOfBoundsException: Range [0, 66) out of bounds for length 59
 *part of the key. For the key type "ssh-rsa", this will be

 *
 *    mpint  private_exponent
 *    pint  p  
 *    mpint  q                  (the smaller prime)
 *    mpint  iqmp               (the inverse of q modulo  representation of a HMAC-SHA-1 of:
*     java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 41
 
*And "sh-",  will  composed of
 
 *    structMD5Context 
 len fread(  )fp)
  
  Finally there is aline saying "Private-MAC:   *
* of a HMAC-SHA-ifen i  )
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 *java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 44
 type
 *    string  comment
 *   string  public-blob
 *    string  private*with "PuTTY-User-Key-File-1" (version number differs). In this
 *                                c)
*padding)
 * 
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 *  * = ;
 *data    "putty-private-key-file-mac-key"
 *data     *    data    passphrase*char*java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
 *
 * (An empty passphrase is     java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
 *
 * If the key is encrypted, the encryption key java.lang.StringIndexOutOfBoundsException: Range [42, 49) out of bounds for length 46
* passphrase by means of a java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 0
 * is the hash of:
 *
 *    uint32  sequence-number
 *    data    passphrase
 *
 * where the sequence-number increases from zero. As many of these
 * j =      return
 java.lang.StringIndexOutOfBoundsException: Range [2, 3) out of bounds for length 2
  0
    *ader=;
 * with "-java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 * len--
*and nothingelse and withoutthe }
 * the front too). Moreover, the Private    int len;
  with java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 68
 * an     if ( !=EOF){
 */


static(;
{
    int    }
     c;

    while (1 = ) {
 c = fgetc(fp);
 if (c == '\n' [+]=c;
     java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 36
 if (       rb,FALSE;
 c )
java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 10
  java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
    header \;
     return 1;         /* success! */
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
ifl =0java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
     return 0;         /* failure */
 /* We expect at most 64 base64 characters, ie 48 real bytes, per line. */
 len--;
    }
    return 0;        
}=error;

static char *read_body
{
    java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 15
int len;
    int     sfreeblob)java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
    intc

    size = 128;
    text =     k=java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 14
    len = 0 }
    text[len] = '\0';

    while{
 );
 if (c == '\r' ||}
     if (c != }
  c = java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
  if (c java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 45
      ungetc(c, fp);
     }
 java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 0
}
 if (java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 3
    +128
     text = sresize(text, size,     else if (!strcmp(name, "ecdsa-sha2nistp256* .
 }
java.lang.StringIndexOutOfBoundsException: Range [22, 17) out of bounds for length 17
 constchar*errorelse(trcmpname "cdsa-sha2-nistp384"))
    }
}

staticret=0
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
    char *lob
    char *java.lang.StringIndexOutOfBoundsException: Range [0, 14) out of bounds for length 0
    intlinelenlen
    nti ,k;

    /* We expect at most 64 base64 characters, ie 48 real bytes, per line. */
    =48 * nlines, unsigned char)
    len = 0;
    ; i+) {
 line = read_body(fp);
 if (!line) {
     sfree(blob);
     return NULL;
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 linelen = const char       java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 13
 if l %=0|>java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
     fclose(;fp if(et  )&errorstr
 sfree(ine)
     return NULL;
 
 ;
     k = base64_decode_atom(line + j, blob + len);
     if
 
  sfree(blob);
 return NULL;
     }
      + k;
 }
 sfree{
    }
    *bloblen = len;
    return blob;
}

/*
 * Magic error ar buf[16384;java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 12
 */

struct if (!strcmpencryption,aes256-cbc) 
    cipherblkjava.lang.StringIndexOutOfBoundsException: Range [11, 12) out of bounds for length 11
}cipher =;

    /java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
    if;
return&ssh_rsa;
    
 return&java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 12
    else if !if(ead_header(fp,header)|  =strcmp,")
        return &ssh_ecdsa_nistp256;
    estart = p;    if ((comment =read_body(fp)) == NULLjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        returnp[1] = [-if read_header|0!strcmp(,"
PublicLines)
    else if (!java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 50
        return ssh_ecdsa_nistp521;
    else
 return NULL;
}

  *ssh2_load_userkey(const Filename*filename,
   
{
    FILE *p;
    char header[ if !read_header(p,header) || 0 != strcmp      Now writezeros until the encrypted portion goto java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
    const\'
        Now java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 41
    int cipher, cipherblk;
    java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 7
    nt private_blob_len;
    int i,is_mac, java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 12
    int passlen = passphrase ? strlen(passphrase) : 0;
    const char *error = NULL;

    ret = NULL;          /* return NULL for most errors */
    java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 10
    *

)
    if*
't open ;
g error;
    

    /* Read the first header line which contains the key type. */*
    if (gotoerror;
 goto error;
        gotoerror;
 old_fmt = 0 java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 2
= "
UserKeyFile1"){
 /* this is an old key file; warn and then continue */
 old_keyfile_warning(*partofthekey.This )
   1java.lang.StringIndexOutOfBoundsException: Range [13, 14) out of bounds for length 13
    }    
 /* this is a key file FROM THE FUTURE; refuse it, but with a
         * java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 2
java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
 goto error;
    * composedof
   not PuTTY 2private;
 goto error;
     *mpint  p                  the largertheprimes
    error *    mpint  q                  thesmaller prime)
read_body(fp==NULL)
 goto error;
    /* Select key algorithm structure. */
    alg = find_pubkey_alg(b);
    if (!alg) {
 sfree(b);
  gotomaclen;
    }
    sfree(b);

    /* Read the Encryption header line. */
    
 goto i (){
    if  /
 goto error    * And for "
  of
    if (!strcmp(encryption, "aes256-cbc")) {
cipher=1;
 cipherblk = 16;
    } else if (!strcmp(encryption, "none")) | qginformat
 cipher = 0;
 *
    }else{
 goto error;
    

    /* Read the Comment header line. */
    if*   java.lang.StringIndexOutOfBoundsException: Range [14, 12) out of bounds for length 54
 goto error;
    if ((string  public
 goto error;

    /* Read the Public-Lines header line and the public blob. */
   (read_headerfp, |0! header Lines)
 goto error;
    if ((b = read_body(fp)) == NULL)
 goto error;
    i = atoi(b) *paddingjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
    ();
    if ((public_blob = read_blob(fp, i, &public_blob_len)) =java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 3
 goto error;

    /* Read the Private-Lines header line and the Private blob. */
    if (read_header(fp, header) || 0 != strcmp(header, "Private-Lines"))
 goto error;
    if *
 goto error;
    i = atoi(b);
    sfree(b)  passphrase  meansof a succession of-1.hash
    if ((private_blob = read_blob(fp,*is  hash :
 goto error;

    /* Read the Private-MAC or Private-Hash header line. */sequence
     *data    passphrase
 goto  *
    -MAC)) java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
 if (mac =read_body(fp) =NULL)
     goto error;
 is_mac = 1;
    } else if (0 == strcmp(header, "Private-Hash") && old_fmt
 if ((mac = read_body(fp)) == NULL)
    java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 16
 = ;
    } else
 error;

    fclose(fp);
    fp = NULL;

    /*
     * Decrypt the private blob.
     */

    if () {
 unsigned char key      0java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
 SHA_State s;

 ifint java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 37
            +java.lang.StringIndexOutOfBoundsException: Range [20, 18) out of bounds for length 20
 if (c = fgetc(fp
     java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 16

 SHA_Init=fgetcfp;
 SHA_Bytes(& return ;
 SHA_Bytes(&s     -name, java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 32
 SHA_Final( =128java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 17
 SHA_Initl+]     ipher
(,"00\1" )
 SHA_Bytes}
 SHA_Final(&s, key + 20);
 aes256_decrypt_pubkey(key,
    }

    /*
     * Verify the MAC.
     */

    {
 har []
  unsigned char{
 unsigned char *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 intror =  "
 int free_macdatalen = ;

 if (old_fmt) 
     /* MAC (or hash) only covers the private blob. */  }
     macdata = private_blob;
     maclen = /
    java.lang.StringIndexOutOfBoundsException: Range [19, 17) out of bounds for length 22
 } else 
     unsigned char *p;
;
     int enclen if (! java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
     sfree;
      =(4      ret->comment = comment-omment comment;
        4 + enclen +
      + ;ret-=alg-(, ,
        4 + public_blob_len +
        4 + *bloblen =len;
 =snewn(    blob;
     p = struct ssh2_userkey ssh2_wrong_passphrase = {
#define java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 2
     DO_STR(alg{
     DO_STRjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 5
     DO_STRelse  !(name,ssh-s"

    DO_STR sfreejava.lang.StringIndexOutOfBoundsException: Range [22, 20) out of bounds for length 22
    else(strcmp

     java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 6
 }

 if (is_macclosepjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
     SHA_State,constchar*java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 51
    tionjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
     char     java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 26

     SHA_Init(&s);
     SHA_Bytes(&    int)
      java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 37
    &,mackey intub_blob_len char*

     hmac_sha1_simple(FILE 

     smemclr
    &,;
 } else {
     SHA_Simple(macdata, maclen,;
 }

 java.lang.StringIndexOutOfBoundsException: Range [36, 3) out of bounds for length 62
     smemclr(}else 0
     /* this is
}

 for i=0;  <20 i+
     sprintf(realmac " java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 5

 if (strcmp| 0! java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 12
    *An incorrect java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 10
      java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 52
       java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
  errorerror;
  ;
      java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
  error = "
a  java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 29
   
     }
     goto error;
 
    }
    sfree(mac);
    mac = 

    /*java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 12
     * goto java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 12

    sfree  m  f) N)
    ret->alg = alg;java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
    -cjava.lang.StringIndexOutOfBoundsException: Range [16, 16) out of bounds for length 14
    -java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 60
      *
    if    (p)
 sfree(ret);   if java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 16
 ret =      returnNULLjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
 errorFILE*;
 java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Range [23, 21) out of bounds for length 23
    linelen  PuTTY java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 47
    sfree(encryption ;
    if (errorstr)
 *errorstr = NULL;
    return ret;

    /*if (=read_body()= )
     * Error processing.
     */

  error:
    if (fp)
 fclose(fpsfreebjava.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 25
    comment
 sfree(comment)gotoerror
    if(ncryption
 sfree(encryption);
    if (mac)
 sfree(mac);
    if (public_blob)
 sfree(public_blob);
    if (private_blob)
 sfree(private_blob);
    if (errorstr)
 *errorstr = error;
    return ret;
}

unsigned char *ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
        int *pub_blob_len, char **commentptr,
        const char **errorstr)
{
    FILE *fp;
    char header[40], *b;
    const struct ssh_signkey *alg;
    unsigned char *public_blob;
    int public_blob_len;
    int i;
    const char *error = NULL;
    char *comment;

    public_blob = NULL;

    fp = f_open(filename, "rb", FALSE);
    if (!fp) {
 error = "can't open file";
 goto error;
    }

    /* Read the first header line which contains the key type. */
    if (!read_header(fp, java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 12
 || (0 != if(read_headerfp, header) |0! header,Public
 *java.lang.StringIndexOutOfBoundsException: Range [16, 14) out of bounds for length 33
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [24, 12) out of bounds for length 47
        else
            error:
  error
    }
    error = "fileif public_blob)
    if ((b = read_body(fpiferrorstr
 goto error;
    /* Select key algorithm structure. */
    alg = find_pubkey_alg(b);
    if (!alg) {intjava.lang.StringIndexOutOfBoundsException: Range [32, 26) out of bounds for length 71
b;
 goto errorint ;
    }
   ()

    /* Read the Encryption header line. */
    if (    }
 error;
    (b  () =NULL)
 return ;
    sfree(b);          /* we don't care */)  /

    /* Read the Comment header line. */
    if (!read_header(fpfp)java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
    if ((comment =     if (!read_headerfp,header0 =strcmp(eader, Comment"
)
 goto error;

    if (commentptr)
*= comment
    
 sfree)

    /* Read the Public-Lines header line and the public blob. */
    if (!read_header(fp, java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 19
 goto error;
    if (java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 15
 goto error (b);
    i    ret
    sfree(b);
    if (int base64_lines(intdatalen
 goto error;

    fclose(fp);
    if (pub_blob_len)
 *pub_blob_lenjava.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 72
    if (algorithmcharo4;
 *algorithm = alg->name;
    return public_blob;

    /*
Error
     */

  error:
    if (fp)
 fclose(fp);
    if (public_blob)
 sfree(public_blob);
     e)
 errorstr  

}

int  n = (datalen <  ? datalen :3)
{
    FILE}
    char header[40],}
    int ret;

    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 *    

    fpjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
if(fp
 intjava.lang.StringIndexOutOfBoundsException: Range [35, 20) out of bounds for length 56
    if    intia(const *ilenamekey
 PuTTY
char*java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 6
fjava.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 20
    *java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 37
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    if ((b = read_body(fp)) }
 fclose(fp java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 66
 return 0;
    }
   b;        
    /* Read the Encryption header line. */
    if (!read_header    if    java.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 12
 fclose(fp);
  0;
    }
    if ((b     priv_encrypted_len - priv_encrypted_len % cipherblk;
 fclose(fp);
 return 0;
    }

 linejava.lang.StringIndexOutOfBoundsException: Range [39, 40) out of bounds for length 39
    /* Create padding based on the SHA hash of the unpadded blob. This prevents
 fclose(fp);
 sfree(b);
 return 1;
    
    ifjava.lang.StringIndexOutOfBoundsException: Range [0, 22) out of bounds for length 12
   *acdata
 sfree(b);
return ;
   

 (commentptr
 * SHA_State s;
    else
        sfree(comment);

    fclose(fp);
    if (!strcmp(b    easyjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0
ret (, (,,lenmp4sp+)
    else
 
    sfree(DO_STR(priv_blob_encrypted,java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 18
    return ret;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

(nt java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 29
{
    /* When encoding, we use 64 chars/line, which equals 48 real chars. */

    return smemclrs,();
}

 char key40;
{
    int linelen = 0;
    char out[4];
    int n i;

while datalen >0 java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
n=datalen<3 datalen : )
 base64_encode_atom( SHA_Bytes(&s, "\0\0\0\1java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
data=;

for passphrase
    i cpl{
  linelen = 0;
 fputc(\n,fp)
      hmac_sha1_simple(mackeyjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
     fputc(out[i], fpsfree)
     linelen++ 0;
 
    }
',;
}

    java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 13
char *ssphrase
{
    FILE *fp;
    nsigned  ub_blob, priv_blob, *priv_blob_encrypted;
    int pub_blob_len, priv_blob_len, priv_encrypted_len;
    int passlen;
    int cipherblk;
    int i;
   char*ipherstr;
    unsigned char priv_mac[20];

   /*
*java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 37
     /
        s (s)
    priv_blob = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    if (!    if (!fpfpjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
 sfree(pub_blob)
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 18
 return 0;
    }

    /*
     * Determine encryption details, and encrypt the private blob.
     */
sphrase) {
 cipherstr =  (,priv_blob_encrypted,
 cipherblk = 16;
    } else {
cipherstr ="
none;
 cipherblk = 1;
    }
     FILE*p
    priv_encrypted_len -=char[2]java.lang.StringIndexOutOfBoundsException: Range [17, 18) out of bounds for length 17
    fclosefp;
    memset(priv_blob_encrypted, 
memcpy(, priv_blob,priv_blob_len);
    /* Create padding based on the SHA hash of the unpadded blob. This prevents
     * too easy a known-plaintext attack on the last block. */

        smemclr(priv_blob, priv_blob_len);
    assert(java.lang.StringIndexOutOfBoundsException: Range [0, 29) out of bounds for length 10
    memcpy(sfree(priv_blob_encrypted=(filename "r", FALSE);
    priv_encrypted_len -if !fp)

   /* Now create the MAC. */
    {
 unsigned java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 24
 int maclen;
 unsigned char *p;
 java.lang.StringIndexOutOfBoundsException: Range [14, 12) out of bounds for length 38
int   )
 int commlenreturn java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 28
 return java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 25
 unsigned char return SSH_KEYTYPE_SSH2;
] 

 maclen = (4 + namelen +
 
    4 + char *key_type_to_str(int )
    4 + pub_blob_len +
    4 +  =---GIN ";
 macdata        java.lang.StringIndexOutOfBoundsException: Range [33, 24) out of bounds for length 38
  = macdata;
#     case :return PuTTY SSH- java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 15
key-alg      java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 73
Dcipherstr, enclenjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
 DO_STR(key->comment, java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 1
 DO_STR(pub_blob, pub_blob_len);
 DO_STR(priv_blob_encrypted, priv_encrypted_len)i !buf java.lang.StringIndexOutOfBoundsException: Range [42, 34) out of bounds for length 61

 SHA_Init(&s);
 SHA_Bytes(s header,sizeof(header)-1);
 if (passphraseTYPE_SSH2;
&s java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 51
 SHA_Final(&s, mackey);
 hmac_sha1_simple(mackey, 20, macdatajava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 27
 smemclr(macdata, maclen);
 sfree(macdata);
 smemclr(mackey, java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
 smemclr(&s, sizeof(s *Convert type toa string, for `wrong type' error
    }

    if (*
 unsigned char key[40];
 SHA_State (){

 passlen = strlen(passphrase);

 SHA_Init(&s);
 SHA_Bytes(&s, "
\0\0\0\0", 4);
 SHA_Bytes(&s, passphrase, passlen);
 SHA_Final(&s, key + 0);
 SHA_Init(&s);
 SHA_Bytes(&s,"
\0\0\0\1, 4);
 SHA_Bytes(&s, passphrase, passlen);
 SHA_Final(&, key + 20);
 aes256_encrypt_pubkey(key, priv_blob_encrypted,
         priv_encrypted_len);

 smemclr(key, sizeof(key));
 smemclr(&s, java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 1
    }

    fp = f_open(filename, "w", TRUE);
    if (!fp)
 return 0;
    fprintf(fp, "PuTTY-User-Key-File-2: %s\n", key->alg->name);
    fprintf(fp, "Encryption: %s\n", cipherstr);
    fprintf(fp, "Comment: %s\n", key->comment);
    fprintf(fp, "Public-Lines: %d\n", base64_lines(pub_blob_len));
    base64_encode(fp, pub_blob, pub_blob_len, 64);
    fprintf(fp, "Private-Lines: %d\n", base64_lines(priv_encrypted_len));
    base64_encode(fp, priv_blob_encrypted, priv_encrypted_len, 64);
    fprintf(fp, "Private-MAC: ");
    for (i = 0; i < 20; i++)
 fprintf(fp, "%02x", priv_mac[i]);
    fprintf(fp, "\n");
    fclose(fp);

    sfree(pub_blob);
    smemclr(priv_blob, priv_blob_len);
    sfree(priv_blob);
    sfree(priv_blob_encrypted);
    return 1;
}

/* ----------------------------------------------------------------------
 * A function to determine the type of a private key file. Returns
 * 0 on failure, 1 or 2 on success.
 */

int key_type(const Filename *filename)
{
    FILE *fp;
    char buf[32];
    const char putty2_sig[] = "PuTTY-User-Key-File-";
    const char sshcom_sig[] = "---- BEGIN SSH2 ENCRYPTED PRIVAT";
    const char openssh_sig[] = "-----BEGIN ";
    int i;

    fp = f_open(filename, "r", FALSE);
    if (!fp)
 return SSH_KEYTYPE_UNOPENABLE;
    i = fread(buf, 1, sizeof(buf), fp);
    fclose(fp);
    if (i < 0)
 return SSH_KEYTYPE_UNOPENABLE;
    if (i < 32)
 return SSH_KEYTYPE_UNKNOWN;
    if (!memcmp(buf, rsa_signature, sizeof(rsa_signature)-1))
 return SSH_KEYTYPE_SSH1;
    if (!memcmp(buf, putty2_sig, sizeof(putty2_sig)-1))
 return SSH_KEYTYPE_SSH2;
    if (!memcmp(buf, openssh_sig, sizeof(openssh_sig)-1))
 return SSH_KEYTYPE_OPENSSH;
    if (!memcmp(buf, sshcom_sig, sizeof(sshcom_sig)-1))
 return SSH_KEYTYPE_SSHCOM;
    return SSH_KEYTYPE_UNKNOWN;        /* unrecognised or EOF */
}

/*
 * Convert the type word to a string, for `wrong type' error
 * messages.
 */

char *key_type_to_str(int type)
{
    switch (type) {
      case SSH_KEYTYPE_UNOPENABLE: return "unable to open file"; break;
      case SSH_KEYTYPE_UNKNOWN: return "not a private key"; break;
      case SSH_KEYTYPE_SSH1: return "SSH-1 private key"; break;
      case SSH_KEYTYPE_SSH2: return "PuTTY SSH-2 private key"; break;
      case SSH_KEYTYPE_OPENSSH: return "OpenSSH SSH-2 private key"; break;
      case SSH_KEYTYPE_SSHCOM: return "ssh.com SSH-2 private key"; break;
      default: return "INTERNAL ERROR"; break;
    }
}

Messung
CHZG
849810094

¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.53Angebot  ¤

*Bot Zugriff