Coder Social home page Coder Social logo

Comments (2)

codesoap avatar codesoap commented on July 4, 2024

It looks to me like the bug is not in age, but in golang.org/x/crypto/ssh. With this program you can reproduce the described error:

package main

import "golang.org/x/crypto/ssh"

// Generated with this command; password not empty!:
// ssh-keygen -t ed25519 -Z [email protected] -f key
var secretKey = `
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAAHWNoYWNoYTIwLXBvbHkxMzA1QG9wZW5zc2guY29tAAAABm
JjcnlwdAAAABgAAAAQpOLR3nv7KFNUrn9ETd8xLgAAABAAAAABAAAAMwAAAAtzc2gtZWQy
NTUxOQAAACDzMkP7oq1LPCZQ57/dfqPlhSXAQD4e+YShT8F6ePWQcQAAAJDN11o6u28HV4
1HdH3MIsiwysiD+nUNt0RGTO46nZzc/itKhUq3pgg+V1tN0tREeVkebp34nyPbmglDMsZm
YLHZJuDAJ/57J6YsZ0iZV8ZzY1u1Wf0RtsiujUAlr2K1vxdHROJIwAyosEvTgJ3o/FHap4
xPFxkRK/ZK/bI+BRvPO9dAEqo3fNPVW7RLVwLfi332ObUSUvnoihvTTaQ1oxqn
-----END OPENSSH PRIVATE KEY-----
`

func main() {
	_, err := ssh.ParseRawPrivateKey([]byte(secretKey))
	if err != nil {
		// Should be ssh.PassphraseMissingError, but is ssh.ParseError.
		panic(err)
	}
}

I think you should report the problem at https://github.com/golang/go/issues.

Narrowing down the problem

I have investigated some more and found some conditions under which the problem occurs:

The problem does not occur with keys generated like this:

  • ssh-keygen -f key -t ed25519 -Z 3des-cbc (with password)
  • ssh-keygen -f key -t ed25519 -Z aes128-cbc (with password)
  • ssh-keygen -f key -t ed25519 -Z aes192-cbc (with password)
  • ssh-keygen -f key -t ed25519 -Z aes256-cbc (with password)
  • ssh-keygen -f key -t ed25519 -Z aes128-ctr (with password)
  • ssh-keygen -f key -t ed25519 -Z aes192-ctr (with password)
  • ssh-keygen -f key -t ed25519 -Z aes256-ctr (with password)
  • ssh-keygen -f key -Z aes256-ctr (with password)
  • ssh-keygen -f key -Z aes256-ctr (without password)
  • ssh-keygen -f key -Z [email protected] (without password)
  • ssh-keygen -f key -Z [email protected] (without password)
  • ssh-keygen -f key -Z [email protected] (without password)

The problem does occur with keys generated like this:

It seems to me like the problem only occurs when using the ciphers [email protected], [email protected] and [email protected] and only when using a password protected key. The type of key seems to be irrelevant.

from age.

flotester avatar flotester commented on July 4, 2024

Great. I will raise the issue there. Thanks.

from age.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.