I'm a bit clueless on the crypto front, but as for operating on a string as though it were a file you can always use IO::Scalar, or if you're working with perl5.8.0, just use the new functionality of open e.g
# using IO::Scalar
tie *FH, 'IO::Scalar', \my $str = $somenumber;
# using open()
open(my $fh, '<', \my $str = $somenumber);