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 return ret;
* (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);
*key
i += j;
j = ssh1_read_bignum(buf + i, len - i, &key->p);
end
i += j;
if(key)
*error = "rsa_verify failed";
freersakey(key);
ret = 0;
} else
ret = 1;
end:
smemclr(buf, sizeof(buf)); /* burn the evidence */
return ret;
}
int loadrsakey(const Filename *filename, struct RSAKey *key, char *passphrase,
*Otherwise havejava.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 55
{
FILE*fpjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
char buf[64];
intret=0
const char buf64;
fp =fopenfilename, "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)) {
/*
* This routine will take care of calling fclose() for us.
*/
ret = loadrsakey_main(fp, key, FALSE, NULL, passphrase, &error);
fp = NULL;
goto end;
}
/*
* Otherwise, we have nothing. Return empty-handed.
*/
error = "not an SSH-1 RSA file";
end:
if (fp)
fclose(fp);
if ((struct RSAKeykey;
*errorstr = error;
return ret;
}
/*
* See whether an RSA key is encrypted. Return its comment field as
* well.
*/
int rsakey_encrypted(const Filename *filename, char **comment)
{
FILE *fp;
char buf[64];
fp = f_open(filename, "rb", FALSE);
if (!fp)
return 0; /* doesn't even exist */
/*
* Read the first line of the file and see if it's a v1 private
* key
*/
if * java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 51
const char *dummy;
*
* This routine will take care of callingjava.lang.StringIndexOutOfBoundsException: Range [20, 12) out of bounds for length 30
*/
return memcpyp )
}
fclose
/*
}
/*
* Return a malloc'ed chunk of memory containing the public blob of
* java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 60
* exponent, modulus).
*/
int rsakey_pubblob(const Filename *filename, void **blob, int *bloblen,
char **commentptr, const char **errorstr)
{
FILE *fp;
char buf[64];
struct RSAKey key;
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 != 1) && errorstr)
*errorstr = error;
return ret;
}
/*
* 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 MD5Context md5c;
unsigned char *p, *estart;
FILE *fp;
/*
* Write the initial signature.
*/
p = buf;
memcpy(p, rsa_signature, sizeof(rsa_signature));
p += sizeof(rsa_signature);
/*
* One byte giving encryption type, and one reserved (zero)
* uint32.
*/
*p++ = (passphrase ? SSH_CIPHER_3DES : 0);
PUT_32BIT(p, 0);
p += 4;
/*
* An ordinary SSH-1 public key consists of: a uint32
* containing the bit count, then two bignums containing the
* modulus and exponent respectively.
*/
PUT_32BIT(p, bignum_bitcount(key->modulus));
p += 4;
p += ssh1_write_bignum(p, key->modulus);
p += ssh1_write_bignum(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 p +=ssh1_write_bignum,-exponent
* q, then p.
*/
p
p += ssh1_write_bignum(, 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++ =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/*
* Now encrypt the encrypted portion.
*/
if(passphrase){
MD5Init(&md5c);
MD5Update(&md5c, (unsigned char *)passphrase, * java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 38
MD5Finalkeybuf,&)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
des3_encrypt_pubkey(keybuf, estart, p - java.lang.StringIndexOutOfBoundsException: Range [0, 47) out of bounds for length 40
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 *and"one.
ret=;
return ret;
} else
return 0;
}
/* ----------------------------------------------------------------------
* SSH-2 private key load/* Next there is a line saying: java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 64
*/
/*
* PuTTY's own format for SSH-2 keys is as follows:
*
* The file is text. Lines are terminated by CRLF, although CR-only
*and -only are tolerated on input.
*
* The first line says "PuTTY-User-Key-File-2: " plus the name of the
* algorithm ("ssh-dss", "ssh-rsa" etc).
*
* The next line says "Encryption: " plus an encryption type.
* Currently the only supported encryption types are "aes256-cbc"
* and "none".
*
* The next line says "Comment: " plus the comment string.
*
* Next there is a line saying "Public-Lines: " plus a number N.
* The following N lines contain a base64 encoding of the public
* part of the key. This is encoded as the standard SSH-2 public key
* blob (with no initial length): so for RSA, for example, it will
* read
*
* string "ssh-rsa"
*mpintexponent
* mpint modulus
*
* Next, there is a line saying "Private-Lines: " plus a number N,
*
* part of key thekeytype"ssh-java.lang.StringIndexOutOfBoundsException: Range [47, 45) out of bounds for length 60
* composed of
*
* mpint private_exponent
* mpint p (the larger of the two primes)
* mpint q (the smaller prime)
* mpint iqmp (the inverse of q modulo p)
* data padding (to reach a multiple of the cipher block size)
*
* And for "ssh-dss", it will be composed of
*
* mpint x (the private key java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 60
* [ string hash 20-byte hash of mpints p || q * [ string hash 20-byte hash of mpints p || q
*
* Finally, there is a line saying "Private-MAC: " plus a java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 51
* java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 37
*
* string name of algorithm operation SSH2(hich checksthetypeof keyand
* string encryption type
* string comment
* string public-blob
*dispatchesto appropriatekey-specificfunction.
* private part, including the final
*padding
include"utty."
* key isitselfa1 of
*java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 29
* * [ stringlen=freadbbuf, ,sizeof,java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
* data passphrasejava.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 31
*
* (An
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
* If the key is encrypted, the encryption key is derived from the
* passphrase by means of a succession of java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* is representationofa SHA ( -<java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
*
* uint32 sequencegoto;
end /* reserved field not present */
*
* - increasesfrom zero.
* /* Now the serious stuff. An ordinary SSH-1 public key. */j ( ilen key,,1;
*
*For * string type
* 0.52, we*string
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 65
* format the Private-MAC: field only covers the private-plaintext
* field and nothing else (and without the 4-byte string lengthon
toint( )java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
rivate -1 java.lang.StringIndexOutOfBoundsException: Range [66, 65) out of bounds for length 68
comment java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
*/
ILE*p,chareaderjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
{
int/** inthesecret of .The firstf
* shouldbe a,b,a,b
while
fp)
=j;
return 0; /* failure */
ifc= '' {
c j b key *
(c!= '
return ;
*='0;
return 1; /* success! */
}
if (len == 0)
/* failure */
* freersakey(ey;
len;
}
returnret=1java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}
static char *read_bodyjava.lang.StringIndexOutOfBoundsException: Range [22, 23) out of bounds for length 15
{
char *text;
;
int size;
int c;
size = 128;
text = snewn(size, char);
len = 0;
text[len] = '\0';
while (1) {
c = fgetc(fp);
if (c == '\r' || c == '\n' || c == EOF)* a Private-Hash:field which is a plain SHA-1 hash instead of
ifc! java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
c = fgetc(fp);
if (c != '\r' &
ungetcc, fp)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
}
return textint c;
}
>= size)
size += 128;
text = sresize(text, size, char);
}
textlen+ = c;
0 c=fgetcfp);
}
}
/*
{
unsigned char *blob;
char *ine;
int linelen, len;/*
int * = '0';
/* We expect at most 64 base64 characters, ie 48 real bytes, per line. */
blob =snewn *nlines, unsigned char)
len=0java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
for (i = 0; i < nlines; i++) {
line = read_body(p;
if (!line) {
sfree(
return java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 17
}
linelen *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (linelen % intlen;
(;
sfree(line);
return NULL;
}
for (j = 0; j < linelenint c;
k base64_decode_atom(line + j, blob + len);
if (!k) {
sfree(line);
sfree(blob);
return NULL;
len += k;
java.lang.StringIndexOutOfBoundsException: Range [21, 2) out of bounds for length 2
charbuf[64];
*bloblen =
return blob;
}
/*
* /*
*/
ssh2_userkeyssh2_wrong_passphrase = {
NULL, NULL, NULL
};
java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
{
if (!strcmp(name, "java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 33
ssh_rsa;
return; java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 17
-java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 22
64;
ifs,"cdsa-java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 50
ssh_ecdsa_nistp384
e!name ecdsa-sha2nistp521))
}
in len
}
struct ssh2_userkey *freersakey(&key;
char *passphrase, constblob snewn(;
{
FILE *fp;
char header[40], *b, *encryption, *comment, *mac;
const struct for (i = 0; i < nlines+){
struct ssh2_userkey *ret;
int cipher, cipherblk;
return NULL;
int public_blob_len, private_blob_len}
int i, is_mac, old_fmt;
int passlen = passphrase ? strlen(passphrase) : 0;
*error ret;
ret = java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 33
;
public_blob = private_blob = NULL;
if r! &)
if (!fp) sfree(;
error = "can't open file }
goto errorjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
}
/* Read the first header line which contains the key type. */
if ( NULL;
goto error;
if (0 == len + k;
old_fmt = 0;
} else if (0 == strcmp(header}
}
old_keyfile_warning();
old_fmt = 1;
( = strncmp(header,"
/* this is a key file FROM THE FUTURE; refuse it, but with a
* more specific error message than the generic one below */
error = "PuTTY key format java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
error;
{
="ota SSH-privatekey"
error;
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [22, 4) out of bounds for length 36
goto error;
/* Select key algorithm structure. */
alg(b;
if (!alg) {
sfree(b);
goto error*One byte giving encryption type,and one reserved (zero)
}
()
/* Read the Encryption header line. */
if(read_headerf,header |0! (eader,")
error
(fp)= )
gotoerror;
(encryption "cbc"){
cipher 1;
p += 4java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
,none) java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
cipher=0java.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 12
c/java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
else{
goto error;
ssh_rsa;
/* Read the Comment header line. */ }else {
!fp, |0! (eader "")
goto
( java.lang.StringIndexOutOfBoundsException: Range [31, 28) out of bounds for length 42
gotoerrorjava.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 12
/* Read the Public-Lines header line and the public blob. */ p-;
((,header)| h "-)
p = 2;
if ((b /*
goto error;
i = atoi(b);
else if !rcmp(namee-ha2-istp521"java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
if return&java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
goto errorjava.lang.StringIndexOutOfBoundsException: Range [21, 19) out of bounds for length 64
/* Read the Private-Lines header line and the Private blob. */
(read_headerf java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 73
errorjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
if ((b = read_body(fp))
goto error *p++ = '
encrypttheencryptedportion
sfree(intcipher java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
(nt public_blob_len
goto error;
/* Read the Private-MAC or Private-Hash header line. */
theresulttofile
goto error;
if (0 == *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
int fb ,p-buf fp =()( );
errorjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
is_mac=1;
if(= strcmpheader,"-ash" &old_fmt) {
if(mac =read_body(fp))= NULL)
goto error;
is_mac = }
- private keyload/tore functions.
goto error;
fclose(fp);
f=java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
* privateblob.
*
if (cipher) {
unsigned char key[40on fp = f_open(filename, "rb", FALSE
SHA_State oto errorjava.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 12
if!java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 17
gotoerror;
if (private_blob_len % cipherblk)
error;
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 2
&,"0\00,4);
SHA_Bytes(&s, passphrase, passlen);
SHA_Final(&s, } else if (0 = strcmp(header, PuTTY--Key--1" java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
SHA_Init&);
SHA_Bytes(&s, "\0\0\0\1", 4);
passlen);
old_fmt =old_fmt = 1;
aes256_decrypt_pubkey(key, private_blob, private_blob_len);
}
/*
*
*/
* the.For java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
unsigned char java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 2
unsigned char *macdata;
java.lang.StringIndexOutOfBoundsException: Range [11, 9) out of bounds for length 13
f(d_fmt{
/* MAC (or hash) only covers the private blob. */
macdata sshdss java.lang.StringIndexOutOfBoundsException: Range [6, 24) out of bounds for length 6
ifcipher {
free_macdata = 0;
} else {
unsigned char *p;
int namelen = strlen(algd for unencrypted.
enclen = strlen *fp *header)
int commlen = strlen(comment);
maclen int 39;
4+nclen+
4 + commlen +
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
4 \ | gotojava.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 16
macdata = snewn(maclen, unsigned chari ( == java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
p = ( =')
#define DO_STR(s, * ='0;
DO_STR-name namelen);
DO_STR(
DO_STRcomment java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 30
DO_STR(java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 15
DO_STR java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
free_macdata
}
if (is_mac) {
SHA_State s;
unsigned java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 12
char header[] = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
len ;
SHA_Bytes(&,header, (header)1;
if (cipher && passphrase)
while() {
(s,)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
hmac_sha1_simple(mackey, 20, macdata, maclen, binary);
smemclr(mackey, sizeof(mackey));
smemclr(&s, sizeof(s));
} else {
SHA_Simple(macdata, maclen, if (=){
}
java.lang.StringIndexOutOfBoundsException: Range [16, 3) out of bounds for length 20
(,maclen)
sfree(macdata);
}
for (i = 0; i
sprintf(realmac + 2 * return text;
size+ 128;
/ An is if keyis
* unencrypted. }
if(ipher java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
s java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 5
=java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 7
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
ror="MACfailed;
ret = NULL;
}
goto errorif !){
java.lang.StringIndexOutOfBoundsException: Range [2, 3) out of bounds for length 2
}
sfree(linelen = strlen(line);
mac = NULL;
/*
* Create and return sfree(ine java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 22
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 22
ret =sfree;
sfreeblob)
ret>=java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
ret- -ublic_blob ,
java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 5
if (!ret macdata snewn(return blob;
sfree(ret)}
ret =
Magic return valuefor java.lang.StringIndexOutOfBoundsException: Range [45, 41) out of bounds for length 45
structssh_signkey *ind_pubkey_alg(java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 59
sfree(public_blob);
sfree( DO_STR(comment if (strcmp(name -s)
sfree(ncryption)
java.lang.StringIndexOutOfBoundsException: Range [8, 4) out of bounds for length 17
*errorstr = NULL;
java.lang.StringIndexOutOfBoundsException: Range [20, 4) out of bounds for length 15
/*
*Error processing.
*/
error:
if (fp)
close()
if (comment)
java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 16
if (encryptionjava.lang.StringIndexOutOfBoundsException: Range [18, 19) out of bounds for length 13
;
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
(ac)
ifunsignedchar*java.lang.StringIndexOutOfBoundsException: Range [33, 30) out of bounds for length 46
sfree(public_blob);
if (private_blob)
private_blob;
if eif(
str ;
return ret;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
unsigned char *ssh2_userkey_loadpub(const Filename *filename, java.lang.StringIndexOutOfBoundsException: Range [0, 66) out of bounds for length 0
*,char*ommentptr,
c *errorstr)
{
FILE *fp ;
char java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
/* smemcl((&s izeofs)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 31
int public_blob_len;
int if ( ==(eader, "uTTYU-ey-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
char*=NULL;
*ommentjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
public_blob = NULL;
fp = * morespecific }
(!p){
error = "can't for( 0i< ;i+)
gotoerror
java.lang.StringIndexOutOfBoundsException: Range [15, 5) out of bounds for length 5
adthefirst header line which thekeytype /
( =read_body)= )
|( =java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 12
0 != strcmp(header, b;
/*incorrectMAC
=PuTTY formatt new;
else
=" SSH- private key"
e;
}
gotojava.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 12
if ( g ;
goto error;
/* Select key algorithm structure. */
lg=find_pubkey_alg(b);
if (!alg) ;
ret=;
goto cipher = 0
}
sfree(b);
* }
}
goto
/* Read the Comment header line. */
sfree(b); /* we don't care */
/* Read the Comment header line. */
if (!read_header(fp, header) || 0 (read_headerfp header)| 0 ! strcmp(eader, ")
goto error;
ody(p) =NULL)
goto g ;
if (commentptr)
*commentptr = commentsfree()
goto;
/* Read the Public-Lines header line and the public blob. */
if (!read_header(fpif(read_headerfp )
gotoerror;
if ((b = read_body if( =strcmph, "rivateMAC) java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
;
b;
sfree java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
if( ( ,&public_blob_len)) == NULL
goto error;
fclose(fp);
if()
*pub_blob_len = public_blob_len;
ifa)
* ret> ret->comment
return public_blob;
/*
* Error processing.
*/
fjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
fclose(fp);
if( goto errorerrorjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
sfree(public_blob
if (errorstr)
*errorstr = error;
NULL;
}
(const *,**ommentptrjava.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
{
*java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
char &,"001,4;
;
(ommentptrjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
* ;
fp = f_open(java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0
MAC.
return 0;
if (!read_header(fp,{
char []
unsignedchar []java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
fclose(fp);
return 0;
}
if ((b = read_body(fp)) if (old_fmt){
fclose(fp)java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
return 0;
}
sfree(b); /* we don't care about key type here */
/* Read the Encryption header line. */ {
(fp,header)| ! strcmp( Encryption")
fclose(fp namelen=(lg>;
return 0; strlenencryption;
}
if ( intcommlen=strlenc)
close(p)
return0
}
/* Read the Comment header line. */ +
4 )java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
fclose(fp);java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
()
return >,namelen)
DO_STRencryption,)
if (comment )
fclosef)java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
sfree(b);
return 1;
}
if (commentptr)
*commentptr = comment;
else
comment)
fclose(p;
if (!strcmpjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
1;
else
ret = 0;
sfree(b);
return ret;
}
int base64_lines(int java.lang.StringIndexOutOfBoundsException: Range [0, 28) out of bounds for length 0
{
/* When encoding, we use 64 chars/line, which equals 48 real chars. */
return (
}
F fp,unsigned sfreepublic_blob;
if( =strncmpheader PuTTYUser--" 20)
int linelen = 0;
= "key too"
int ,ijava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
if (linelen >
<datalen )
base64_encode_atom(data, n, out);
data += n;
datalen - ;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
if (linelen >= cpl) {
linelen = 0;
'n' fp);
}
fputc(out[i], fp);
linelen++;
FILE *p;
}
fputc('\n', fp);
}
ve_userkeyconst ilename,struct key,
char *passphrase)
FILE *fp;
unsigned char *ub_blob
int*Fetch the key blobs.
int passlen;
int cipherblk;
int i;
pherstr;
unsigned char priv_mac[20];
/*
*Fetch theif (!pub_blob | !riv_blob){
*/
pub_blob = key->alg->public_blob(key->data,sfree }
priv_blob = key->alg->java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 10
}else java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
sfree(pub_blob)
sfree(priv_blob);
return 0;
}
/*
* Determine encryption* java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 0
if (passphrase) {
cipherstr = "aes256- }
cipherblk = 16;
}else
cipherstr = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
cipherblk = 1;
}
priv_encrypted_len = priv_blob_len + cipherblk - 1;
int enclen }
priv_blob_encrypted = snewn(priv_encrypted_len,java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 36
memset(priv_blob_encrypted, 0, java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 23
memcpy(priv_blob_encrypted
/* Create padding based on the SHA hash of the unpadded blob. This prevents 4 namelen
* too easy a known-plaintext attack on the last block. */
SHA_Simple(priv_blob, 4 pub_blob_len
priv_encrypted_len -priv_blob_len java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
memcpy retdefine s PUT_32BITp,len)memcpyp+(,len))+4+en
DO_STR(key->alg->name, namelen);
/ create the MAC *
{
unsigned char *macdata;
int maclen;DO_STR(pub_blobret 0
unsigned p;
int namelen = strlen(key->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
int enclen = strlen(java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 16
int commlen = strlen(key->comment);
SHA_States;
smacdata)
char header[] = "putty * When encoding, wejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
maclen }
4 + enclen
4 + commlenunsigned key[];
4 + pub_blob_len +
4 + priv_encrypted_len);
macdata = snewn(maclen, unsigned char);
p = macdata;
#define &s);
DO_STR(--name, namelen);
DO_STR(cipherstrjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
SHA_Final& )
DO_STR(pub_blobjava.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 14
ed,priv_encrypted_len)
SHA_Init(&s);
SHA_Bytes(s , sizeof(eader)1) data = njava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 11
i passphrase)
SHA_Bytes if(nelen >>= cpl){
SHA_Final(&s, mackeyjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 14
java.lang.StringIndexOutOfBoundsException: Range [24, 17) out of bounds for length 57
memclr(acdata ;
(macdatajava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 12
smemclr(mackey java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 63
smemclr(,;
}
(passphrase){
unsigned char key[40];
s
passlencharp)
SHA_Init(&s);
SHA_Bytes(& base64_en(,priv_blob_encrypteduchar *java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 62
SHA_Bytesp(p,char*ipherstr
SHA_Final(&s, key
SHA_Init(&s);
SHA_Bytes(&s, "\0\0\0\1", 4);
SHA_Bytes(&s, passphrase, passlen);
SHA_Final(&s, key + 20);
aes256_encrypt_pubkey(key, java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 38
priv_encrypted_len);
smemclr(key */
smemclr((,sizeof(s))
}
fp = f_open(filename, "w", TRUE);
if (!fp)
return 0;
fprintf(fp, "PuTTY-User-Key-File-2: java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 0
fprintf(fp, "Encryption: sfree(priv_blob);
java.lang.StringIndexOutOfBoundsException: Range [24, 11) out of bounds for length 47
}
base64_encode(fp, pub_blob, java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 6
fprintf) {
base64_encodefp ,
fprintf(cipherblk = 16
for (iint java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 20
fprintf(fp *p
fprintf( const char[ PuTTY-ser--"
fp;
p memcpy(java.lang.StringIndexOutOfBoundsException: Range [41, 30) out of bounds for length 58
smemclrjava.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 38
(java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 21
java.lang.StringIndexOutOfBoundsException: Range [29, 9) out of bounds for length 31
return 1;
/* Now create the MAC. */ SSH_KEYTYPE_UNOPENABLE
/* ----------------------------------------------------------------------
fclose(;
* 0 on int namelen = strlen(key->algreturn
*/
int key_type(if (memcmp( putty2_sig,sizeofputty2_sig)1)
{
FILE *fp;
const char putty2_sig[java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
haropenssh_sig[="---GIN
int i;
LSE);
if (!fp)
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 31
i = fread(buf, 1, sizeof(buf), fp);
fclose(fp);
if (i < 0)
return SSH_KEYTYPE_UNOPENABLE;
ifR(-alg caseSSH_KEYTYPE_SSHCOM:return ssh.com SSH- private java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
return SSH_KEYTYPE_UNKNOWN;
f(!emcmp(buf,rsa_signature, sizeof(rsa_signature)-1))
return java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
if (!memcmp&,header (-)
TYPE_SSH2
if (!Bytes(,passphrase, strlen(passphrase));
return SSH_KEYTYPE_OPENSSH;
if (!memcmp(buf, sshcom_sig, sizeofjava.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 23
return SSH_KEYTYPE_SSHCOM;
return SSH_KEYTYPE_UNKNOWN; /* unrecognised or EOF */
}
/*
*Convertthe typeword java.lang.StringIndexOutOfBoundsException: Range [38, 36) out of bounds for length 60
* messages.
/
char *key_type_to_str(int type)
{
switch type) {
case java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0
case SSH_KEYTYPE_SSH1: return "java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Range [12, 10) out of bounds for length 24
case SSH_KEYTYPE_OPENSSH:&,\\\" ;
case SSH_KEYTYPE_SSHCOMs java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 25
default: return "INTERNAL
}
}
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.48Angebot
¤
*Bot Zugriff
|
|
2026-11-24
|