OpenXPKI::Crypto::Secret::Plain - Simple PIN concatenation
PIN container that supports a simple form of "secret splitting" by
dividing the PIN in n components that are simply concatenated.
Usage example: simple one-part pin (not very useful)
# 'Plain' pin, one part
my $secret = OpenXPKI::Crypto::Secret::Plain->new(
part_count => 1,
);
$secret->is_complete; # 0
my $result = $secret->get_secret; # undef
$secret->set_secret('foobar');
$secret->is_complete # 1
$result = $secret->get_secret; # 'foobar'
Usage example: simple multi-part pin
# 'Plain' pin, three part
my $secret = OpenXPKI::Crypto::Secret::Plain->new(
part_count => 3,
);
my $result = $secret->get_secret; # undef
$secret->set_secret('foo', 1);
$secret->set_secret('baz', 3);
$secret->is_complete; # 0
$result = $secret->get_secret; # undef
$secret->set_secret('bar', 2);
$secret->is_complete; # 1
$result = $secret->get_secret; # 'foobarbaz'
Required: total number of secret parts