PemCodec constructor
Create a PemCodec for encoding/decoding PEM encoded strings with given label.
A label is required for encoding values and to ensure that decoded bytes aren't used in an unintended context.
When decoding the parser defaults to laxtextualmsg
from RFC 7468,
but if strict
is true
parser will require stricttextualmsg
.
It is generally safe to parse in non-strict mode, which just
ignores whitespace and allows widely used label aliases.
If unsafeIgnoreLabel
is set to true
the decoding parser will ignore
the label. This can be useful in certain legacy scenarios, but is
generally discouraged as it could lead to unintended usages of keys.
Implementation
PemCodec(
this.label, {
bool strict = false,
bool unsafeIgnoreLabel = false,
}) : _strict = strict,
_unsafeIgnoreLabel = unsafeIgnoreLabel {
ArgumentError.checkNotNull(label, 'label');
ArgumentError.checkNotNull(strict, 'strict');
ArgumentError.checkNotNull(unsafeIgnoreLabel, 'unsafeIgnoreLabel');
}