PubKeyEncoding enum Null safety

Supported public key encodings.

This enumeration is used to indicate the format that was decoded, or to specify the desired format to the encode method in PublicKeyExt.

openSsh

OpenSSH public key format.

This is a proprietary encoding used by the OpenSSH implementation of SSH.

This encoding is a single-line of text, consisting of: a key-type, base-64 encoded data and an optional comment (all separated by a space). For example,

ssh-rsa AAAAB3NzaC1yc2EAAA...nqreXpeh039cotUTWJHyVOB user@example.com

sshPublicKey

SSH public key file format as defined by RFC 4716.

This encoding is sometimes referred to as the "SSH2 public key" format or the "new OpenSSH public key format".

This encoding starts with "---- BEGIN SSH2 PUBLIC KEY ----". For example,

---- BEGIN SSH2 PUBLIC KEY ----
Comment: "user@example.com"
AAAAB3NzaC1yc2EAAAADAQABAAABAQDYwd6O4Z+STMxTlFCPcN8VAq9ZNKvaQRYbsEDKK0
ydvTxdwt72xRo8supYX1vgDgRpYBhgDy8OPEMLDuk61sXRdbTITFW1B98rUsvvLEYHM4wJ
QnkWZvcyZz79id2H3r75ow+EL6SF4zxrSnJ9Ax09cKN2oM3nQUn0jkaqG4Hb/thbKbF8Sz
evBrcI0Ld4K64Mduc2XQbW2qMikT4xPBtu7bwPuP1XhipZOBcCBnXdrWCZk6pfYtA/aq5E
n7a2JAyglIpEsAIbtSVmj62BgstmSOy/4tQjVinh6IG8y8ixq59GbmC8KP9zUQ3hhLfT/n
qreXpeh039cotUTWJHyVOB

pkcs1

Textual encoding of PKCS #1.

This encoding is often referred to as "PEM". But that term is ambiguous, since PEM encoding is used to encode other types of binary data besides public keys. Implementations of PEM encoding also vary.

This implementation uses the textual encoding of RFC 7468, which specifies a unified and interoperable version of PEM and PEM-like text_encodings.

Strictly speaking, this encoding is not PKCS #1, but the RFC 7468 textual encoding of binary data conforming to PKCS #1.

This encoding starts with "-----BEGIN RSA PUBLIC KEY-----". For example,

-----BEGIN RSA PUBLIC KEY-----
MIIBCgKCAQEA2MHejuGfkkzMU5RQj3DfFQKvWTSr2kEWG7BAyitMnb08XcLe9sUa
PLLqWF9b4A4EaWAYYA8vDjxDCw7pOtbF0XW0yExVtQffK1LL7yxGBzOMCUJ5Fmb3
Mmc+/Yndh96++aMPhC+kheM8a0pyfQMdPXCjdqDN50FJ9I5GqhuB2/7YWymxfEs3
rwa3CNC3eCuuDHbnNl0G1tqjIpE+MTwbbu28D7j9V4YqWTgXAgZ13a1gmZOqX2LQ
P2quRJ+2tiQMoJSKRLACG7UlZo+tgYLLZkjsv+LUI1Yp4eiBvMvIsaufRm5gvCj/
c1EN4YS30/56q3l6XodN/XKLVE1iR8lTgQIDAQAB
-----END RSA PUBLIC KEY-----

Note: this format only supports RSA keys.

x509spki

Textual encoding of the Subject Public Key Info production from X.509.

This is a proprietary encoding used by the OpenSSH implementation of SSH. OpenSSH incorrectly and confusingly refers to this encoding as "PKCS #8". But this encoding is not related to real PKCS #8, which is an encoding of private keys and not public keys.

This encoding is not defined by X.509. That specification only defines an ASN.1 production which is unofficially borrowed by this encoding. Strictly speaking, this encoding is the RFC 7468 textual encoding of binary data conforming to the Subject Public Key Info production.

This encoding starts with "-----BEGIN PUBLIC KEY-----". For example,

-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2MHejuGfkkzMU5RQj3Df
FQKvWTSr2kEWG7BAyitMnb08XcLe9sUaPLLqWF9b4A4EaWAYYA8vDjxDCw7pOtbF
0XW0yExVtQffK1LL7yxGBzOMCUJ5Fmb3Mmc+/Yndh96++aMPhC+kheM8a0pyfQMd
PXCjdqDN50FJ9I5GqhuB2/7YWymxfEs3rwa3CNC3eCuuDHbnNl0G1tqjIpE+MTwb
bu28D7j9V4YqWTgXAgZ13a1gmZOqX2LQP2quRJ+2tiQMoJSKRLACG7UlZo+tgYLL
Zkjsv+LUI1Yp4eiBvMvIsaufRm5gvCj/c1EN4YS30/56q3l6XodN/XKLVE1iR8lT
gQIDAQAB
-----END PUBLIC KEY-----

Constants

openSsh → const PubKeyEncoding

OpenSSH Public Key

const PubKeyEncoding(0)
pkcs1 → const PubKeyEncoding

Textual encoding of PKCS #1

const PubKeyEncoding(2)
sshPublicKey → const PubKeyEncoding

SSH Public Key

const PubKeyEncoding(1)
values → const List<PubKeyEncoding>

A constant List of the values in this enum, in order of their declaration.

const List<PubKeyEncoding>
x509spki → const PubKeyEncoding

Textual encoding of subjectPublicKeyInfo from X.509

const PubKeyEncoding(3)

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
index int

The integer index of this enum.

final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
override

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited