Browse Source

some more refactorings

Ugochukwu Mmaduekwe 2 tuần trước cách đây
mục cha
commit
3227a21903

+ 0 - 4
CryptoLib.Tests/Delphi.Tests/CryptoLib.Tests.dpr

@@ -30,7 +30,6 @@ uses
   ClpAesEngine in '..\..\CryptoLib\src\Crypto\Engines\ClpAesEngine.pas',
   ClpAesLightEngine in '..\..\CryptoLib\src\Crypto\Engines\ClpAesLightEngine.pas',
   ClpAgreementUtilities in '..\..\CryptoLib\src\Crypto\Agreements\ClpAgreementUtilities.pas',
-  ClpAlgorithmIdentifier in '..\..\CryptoLib\src\Asn1\X509\ClpAlgorithmIdentifier.pas',
   ClpArgon2ParametersGenerator in '..\..\CryptoLib\src\Crypto\Generators\ClpArgon2ParametersGenerator.pas',
   ClpArrayUtilities in '..\..\CryptoLib\src\GeneralUtilities\ClpArrayUtilities.pas',
   ClpAsn1DigestFactory in '..\..\CryptoLib\src\Crypto\Operators\ClpAsn1DigestFactory.pas',
@@ -92,7 +91,6 @@ uses
   ClpDHValidationParameters in '..\..\CryptoLib\src\Crypto\Parameters\ClpDHValidationParameters.pas',
   ClpDHValidationParams in '..\..\CryptoLib\src\Asn1\X9\ClpDHValidationParams.pas',
   ClpDigest in '..\..\CryptoLib\src\Crypto\Digests\ClpDigest.pas',
-  ClpDigestInfo in '..\..\CryptoLib\src\Asn1\X509\ClpDigestInfo.pas',
   ClpDigestRandomGenerator in '..\..\CryptoLib\src\Rngs\ClpDigestRandomGenerator.pas',
   ClpDigestSink in '..\..\CryptoLib\src\Crypto\IO\ClpDigestSink.pas',
   ClpDigestUtilities in '..\..\CryptoLib\src\Crypto\Digests\ClpDigestUtilities.pas',
@@ -157,7 +155,6 @@ uses
   ClpHMacDsaKCalculator in '..\..\CryptoLib\src\Crypto\Signers\SignerCalculators\ClpHMacDsaKCalculator.pas',
   ClpIAesEngine in '..\..\CryptoLib\src\Interfaces\Crypto\Engines\ClpIAesEngine.pas',
   ClpIAesLightEngine in '..\..\CryptoLib\src\Interfaces\Crypto\Engines\ClpIAesLightEngine.pas',
-  ClpIAlgorithmIdentifier in '..\..\CryptoLib\src\Interfaces\Asn1\X509\ClpIAlgorithmIdentifier.pas',
   ClpIAlgorithmParameterSpec in '..\..\CryptoLib\src\Interfaces\ClpIAlgorithmParameterSpec.pas',
   ClpIanaObjectIdentifiers in '..\..\CryptoLib\src\Asn1\Iana\ClpIanaObjectIdentifiers.pas',
   ClpIArgon2ParametersGenerator in '..\..\CryptoLib\src\Interfaces\Crypto\Generators\ClpIArgon2ParametersGenerator.pas',
@@ -201,7 +198,6 @@ uses
   ClpIDHValidationParams in '..\..\CryptoLib\src\Interfaces\Asn1\X9\ClpIDHValidationParams.pas',
   ClpIDigest in '..\..\CryptoLib\src\Interfaces\Crypto\Digests\ClpIDigest.pas',
   ClpIDigestFactory in '..\..\CryptoLib\src\Interfaces\Crypto\Operators\ClpIDigestFactory.pas',
-  ClpIDigestInfo in '..\..\CryptoLib\src\Interfaces\Asn1\X509\ClpIDigestInfo.pas',
   ClpIDigestRandomGenerator in '..\..\CryptoLib\src\Interfaces\Rngs\ClpIDigestRandomGenerator.pas',
   ClpIDsa in '..\..\CryptoLib\src\Interfaces\Crypto\Signers\ClpIDsa.pas',
   ClpIDsaDigestSigner in '..\..\CryptoLib\src\Interfaces\Crypto\Signers\ClpIDsaDigestSigner.pas',

