v1.0.3: handle multiple 0x00 pads
This commit is contained in:
		
							rodzic
							
								
									19274dfe1b
								
							
						
					
					
						commit
						72158cb60f
					
				@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "bluecrypt-ssh-to-jwk",
 | 
			
		||||
  "version": "1.0.2",
 | 
			
		||||
  "version": "1.0.3",
 | 
			
		||||
  "description": "SSH to JWK in < 150 lines of VanillaJS.",
 | 
			
		||||
  "homepage": "https://git.coolaj86.com/coolaj86/bluecrypt-ssh-to-jwk.js",
 | 
			
		||||
  "main": "ssh-to-jwk.js",
 | 
			
		||||
 | 
			
		||||
@ -94,8 +94,8 @@ SSH.parsePublicKey = function (ssh) {
 | 
			
		||||
  var y = els[2].slice(1 + len, 1 + len + len);
 | 
			
		||||
 | 
			
		||||
  // I don't think EC keys use 0x00 padding, but just in case
 | 
			
		||||
  if (0x00 === x[0]) { x = x.slice(1); }
 | 
			
		||||
  if (0x00 === y[0]) { y = y.slice(1); }
 | 
			
		||||
  while (0x00 === x[0]) { x = x.slice(1); }
 | 
			
		||||
  while (0x00 === y[0]) { y = y.slice(1); }
 | 
			
		||||
 | 
			
		||||
  ssh.jwk.x = Enc.bufToUrlBase64(x);
 | 
			
		||||
  ssh.jwk.y = Enc.bufToUrlBase64(y);
 | 
			
		||||
 | 
			
		||||
		Ładowanie…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user