Convert-X509

 view release on metacpan or  search on metacpan

lib/Convert/X509/Parser.pm  view on Meta::CPAN

sub _localize {
  my ($k,$v) = %{ shift @_};
  return _iconv($v,$k,@_);
}

sub _decode {
  die ("Error\n",$asn->error,"\nin ASN.1 code ") if $asn->error;
  my $type = shift;
  my $node= $asn->find( $oid_db{uc($type)}->{'asn'} || 'Any' );
  die ('Error finding ',$type,'-', $oid_db{uc($type)}->{'asn'}, ' in module') unless $node;
  my @decoded = map {$node->decode($_)} @_;
  return ( @_ > 1 ? [@decoded] : $decoded[0] )
}

sub _decode_rdn {
  my $res = {};
  return $res unless ref($_[0]) eq 'ARRAY';
  for my $rdn ( @{ $_[0] } ){
    for my $attr (@$rdn){ # = { 'type'=>OID, 'value'=>{dsType=>DirectoryString} }
      push  @{ $res->{$attr->{'type'}} },
        $attr->{'value'};
    }

lib/Convert/X509/minipkcs7.pm  view on Meta::CPAN

	  $m >>= 8;
  }
  return $res;
}

sub _decode {
  warn ("Error\n",$asn->error,"\nin ASN.1 code\n") && return undef if $asn->error;
  my $type = shift;
  my $node= $asn->find( $oid_db{uc($type)}->{'asn'} || 'Any' );
  warn ('Error finding ',$type,'-', $oid_db{uc($type)}->{'asn'}, ' in module',"\n") && return undef unless $node;
  my @decoded = map {$node->decode($_)} @_;
  return ( @_ > 1 ? [@decoded] : $decoded[0] )
}

sub snlist {
	my ($self) = @_;
	my $res = { }; # {'recipients'=>[],'signers'=>[]};
	if (exists $self->{'content'}{'signerInfos'}){
		@{ $res->{'signers'} } =
			map{
			 {_int2hexstr( $_->{'issuerAndSerialNumber'}{'serialNumber'} ) =>
			 $_->{'digestAlgorithm'}{'algorithm'} }



( run in 0.274 second using v1.01-cache-2.11-cpan-26ccb49234f )