+ 5 - 5
CryptoLib/src/Asn1/ClpAsn1Objects.pas

@@ -4188,8 +4188,11 @@ begin
     Result := nil;
     Exit;
   end;
-  if not Supports(AObj, IAsn1Sequence, Result) then
-    raise EArgumentCryptoLibException.Create('illegal object in GetInstance');
+
+  if Supports(AObj, IAsn1Sequence, Result) then
+    Exit;
+
+  raise EArgumentCryptoLibException.Create('illegal object in GetInstance');
 end;
 
 class function TAsn1Sequence.GetInstance(const AObj: IAsn1Convertible): IAsn1Sequence;
@@ -4202,9 +4205,6 @@ begin
 
   if Supports(AObj, IAsn1Sequence, Result) then
     Exit;
-  
-  if Supports(AObj, IAsn1Object) then
-    raise EArgumentCryptoLibException.Create('illegal object in GetInstance');
     
   Result := GetInstance(AObj.ToAsn1Object());
 end;

+ 0 - 163
CryptoLib/src/Asn1/X509/ClpAlgorithmIdentifier.pas

@@ -1,163 +0,0 @@
-{ *********************************************************************************** }
-{ *                              CryptoLib Library                                  * }
-{ *                Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe                    * }
-{ *                 Github Repository <https://github.com/Xor-el>                   * }
-
-{ *  Distributed under the MIT software license, see the accompanying file LICENSE  * }
-{ *          or visit http://www.opensource.org/licenses/mit-license.php.           * }
-
-{ *                              Acknowledgements:                                  * }
-{ *                                                                                 * }
-{ *      Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring     * }
-{ *                           development of this library                           * }
-
-{ * ******************************************************************************* * }
-
-(* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *)
-
-unit ClpAlgorithmIdentifier;
-
-{$I ..\..\Include\CryptoLib.inc}
-
-interface
-
-uses
-  SysUtils,
-  ClpAsn1Objects,
-  ClpIAsn1Objects,
-  ClpAsn1Core,
-  ClpIAsn1Core,
-  ClpIAlgorithmIdentifier,
-  ClpCryptoLibTypes;
-
-resourcestring
-  SBadSequenceSize = 'Bad sequence size: %d';
-  SAlgorithmNil = 'algorithm';
-
-type
-  /// <summary>
-  /// The AlgorithmIdentifier object.
-  /// <code>
-  /// AlgorithmIdentifier ::= SEQUENCE {
-  ///   algorithm OBJECT IDENTIFIER,
-  ///   parameters ANY DEFINED BY algorithm OPTIONAL
-  /// }
-  /// </code>
-  /// </summary>
-  TAlgorithmIdentifier = class(TAsn1Encodable, IAlgorithmIdentifier)
-
-  strict private
-  var
-    FAlgorithm: IDerObjectIdentifier;
-    FParameters: IAsn1Encodable;
-
-  strict protected
-    function GetAlgorithm: IDerObjectIdentifier;
-    function GetParameters: IAsn1Encodable;
-
-  public
-    /// <summary>
-    /// Parse an AlgorithmIdentifier from an object.
-    /// </summary>
-    class function GetInstance(obj: TObject): IAlgorithmIdentifier; overload; static;
-
-    /// <summary>
-    /// Parse an AlgorithmIdentifier from a tagged object.
-    /// </summary>
-    class function GetInstance(const obj: IAsn1TaggedObject;
-      explicitly: Boolean): IAlgorithmIdentifier; overload; static;
-
-    constructor Create(const seq: IAsn1Sequence); overload;
-    constructor Create(const algorithm: IDerObjectIdentifier); overload;
-    constructor Create(const algorithm: IDerObjectIdentifier;
-      const parameters: IAsn1Encodable); overload;
-
-    function ToAsn1Object: IAsn1Object; override;
-
-    property Algorithm: IDerObjectIdentifier read GetAlgorithm;
-    property Parameters: IAsn1Encodable read GetParameters;
-
-  end;
-
-implementation
-
-{ TAlgorithmIdentifier }
-
-class function TAlgorithmIdentifier.GetInstance(obj: TObject): IAlgorithmIdentifier;
-begin
-  if obj = nil then
-  begin
-    Result := nil;
-    Exit;
-  end;
-
-  if Supports(obj, IAlgorithmIdentifier, Result) then
-    Exit;
-
-  Result := TAlgorithmIdentifier.Create(TAsn1Sequence.GetInstance(obj));
-end;
-
-class function TAlgorithmIdentifier.GetInstance(const obj: IAsn1TaggedObject;
-  explicitly: Boolean): IAlgorithmIdentifier;
-begin
-  Result := TAlgorithmIdentifier.Create(TAsn1Sequence.GetInstance(obj, explicitly));
-end;
-
-constructor TAlgorithmIdentifier.Create(const seq: IAsn1Sequence);
-var
-  count: Int32;
-begin
-  inherited Create();
-
-  count := seq.Count;
-  if (count < 1) or (count > 2) then
-  begin
-    raise EArgumentCryptoLibException.CreateResFmt(@SBadSequenceSize, [count]);
-  end;
-
-  //FAlgorithm := TDerObjectIdentifier.GetInstance(seq[0].ToAsn1Object as TObject);
-  FAlgorithm := TDerObjectIdentifier.GetInstance(seq[0] as TAsn1Encodable);
-  if count < 2 then
-    FParameters := nil
-  else
-    FParameters := seq[1] as IAsn1Encodable;
-end;
-
-constructor TAlgorithmIdentifier.Create(const algorithm: IDerObjectIdentifier);
-begin
-  Create(algorithm, nil);
-end;
-
-constructor TAlgorithmIdentifier.Create(const algorithm: IDerObjectIdentifier;
-  const parameters: IAsn1Encodable);
-begin
-  inherited Create();
-
-  if algorithm = nil then
-  begin
-    raise EArgumentNilCryptoLibException.Create(SAlgorithmNil);
-  end;
-
-  FAlgorithm := algorithm;
-  FParameters := parameters;
-end;
-
-function TAlgorithmIdentifier.GetAlgorithm: IDerObjectIdentifier;
-begin
-  Result := FAlgorithm;
-end;
-
-function TAlgorithmIdentifier.GetParameters: IAsn1Encodable;
-begin
-  Result := FParameters;
-end;
-
-function TAlgorithmIdentifier.ToAsn1Object: IAsn1Object;
-begin
-  if FParameters = nil then
-    Result := TDerSequence.Create([FAlgorithm as IAsn1Encodable])
-  else
-    Result := TDerSequence.Create([FAlgorithm as IAsn1Encodable, FParameters]);
-end;
-
-end.

+ 0 - 186
CryptoLib/src/Asn1/X509/ClpDigestInfo.pas

@@ -1,186 +0,0 @@
-{ *********************************************************************************** }
-{ *                              CryptoLib Library                                  * }
-{ *                Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe                    * }
-{ *                 Github Repository <https://github.com/Xor-el>                   * }
-
-{ *  Distributed under the MIT software license, see the accompanying file LICENSE  * }
-{ *          or visit http://www.opensource.org/licenses/mit-license.php.           * }
-
-{ *                              Acknowledgements:                                  * }
-{ *                                                                                 * }
-{ *      Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring     * }
-{ *                           development of this library                           * }
-
-{ * ******************************************************************************* * }
-
-(* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *)
-
-unit ClpDigestInfo;
-
-{$I ..\..\Include\CryptoLib.inc}
-
-interface
-
-uses
-  SysUtils,
-  ClpAsn1Objects,
-  ClpIAsn1Objects,
-  ClpAsn1Core,
-  ClpIAsn1Core,
-  ClpIAlgorithmIdentifier,
-  ClpAlgorithmIdentifier,
-  ClpIDigestInfo,
-  ClpCryptoLibTypes;
-
-resourcestring
-  SBadSequenceSize = 'Bad sequence size: %d';
-
-type
-  /// <summary>
-  /// The DigestInfo object.
-  /// DigestInfo ::= SEQUENCE {
-  ///   digestAlgorithm AlgorithmIdentifier,
-  ///   digest OCTET STRING
-  /// }
-  /// </summary>
-  TDigestInfo = class(TAsn1Encodable, IDigestInfo)
-
-  strict private
-  var
-    FDigestAlgorithm: IAlgorithmIdentifier;
-    FDigest: IAsn1OctetString;
-
-  strict protected
-    function GetDigestAlgorithm: IAlgorithmIdentifier;
-    function GetDigest: IAsn1OctetString;
-    function GetDigestBytes: TCryptoLibByteArray;
-
-  public
-    /// <summary>
-    /// Parse a DigestInfo from an object.
-    /// </summary>
-    class function GetInstance(obj: TObject): IDigestInfo; overload; static;
-
-    /// <summary>
-    /// Parse a DigestInfo from DER-encoded bytes.
-    /// </summary>
-    class function GetInstance(const encoded: TCryptoLibByteArray): IDigestInfo; overload; static;
-
-    constructor Create(const seq: IAsn1Sequence); overload;
-    constructor Create(const algId: IAlgorithmIdentifier;
-      const digest: TCryptoLibByteArray); overload;
-    constructor Create(const digestAlgorithm: IAlgorithmIdentifier;
-      const digest: IAsn1OctetString); overload;
-
-    function GetDerEncoded: TCryptoLibByteArray;
-    function ToAsn1Object: IAsn1Object; override;
-
-    property DigestAlgorithm: IAlgorithmIdentifier read GetDigestAlgorithm;
-    property Digest: IAsn1OctetString read GetDigest;
-
-  end;
-
-implementation
-
-{ TDigestInfo }
-
-class function TDigestInfo.GetInstance(obj: TObject): IDigestInfo;
-begin
-  if obj = nil then
-  begin
-    Result := nil;
-    Exit;
-  end;
-
-  if Supports(obj, IDigestInfo, Result) then
-    Exit;
-
-  if obj is TAsn1Sequence then
-    Result := TDigestInfo.Create(obj as TAsn1Sequence)
-  else
-    Result := TDigestInfo.Create(TAsn1Sequence.GetInstance(obj as TAsn1Encodable));
-end;
-
-class function TDigestInfo.GetInstance(const encoded: TCryptoLibByteArray): IDigestInfo;
-var
-  asn1Obj: IAsn1Object;
-begin
-  asn1Obj := TAsn1Object.FromByteArray(encoded);
-  Result := TDigestInfo.Create(asn1Obj as IAsn1Sequence);
-end;
-
-constructor TDigestInfo.Create(const seq: IAsn1Sequence);
-var
-  count: Int32;
-begin
-  inherited Create();
-
-  count := seq.Count;
-  if count <> 2 then
-  begin
-    raise EArgumentCryptoLibException.CreateResFmt(@SBadSequenceSize, [count]);
-  end;
-
-  FDigestAlgorithm := TAlgorithmIdentifier.GetInstance(seq[0].ToAsn1Object() as TObject);
-  FDigest := TAsn1OctetString.GetInstance(seq[1].ToAsn1Object() as TObject);
-end;
-
-constructor TDigestInfo.Create(const algId: IAlgorithmIdentifier;
-  const digest: TCryptoLibByteArray);
-begin
-  inherited Create();
-
-  if algId = nil then
-  begin
-    raise EArgumentNilCryptoLibException.Create('algId');
-  end;
-
-  FDigestAlgorithm := algId;
-  FDigest := TDerOctetString.Create(digest);
-end;
-
-constructor TDigestInfo.Create(const digestAlgorithm: IAlgorithmIdentifier;
-  const digest: IAsn1OctetString);
-begin
-  inherited Create();
-
-  if digestAlgorithm = nil then
-  begin
-    raise EArgumentNilCryptoLibException.Create('digestAlgorithm');
-  end;
-
-  if digest = nil then
-  begin
-    raise EArgumentNilCryptoLibException.Create('digest');
-  end;
-
-  FDigestAlgorithm := digestAlgorithm;
-  FDigest := digest;
-end;
-
-function TDigestInfo.GetDigestAlgorithm: IAlgorithmIdentifier;
-begin
-  Result := FDigestAlgorithm;
-end;
-
-function TDigestInfo.GetDigest: IAsn1OctetString;
-begin
-  Result := FDigest;
-end;
-
-function TDigestInfo.GetDigestBytes: TCryptoLibByteArray;
-begin
-  Result := FDigest.GetOctets();
-end;
-
-function TDigestInfo.GetDerEncoded: TCryptoLibByteArray;
-begin
-  Result := ToAsn1Object.GetDerEncoded();
-end;
-
-function TDigestInfo.ToAsn1Object: IAsn1Object;
-begin
-  Result := TDerSequence.Create([FDigestAlgorithm, FDigest]);
-end;
-
-end.

+ 77 - 37
CryptoLib/src/Asn1/X509/ClpDsaParameter.pas

@@ -22,6 +22,7 @@ unit ClpDsaParameter;
 interface
 
 uses
+  SysUtils,
   ClpIDsaParameter,
   ClpAsn1Objects,
   ClpIAsn1Objects,
@@ -39,28 +40,43 @@ type
 
   strict private
   var
-    Fp, Fq, Fg: IDerInteger;
+    FP, FQ, FG: IDerInteger;
 
     function GetG: TBigInteger; inline;
     function GetP: TBigInteger; inline;
     function GetQ: TBigInteger; inline;
 
-    constructor Create(const seq: IAsn1Sequence); overload;
+    constructor Create(const ASeq: IAsn1Sequence); overload;
 
   public
-    constructor Create(const p, q, g: TBigInteger); overload;
+    constructor Create(const AP, AQ, AG: TBigInteger); overload;
 
     function ToAsn1Object(): IAsn1Object; override;
 
-    property p: TBigInteger read GetP;
-    property q: TBigInteger read GetQ;
-    property g: TBigInteger read GetG;
-
-    class function GetInstance(const obj: IAsn1TaggedObject;
-      explicitly: Boolean): IDsaParameter; overload; static; inline;
-
-    class function GetInstance(obj: TObject): IDsaParameter; overload;
-      static; inline;
+    property P: TBigInteger read GetP;
+    property Q: TBigInteger read GetQ;
+    property G: TBigInteger read GetG;
+
+    /// <summary>
+    /// Parse a DsaParameter from an object.
+    /// </summary>
+    class function GetInstance(AObj: TObject): IDsaParameter; overload; static;
+    /// <summary>
+    /// Get instance from ASN.1 convertible.
+    /// </summary>
+    class function GetInstance(const AObj: IAsn1Convertible): IDsaParameter; overload; static;
+    /// <summary>
+    /// Parse a DsaParameter from DER-encoded bytes.
+    /// </summary>
+    class function GetInstance(const AEncoded: TCryptoLibByteArray): IDsaParameter; overload; static;
+    /// <summary>
+    /// Parse a DsaParameter from a tagged object.
+    /// </summary>
+    class function GetInstance(const AObj: IAsn1TaggedObject; AExplicitly: Boolean): IDsaParameter; overload; static;
+    /// <summary>
+    /// Get tagged DsaParameter.
+    /// </summary>
+    class function GetTagged(const ATaggedObject: IAsn1TaggedObject; ADeclaredExplicit: Boolean): IDsaParameter; static;
 
   end;
 
@@ -70,69 +86,93 @@ implementation
 
 function TDsaParameter.GetP: TBigInteger;
 begin
-  result := Fp.PositiveValue;
+  result := FP.PositiveValue;
 end;
 
 function TDsaParameter.GetQ: TBigInteger;
 begin
-  result := Fq.PositiveValue;
+  result := FQ.PositiveValue;
 end;
 
 function TDsaParameter.GetG: TBigInteger;
 begin
-  result := Fg.PositiveValue;
+  result := FG.PositiveValue;
 end;
 
 function TDsaParameter.ToAsn1Object: IAsn1Object;
 begin
-  result := TDerSequence.Create([Fp, Fq, Fg]);
+  result := TDerSequence.Create([FP, FQ, FG]);
 end;
 
-constructor TDsaParameter.Create(const seq: IAsn1Sequence);
+constructor TDsaParameter.Create(const ASeq: IAsn1Sequence);
 begin
   Inherited Create();
-  if (seq.Count <> 3) then
+  if (ASeq.Count <> 3) then
   begin
     raise EArgumentCryptoLibException.CreateResFmt(@SBadSequenceSize,
-      [seq.Count]);
+      [ASeq.Count]);
   end;
 
-  Fp := TDerInteger.GetInstance(seq[0] as TAsn1Encodable);
-  Fq := TDerInteger.GetInstance(seq[1] as TAsn1Encodable);
-  Fg := TDerInteger.GetInstance(seq[2] as TAsn1Encodable);
+  FP := TDerInteger.GetInstance(ASeq[0]);
+  FQ := TDerInteger.GetInstance(ASeq[1]);
+  FG := TDerInteger.GetInstance(ASeq[2]);
 end;
 
-constructor TDsaParameter.Create(const p, q, g: TBigInteger);
+constructor TDsaParameter.Create(const AP, AQ, AG: TBigInteger);
 begin
   Inherited Create();
-  Fp := TDerInteger.Create(p);
-  Fq := TDerInteger.Create(q);
-  Fg := TDerInteger.Create(g);
+  FP := TDerInteger.Create(AP);
+  FQ := TDerInteger.Create(AQ);
+  FG := TDerInteger.Create(AG);
 end;
 
-class function TDsaParameter.GetInstance(obj: TObject): IDsaParameter;
+class function TDsaParameter.GetInstance(AObj: TObject): IDsaParameter;
 begin
-  if ((obj = Nil) or (obj is TDsaParameter)) then
+  if AObj = nil then
   begin
-    result := obj as TDsaParameter;
+    Result := nil;
     Exit;
   end;
 
-  if (obj is TAsn1Sequence) then
+  if Supports(AObj, IDsaParameter, Result) then
+    Exit;
+
+  Result := TDsaParameter.Create(TAsn1Sequence.GetInstance(AObj));
+end;
+
+class function TDsaParameter.GetInstance(const AObj: IAsn1Convertible): IDsaParameter;
+begin
+  if AObj = nil then
   begin
-    result := TDsaParameter.Create(obj as TAsn1Sequence);
+    Result := nil;
     Exit;
   end;
 
-  raise EArgumentCryptoLibException.CreateResFmt(@SInvalidDsaParameter,
-    [obj.ToString]);
+  if Supports(AObj, IDsaParameter, Result) then
+    Exit;
+
+  Result := TDsaParameter.Create(TAsn1Sequence.GetInstance(AObj));
+end;
+
+class function TDsaParameter.GetInstance(const AEncoded: TCryptoLibByteArray): IDsaParameter;
+begin
+  if AEncoded = nil then
+  begin
+    Result := nil;
+    Exit;
+  end;
+
+  Result := TDsaParameter.Create(TAsn1Sequence.GetInstance(AEncoded));
+end;
+
+class function TDsaParameter.GetInstance(const AObj: IAsn1TaggedObject; AExplicitly: Boolean): IDsaParameter;
+begin
+  Result := TDsaParameter.Create(TAsn1Sequence.GetInstance(AObj, AExplicitly));
 end;
 
-class function TDsaParameter.GetInstance(const obj: IAsn1TaggedObject;
-  explicitly: Boolean): IDsaParameter;
+class function TDsaParameter.GetTagged(const ATaggedObject: IAsn1TaggedObject; ADeclaredExplicit: Boolean): IDsaParameter;
 begin
-  result := GetInstance(TAsn1Sequence.GetInstance(obj, explicitly)
-    as TAsn1Sequence);
+  Result := TDsaParameter.Create(TAsn1Sequence.GetTagged(ATaggedObject, ADeclaredExplicit));
 end;
 
 end.

+ 0 - 2
CryptoLib/src/Asn1/X509/ClpX509Asn1Objects.pas

@@ -1998,8 +1998,6 @@ begin
 end;
 
 class function TDigestInfo.GetInstance(const AEncoded: TCryptoLibByteArray): IDigestInfo;
-var
-  LAsn1Obj: IAsn1Object;
 begin
   if AEncoded = nil then
   begin

+ 0 - 51
CryptoLib/src/Interfaces/Asn1/X509/ClpIAlgorithmIdentifier.pas

@@ -1,51 +0,0 @@
-{ *********************************************************************************** }
-{ *                              CryptoLib Library                                  * }
-{ *                Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe                    * }
-{ *                 Github Repository <https://github.com/Xor-el>                   * }
-
-{ *  Distributed under the MIT software license, see the accompanying file LICENSE  * }
-{ *          or visit http://www.opensource.org/licenses/mit-license.php.           * }
-
-{ *                              Acknowledgements:                                  * }
-{ *                                                                                 * }
-{ *      Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring     * }
-{ *                           development of this library                           * }
-
-{ * ******************************************************************************* * }
-
-(* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *)
-
-unit ClpIAlgorithmIdentifier;
-
-{$I ..\..\..\Include\CryptoLib.inc}
-
-interface
-
-uses
-  ClpIAsn1Core,
-  ClpIAsn1Objects;
-
-type
-  /// <summary>
-  /// Interface for the AlgorithmIdentifier object.
-  /// <code>
-  /// AlgorithmIdentifier ::= SEQUENCE {
-  ///   algorithm OBJECT IDENTIFIER,
-  ///   parameters ANY DEFINED BY algorithm OPTIONAL
-  /// }
-  /// </code>
-  /// </summary>
-  IAlgorithmIdentifier = interface(IAsn1Encodable)
-    ['{E7F8A9B0-C1D2-E3F4-A5B6-C7D8E9F0A1B2}']
-
-    function GetAlgorithm: IDerObjectIdentifier;
-    function GetParameters: IAsn1Encodable;
-
-    property Algorithm: IDerObjectIdentifier read GetAlgorithm;
-    property Parameters: IAsn1Encodable read GetParameters;
-
-  end;
-
-implementation
-
-end.

+ 0 - 53
CryptoLib/src/Interfaces/Asn1/X509/ClpIDigestInfo.pas

@@ -1,53 +0,0 @@
-{ *********************************************************************************** }
-{ *                              CryptoLib Library                                  * }
-{ *                Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe                    * }
-{ *                 Github Repository <https://github.com/Xor-el>                   * }
-
-{ *  Distributed under the MIT software license, see the accompanying file LICENSE  * }
-{ *          or visit http://www.opensource.org/licenses/mit-license.php.           * }
-
-{ *                              Acknowledgements:                                  * }
-{ *                                                                                 * }
-{ *      Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring     * }
-{ *                           development of this library                           * }
-
-{ * ******************************************************************************* * }
-
-(* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *)
-
-unit ClpIDigestInfo;
-
-{$I ..\..\..\Include\CryptoLib.inc}
-
-interface
-
-uses
-  ClpIAlgorithmIdentifier,
-  ClpIAsn1Core,
-  ClpIAsn1Objects,
-  ClpCryptoLibTypes;
-
-type
-  /// <summary>
-  /// Interface for the DigestInfo object.
-  /// DigestInfo ::= SEQUENCE {
-  ///   digestAlgorithm AlgorithmIdentifier,
-  ///   digest OCTET STRING
-  /// }
-  /// </summary>
-  IDigestInfo = interface(IAsn1Encodable)
-    ['{A1B2C3D4-E5F6-7890-ABCD-0123456789AB}']
-
-    function GetDigestAlgorithm: IAlgorithmIdentifier;
-    function GetDigest: IAsn1OctetString;
-    function GetDigestBytes: TCryptoLibByteArray;
-    function GetDerEncoded: TCryptoLibByteArray;
-
-    property DigestAlgorithm: IAlgorithmIdentifier read GetDigestAlgorithm;
-    property Digest: IAsn1OctetString read GetDigest;
-
-  end;
-
-implementation
-
-end.

+ 3 - 4
CryptoLib/src/Interfaces/Asn1/X509/ClpIDsaParameter.pas

@@ -22,7 +22,6 @@ unit ClpIDsaParameter;
 interface
 
 uses
-  ClpIAsn1Objects,
   ClpIAsn1Core,
   ClpBigInteger;
 
@@ -31,13 +30,13 @@ type
     ['{037E0113-0BD6-4A61-8BDC-DBEBE6136A6C}']
 
     function GetP: TBigInteger;
-    property p: TBigInteger read GetP;
+    property P: TBigInteger read GetP;
 
     function GetG: TBigInteger;
-    property g: TBigInteger read GetG;
+    property G: TBigInteger read GetG;
 
     function GetQ: TBigInteger;
-    property q: TBigInteger read GetQ;
+    property Q: TBigInteger read GetQ;
 
   end;