-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add certificate builder and test ED25519 signed by RSA
- Loading branch information
1 parent
cdde67a
commit f1e2a30
Showing
5 changed files
with
70 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
""" | ||
.. module: bless.ssh.certificates.ed25519_certificate_builder | ||
:copyright: (c) 2016 by Netflix Inc., see AUTHORS for more | ||
:license: Apache, see LICENSE for more details. | ||
""" | ||
from bless.ssh.certificates.ssh_certificate_builder import \ | ||
SSHCertificateBuilder, SSHCertifiedKeyType | ||
from bless.ssh.protocol.ssh_protocol import pack_ssh_string | ||
|
||
|
||
class ED25519CertificateBuilder(SSHCertificateBuilder): | ||
def __init__(self, ca, cert_type, ssh_public_key_ed25519): | ||
""" | ||
Produces an SSH certificate for ED25519 public keys. | ||
:param ca: The SSHCertificateAuthority that will sign the certificate. The | ||
SSHCertificateAuthority type does not need to be the same type as the | ||
SSHCertificateBuilder. | ||
:param cert_type: The SSHCertificateType. Is this a User or Host certificate? Some of | ||
the SSH Certificate fields do not apply or have a slightly different meaning depending on | ||
the certificate type. | ||
See http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys | ||
:param ssh_public_key_ed25519: The ED25519PublicKey to issue a certificate for. | ||
""" | ||
super(ED25519CertificateBuilder, self).__init__(ca, cert_type) | ||
self.cert_key_type = SSHCertifiedKeyType.ED25519 | ||
self.ssh_public_key = ssh_public_key_ed25519 | ||
self.public_key_comment = ssh_public_key_ed25519.key_comment | ||
self.a = ssh_public_key_ed25519.a | ||
|
||
def _serialize_ssh_public_key(self): | ||
""" | ||
Serialize the Public Key into a string. This is not specified in | ||
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys | ||
but https://tools.ietf.org/id/draft-ietf-curdle-ssh-ed25519-02.html | ||
:return: The bytes that belong in the SSH Certificate between the nonce and the | ||
certificate serial number. | ||
""" | ||
public_key = pack_ssh_string(self.a) | ||
return public_key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,3 +51,7 @@ | |
|
||
SSH_CERT_CUSTOM_EXTENSIONS = base64.b64decode( | ||
'AAAAFnBlcm1pdC1wb3J0LWZvcndhcmRpbmcAAAAAAAAACnBlcm1pdC1wdHkAAAAAAAAADnBlcm1pdC11c2VyLXJjAAAAAA==') | ||
|
||
# ssh-keygen -s test-rsa-ca -I "ssh-keygen -s test-rsa-ca -I '' test-ed25519-user-all-defaults.pub" test-ed25519-user-all-defaults.pub | ||
ED25519_USER_CERT_DEFAULTS = '[email protected] AAAAIHNzaC1lZDI1NTE5LWNlcnQtdjAxQG9wZW5zc2guY29tAAAAINa9ZmyR9YBRNfC464IJE2AlDa0xU02tVbY37AlRr79/AAAAIG7+cAbT4EFSPs87oS4kDYStQ0KL0xwHWqVSZ2bYHIApAAAAAAAAAAAAAAABAAAAQnNzaC1rZXlnZW4gLXMgdGVzdC1yc2EtY2EgLUkgJycgdGVzdC1lZDI1NTE5LXVzZXItYWxsLWRlZmF1bHRzLnB1YgAAAAAAAAAAAAAAAP//////////AAAAAAAAAIIAAAAVcG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Krb3OT8k0le/x4S2GttHMb9z006nZgyTUI4cniq+ZxwcL4l5/wzaXamQUsod/JRysEBZdLF88A50iCiSC+4NQUqquPBs76UmTpU+Lv3OEvVBwMil7Hxkzv8kqit2Xal0Ou9n/+CC1G9l/dpTO1TgaNtNERQT3rQOhkjqwmgN3wbh1sRkc1+zSenWsNrHkFBnVTJPxLwXbFeAvstDWDxTvNCpygsTfz/ejUnKfqZ1rAWfNRhzrSIz1D1+/GQbOdtM3xq3r6CVjVxE0KTLsdR1hyOd5SmszubE1UAkKWF7NRyHcgma/9hkOXc6a/4ylBcOj0yUFnjVq7Jb6C33ba0Ra6LnopZWUS7lr02dt7aYG/Qhd8OtJx7R+XiRYRnfsuJH+L18UxM34xqj9qlMPA5p1nUB2ZnklKyueLhrp0/thuWsdKCv4w66A8rOthbDtLip6TYtKwDDMBupq5ROoRHYXb6nYthHJYCX1QuDIzmoBjTlkWa7aVohggQWezYhGGo0owulURxkFNZBNi1Lc/aRuDs Test ED25519 User Key' | ||
ED25519_USER_CERT_DEFAULTS_KEY_ID = 'ssh-keygen -s test-rsa-ca -I \'\' test-ed25519-user-all-defaults.pub' |