@@ -12,7 +12,8 @@ package Kernel::Modules::AdminSMIME;
1212use strict;
1313use warnings;
1414
15- use Kernel::System::Crypt;
15+ our $ObjectManagerDisabled = 1;
16+
1617use Kernel::System::CustomerUser;
1718
1819sub new {
@@ -32,7 +33,6 @@ sub new {
3233 }
3334 }
3435
35- $Self -> {CryptObject } = Kernel::System::Crypt-> new( %Param , CryptType => ' SMIME' );
3636 $Self -> {CustomerUserObject } = Kernel::System::CustomerUser-> new(%Param );
3737
3838 return $Self ;
@@ -54,6 +54,8 @@ sub Run {
5454 Value => $Param {Search },
5555 );
5656
57+ my $SMIMEObject = $Kernel::OM -> Get(' Kernel::System::Crypt::SMIME' );
58+
5759 # ------------------------------------------------------------ #
5860 # delete cert
5961 # ------------------------------------------------------------ #
@@ -75,18 +77,18 @@ sub Run {
7577
7678 # remove private key
7779 if ( $Type eq ' key' ) {
78- %Result = $Self -> { CryptObject } -> PrivateRemove( Filename => $Filename );
80+ %Result = $SMIMEObject -> PrivateRemove( Filename => $Filename );
7981 push @Result , \%Result if %Result ;
8082 }
8183
8284 # remove certificate and private key if exists
8385 else {
84- my $Certificate = $Self -> { CryptObject } -> CertificateGet( Filename => $Filename );
85- my %Attributes = $Self -> { CryptObject } -> CertificateAttributes(
86+ my $Certificate = $SMIMEObject -> CertificateGet( Filename => $Filename );
87+ my %Attributes = $SMIMEObject -> CertificateAttributes(
8688 Certificate => $Certificate ,
8789 );
8890
89- %Result = $Self -> { CryptObject } -> CertificateRemove( Filename => $Filename );
91+ %Result = $SMIMEObject -> CertificateRemove( Filename => $Filename );
9092 push @Result , \%Result if %Result ;
9193
9294 # delete certificate from customer preferences
@@ -121,7 +123,7 @@ sub Run {
121123 }
122124
123125 if ( defined $Attributes {Private } && $Attributes {Private } eq ' Yes' ) {
124- %Result = $Self -> { CryptObject } -> PrivateRemove( Filename => $Filename );
126+ %Result = $SMIMEObject -> PrivateRemove( Filename => $Filename );
125127 push @Result , \%Result if %Result ;
126128 }
127129 }
@@ -178,7 +180,7 @@ sub Run {
178180 if ( !%Errors ) {
179181
180182 # add certificate
181- my %Result = $Self -> { CryptObject } -> CertificateAdd( Certificate => $UploadStuff {Content } );
183+ my %Result = $SMIMEObject -> CertificateAdd( Certificate => $UploadStuff {Content } );
182184 my @Result ;
183185 push @Result , \%Result if %Result ;
184186
@@ -245,7 +247,7 @@ sub Run {
245247 if ( !%Errors ) {
246248
247249 # add private key
248- my %Result = $Self -> { CryptObject } -> PrivateAdd(
250+ my %Result = $SMIMEObject -> PrivateAdd(
249251 Private => $UploadStuff {Content },
250252 Secret => $GetParam {Secret },
251253 );
@@ -290,8 +292,8 @@ sub Run {
290292 my $Hash = $Filename ;
291293 $Hash =~ s { (.+)\.\d } { $1 } xms ;
292294
293- my $Certificate = $Self -> { CryptObject } -> CertificateGet( Filename => $Filename );
294- my %Attributes = $Self -> { CryptObject } -> CertificateAttributes( Certificate => $Certificate );
295+ my $Certificate = $SMIMEObject -> CertificateGet( Filename => $Filename );
296+ my %Attributes = $SMIMEObject -> CertificateAttributes( Certificate => $Certificate );
295297 return $Self -> {LayoutObject }-> Attachment(
296298 ContentType => ' text/plain' ,
297299 Content => $Attributes {Fingerprint },
@@ -321,12 +323,12 @@ sub Run {
321323 # download key
322324 if ( $Type eq ' key' ) {
323325 my $Secret ;
324- ( $Download , $Secret ) = $Self -> { CryptObject } -> PrivateGet( Filename => $Filename );
326+ ( $Download , $Secret ) = $SMIMEObject -> PrivateGet( Filename => $Filename );
325327 }
326328
327329 # download certificate
328330 else {
329- $Download = $Self -> { CryptObject } -> CertificateGet( Filename => $Filename );
331+ $Download = $SMIMEObject -> CertificateGet( Filename => $Filename );
330332 }
331333 return $Self -> {LayoutObject }-> Attachment(
332334 ContentType => ' text/plain' ,
@@ -367,7 +369,7 @@ sub Run {
367369 }
368370
369371 # relation already exists?
370- my $Exists = $Self -> { CryptObject } -> SignerCertRelationExists(
372+ my $Exists = $SMIMEObject -> SignerCertRelationExists(
371373 CertFingerprint => $CertFingerprint ,
372374 CAFingerprint => $CAFingerprint ,
373375 );
@@ -393,7 +395,7 @@ sub Run {
393395 );
394396 }
395397 else {
396- my $Result = $Self -> { CryptObject } -> SignerCertRelationAdd(
398+ my $Result = $SMIMEObject -> SignerCertRelationAdd(
397399 CertFingerprint => $CertFingerprint ,
398400 CAFingerprint => $CAFingerprint ,
399401 UserID => $Self -> {UserID },
@@ -436,7 +438,7 @@ sub Run {
436438 }
437439
438440 # relation exists?
439- my $Exists = $Self -> { CryptObject } -> SignerCertRelationExists(
441+ my $Exists = $SMIMEObject -> SignerCertRelationExists(
440442 CertFingerprint => $CertFingerprint ,
441443 CAFingerprint => $CAFingerprint ,
442444 );
@@ -457,7 +459,7 @@ sub Run {
457459 );
458460 }
459461 else {
460- my $Success = $Self -> { CryptObject } -> SignerCertRelationDelete(
462+ my $Success = $SMIMEObject -> SignerCertRelationDelete(
461463 CertFingerprint => $CertFingerprint ,
462464 CAFingerprint => $CAFingerprint ,
463465 UserID => $Self -> {UserID },
@@ -584,7 +586,10 @@ sub _Overview {
584586 );
585587 }
586588 }
587- if ( !$Self -> {CryptObject } && $Self -> {ConfigObject }-> Get(' SMIME' ) ) {
589+
590+ my $SMIMEObject = $Kernel::OM -> Get(' Kernel::System::Crypt::SMIME' );
591+
592+ if ( !$SMIMEObject && $Self -> {ConfigObject }-> Get(' SMIME' ) ) {
588593 $Output .= $Self -> {LayoutObject }-> Notify(
589594 Priority => ' Error' ,
590595 Data => $Self -> {LayoutObject }-> {LanguageObject }-> Translate( " Cannot create %s !" , " CryptObject" ),
@@ -593,10 +598,10 @@ sub _Overview {
593598 . ' Action=AdminSysConfig;Subaction=Edit;SysConfigGroup=Framework;SysConfigSubGroup=Crypt::SMIME' ,
594599 );
595600 }
596- if ( $Self -> { CryptObject } && $Self -> { CryptObject } -> Check() ) {
601+ if ( $SMIMEObject && $SMIMEObject -> Check() ) {
597602 $Output .= $Self -> {LayoutObject }-> Notify(
598603 Priority => ' Error' ,
599- Data => $Self -> {LayoutObject }-> {LanguageObject }-> Translate(" ' . $Self ->{CryptObject} ->Check() . '" ),
604+ Data => $Self -> {LayoutObject }-> {LanguageObject }-> Translate(" ' . $SMIMEObject ->Check() . '" ),
600605 );
601606 }
602607
@@ -609,8 +614,8 @@ sub _Overview {
609614 }
610615
611616 my @List = ();
612- if ( $Self -> { CryptObject } ) {
613- @List = $Self -> { CryptObject } -> Search();
617+ if ($SMIMEObject ) {
618+ @List = $SMIMEObject -> Search();
614619 }
615620 $Self -> {LayoutObject }-> Block(
616621 Name => ' OverviewResult' ,
@@ -673,24 +678,26 @@ sub _SignerCertificateOverview {
673678 );
674679 }
675680
676- my @SignerCertResults = $Self -> {CryptObject }-> PrivateSearch(
681+ my $SMIMEObject = $Kernel::OM -> Get(' Kernel::System::Crypt::SMIME' );
682+
683+ my @SignerCertResults = $SMIMEObject -> PrivateSearch(
677684 Search => $Param {CertFingerprint },
678685 );
679686 my %SignerCert ;
680687 %SignerCert = %{ $SignerCertResults [0] } if @SignerCertResults ;
681688
682689 # get all certificates
683- my @AvailableCerts = $Self -> { CryptObject } -> CertificateSearch();
690+ my @AvailableCerts = $SMIMEObject -> CertificateSearch();
684691
685692 # get all relations for that certificate @ActualRelations
686- my @ActualRelations = $Self -> { CryptObject } -> SignerCertRelationGet(
693+ my @ActualRelations = $SMIMEObject -> SignerCertRelationGet(
687694 CertFingerprint => $Param {CertFingerprint },
688695 );
689696
690697 # get needed data from actual relations
691698 my @RelatedCerts ;
692699 for my $RelatedCert (@ActualRelations ) {
693- my @Certificate = $Self -> { CryptObject } -> CertificateSearch(
700+ my @Certificate = $SMIMEObject -> CertificateSearch(
694701 Search => $RelatedCert -> {CAFingerprint },
695702 );
696703 push @RelatedCerts , $Certificate [0] if $Certificate [0];
@@ -792,7 +799,7 @@ sub _SignerCertificateOverview {
792799 );
793800 }
794801 }
795- if ( !$Self -> { CryptObject } && $Self -> {ConfigObject }-> Get(' SMIME' ) ) {
802+ if ( !$SMIMEObject && $Self -> {ConfigObject }-> Get(' SMIME' ) ) {
796803 $Output .= $Self -> {LayoutObject }-> Notify(
797804 Priority => ' Error' ,
798805 Data => $Self -> {LayoutObject }-> {LanguageObject }-> Translate( " Cannot create %s !" , " CryptObject" ),
@@ -801,10 +808,10 @@ sub _SignerCertificateOverview {
801808 . ' Action=AdminSysConfig;Subaction=Edit;SysConfigGroup=Framework;SysConfigSubGroup=Crypt::SMIME' ,
802809 );
803810 }
804- if ( $Self -> { CryptObject } && $Self -> { CryptObject } -> Check() ) {
811+ if ( $SMIMEObject && $SMIMEObject -> Check() ) {
805812 $Output .= $Self -> {LayoutObject }-> Notify(
806813 Priority => ' Error' ,
807- Data => $Self -> {LayoutObject }-> {LanguageObject }-> Translate(" ' . $Self ->{CryptObject} ->Check() . '" ),
814+ Data => $Self -> {LayoutObject }-> {LanguageObject }-> Translate(" ' . $SMIMEObject ->Check() . '" ),
808815 );
809816 }
810817
@@ -828,8 +835,10 @@ sub _CertificateRead {
828835 Type => ' Small' ,
829836 );
830837
838+ my $SMIMEObject = $Kernel::OM -> Get(' Kernel::System::Crypt::SMIME' );
839+
831840 # get the certificate content as plain text
832- my $CertificateText = $Self -> { CryptObject } -> CertificateRead(%Param );
841+ my $CertificateText = $SMIMEObject -> CertificateRead(%Param );
833842
834843 return if !$CertificateText ;
835844
0 commit comments