|
@@ -1057,42 +1057,6 @@ type
|
|
|
|
|
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
- /// <summary>
|
|
|
|
|
- /// The RsaPublicKeyStructure object.
|
|
|
|
|
- /// </summary>
|
|
|
|
|
- TRsaPublicKeyStructure = class(TAsn1Encodable, IRsaPublicKeyStructure)
|
|
|
|
|
-
|
|
|
|
|
- strict private
|
|
|
|
|
- var
|
|
|
|
|
- FModulus: TBigInteger;
|
|
|
|
|
- FPublicExponent: TBigInteger;
|
|
|
|
|
-
|
|
|
|
|
- strict protected
|
|
|
|
|
- function GetModulus: TBigInteger;
|
|
|
|
|
- function GetPublicExponent: TBigInteger;
|
|
|
|
|
-
|
|
|
|
|
- public
|
|
|
|
|
- class function GetInstance(AObj: TObject): IRsaPublicKeyStructure; overload; static;
|
|
|
|
|
- /// <summary>
|
|
|
|
|
- /// Get instance from ASN.1 convertible.
|
|
|
|
|
- /// </summary>
|
|
|
|
|
- class function GetInstance(const AObj: IAsn1Convertible): IRsaPublicKeyStructure; overload; static;
|
|
|
|
|
- class function GetInstance(const AEncoded: TCryptoLibByteArray): IRsaPublicKeyStructure; overload; static;
|
|
|
|
|
- class function GetInstance(const AObj: IAsn1TaggedObject;
|
|
|
|
|
- AExplicitly: Boolean): IRsaPublicKeyStructure; overload; static;
|
|
|
|
|
- class function GetTagged(const ATaggedObject: IAsn1TaggedObject;
|
|
|
|
|
- ADeclaredExplicit: Boolean): IRsaPublicKeyStructure; static;
|
|
|
|
|
-
|
|
|
|
|
- constructor Create(const ASeq: IAsn1Sequence); overload;
|
|
|
|
|
- constructor Create(const AModulus, APublicExponent: TBigInteger); overload;
|
|
|
|
|
-
|
|
|
|
|
- function ToAsn1Object: IAsn1Object; override;
|
|
|
|
|
-
|
|
|
|
|
- property Modulus: TBigInteger read GetModulus;
|
|
|
|
|
- property PublicExponent: TBigInteger read GetPublicExponent;
|
|
|
|
|
-
|
|
|
|
|
- end;
|
|
|
|
|
-
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// The SubjectAltPublicKeyInfo object.
|
|
/// The SubjectAltPublicKeyInfo object.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -1630,53 +1594,6 @@ type
|
|
|
|
|
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
- /// <summary>
|
|
|
|
|
- /// The DsaParameter object.
|
|
|
|
|
- /// </summary>
|
|
|
|
|
- TDsaParameter = class(TAsn1Encodable, IDsaParameter)
|
|
|
|
|
-
|
|
|
|
|
- strict private
|
|
|
|
|
- var
|
|
|
|
|
- FP, FQ, FG: IDerInteger;
|
|
|
|
|
-
|
|
|
|
|
- function GetG: TBigInteger; inline;
|
|
|
|
|
- function GetP: TBigInteger; inline;
|
|
|
|
|
- function GetQ: TBigInteger; inline;
|
|
|
|
|
-
|
|
|
|
|
- constructor Create(const ASeq: IAsn1Sequence); overload;
|
|
|
|
|
-
|
|
|
|
|
- public
|
|
|
|
|
- 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;
|
|
|
|
|
-
|
|
|
|
|
- /// <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;
|
|
|
|
|
-
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// The AttCertIssuer object.
|
|
/// The AttCertIssuer object.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -3170,107 +3087,6 @@ begin
|
|
|
Result := TDerSequence.Create([FAlgorithm, FPublicKey]);
|
|
Result := TDerSequence.Create([FAlgorithm, FPublicKey]);
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
-{ TRsaPublicKeyStructure }
|
|
|
|
|
-
|
|
|
|
|
-class function TRsaPublicKeyStructure.GetInstance(AObj: TObject): IRsaPublicKeyStructure;
|
|
|
|
|
-begin
|
|
|
|
|
- if AObj = nil then
|
|
|
|
|
- begin
|
|
|
|
|
- Result := nil;
|
|
|
|
|
- Exit;
|
|
|
|
|
- end;
|
|
|
|
|
-
|
|
|
|
|
- if Supports(AObj, IRsaPublicKeyStructure, Result) then
|
|
|
|
|
- Exit;
|
|
|
|
|
-
|
|
|
|
|
- Result := TRsaPublicKeyStructure.Create(TAsn1Sequence.GetInstance(AObj));
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
-class function TRsaPublicKeyStructure.GetInstance(const AObj: IAsn1Convertible): IRsaPublicKeyStructure;
|
|
|
|
|
-begin
|
|
|
|
|
- if AObj = nil then
|
|
|
|
|
- begin
|
|
|
|
|
- Result := nil;
|
|
|
|
|
- Exit;
|
|
|
|
|
- end;
|
|
|
|
|
-
|
|
|
|
|
- if Supports(AObj, IRsaPublicKeyStructure, Result) then
|
|
|
|
|
- Exit;
|
|
|
|
|
-
|
|
|
|
|
- Result := TRsaPublicKeyStructure.Create(TAsn1Sequence.GetInstance(AObj));
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
-class function TRsaPublicKeyStructure.GetInstance(const AEncoded: TCryptoLibByteArray): IRsaPublicKeyStructure;
|
|
|
|
|
-begin
|
|
|
|
|
- Result := TRsaPublicKeyStructure.Create(TAsn1Sequence.GetInstance(AEncoded));
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-class function TRsaPublicKeyStructure.GetInstance(const AObj: IAsn1TaggedObject;
|
|
|
|
|
- AExplicitly: Boolean): IRsaPublicKeyStructure;
|
|
|
|
|
-begin
|
|
|
|
|
- Result := TRsaPublicKeyStructure.Create(TAsn1Sequence.GetInstance(AObj, AExplicitly));
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
-class function TRsaPublicKeyStructure.GetTagged(const ATaggedObject: IAsn1TaggedObject;
|
|
|
|
|
- ADeclaredExplicit: Boolean): IRsaPublicKeyStructure;
|
|
|
|
|
-begin
|
|
|
|
|
- Result := TRsaPublicKeyStructure.Create(TAsn1Sequence.GetTagged(ATaggedObject, ADeclaredExplicit));
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
-constructor TRsaPublicKeyStructure.Create(const ASeq: IAsn1Sequence);
|
|
|
|
|
-var
|
|
|
|
|
- LCount: Int32;
|
|
|
|
|
-begin
|
|
|
|
|
- inherited Create();
|
|
|
|
|
-
|
|
|
|
|
- LCount := ASeq.Count;
|
|
|
|
|
- if LCount <> 2 then
|
|
|
|
|
- begin
|
|
|
|
|
- raise EArgumentCryptoLibException.CreateResFmt(@SBadSequenceSize, [LCount]);
|
|
|
|
|
- end;
|
|
|
|
|
-
|
|
|
|
|
- // Note: we are accepting technically incorrect (i.e. negative) values here
|
|
|
|
|
- FModulus := TDerInteger.GetInstance(ASeq[0]).PositiveValue;
|
|
|
|
|
- FPublicExponent := TDerInteger.GetInstance(ASeq[1]).PositiveValue;
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
-constructor TRsaPublicKeyStructure.Create(const AModulus, APublicExponent: TBigInteger);
|
|
|
|
|
-begin
|
|
|
|
|
- inherited Create();
|
|
|
|
|
-
|
|
|
|
|
- if AModulus.IsInitialized = False then
|
|
|
|
|
- raise EArgumentNilCryptoLibException.Create('modulus');
|
|
|
|
|
- if APublicExponent.IsInitialized = False then
|
|
|
|
|
- raise EArgumentNilCryptoLibException.Create('publicExponent');
|
|
|
|
|
- if AModulus.SignValue <= 0 then
|
|
|
|
|
- raise EArgumentCryptoLibException.Create(SNotCA);
|
|
|
|
|
- if APublicExponent.SignValue <= 0 then
|
|
|
|
|
- raise EArgumentCryptoLibException.Create(SNotValidPublicExponent);
|
|
|
|
|
-
|
|
|
|
|
- FModulus := AModulus;
|
|
|
|
|
- FPublicExponent := APublicExponent;
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
-function TRsaPublicKeyStructure.GetModulus: TBigInteger;
|
|
|
|
|
-begin
|
|
|
|
|
- Result := FModulus;
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
-function TRsaPublicKeyStructure.GetPublicExponent: TBigInteger;
|
|
|
|
|
-begin
|
|
|
|
|
- Result := FPublicExponent;
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
-function TRsaPublicKeyStructure.ToAsn1Object: IAsn1Object;
|
|
|
|
|
-var
|
|
|
|
|
- LModulus, LExponent: IDerInteger;
|
|
|
|
|
-begin
|
|
|
|
|
- LModulus := TDerInteger.Create(FModulus);
|
|
|
|
|
- LExponent := TDerInteger.Create(FPublicExponent);
|
|
|
|
|
- Result := TDerSequence.Create([LModulus, LExponent]);
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
{ TSubjectAltPublicKeyInfo }
|
|
{ TSubjectAltPublicKeyInfo }
|
|
|
|
|
|
|
|
class function TSubjectAltPublicKeyInfo.GetInstance(AObj: TObject): ISubjectAltPublicKeyInfo;
|
|
class function TSubjectAltPublicKeyInfo.GetInstance(AObj: TObject): ISubjectAltPublicKeyInfo;
|
|
@@ -7133,99 +6949,6 @@ begin
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
-{ TDsaParameter }
|
|
|
|
|
-
|
|
|
|
|
-function TDsaParameter.GetP: TBigInteger;
|
|
|
|
|
-begin
|
|
|
|
|
- result := FP.PositiveValue;
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
-function TDsaParameter.GetQ: TBigInteger;
|
|
|
|
|
-begin
|
|
|
|
|
- result := FQ.PositiveValue;
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
-function TDsaParameter.GetG: TBigInteger;
|
|
|
|
|
-begin
|
|
|
|
|
- result := FG.PositiveValue;
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
-function TDsaParameter.ToAsn1Object: IAsn1Object;
|
|
|
|
|
-begin
|
|
|
|
|
- result := TDerSequence.Create([FP, FQ, FG]);
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
-constructor TDsaParameter.Create(const ASeq: IAsn1Sequence);
|
|
|
|
|
-begin
|
|
|
|
|
- Inherited Create();
|
|
|
|
|
- if (ASeq.Count <> 3) then
|
|
|
|
|
- begin
|
|
|
|
|
- raise EArgumentCryptoLibException.CreateResFmt(@SBadSequenceSize,
|
|
|
|
|
- [ASeq.Count]);
|
|
|
|
|
- end;
|
|
|
|
|
-
|
|
|
|
|
- FP := TDerInteger.GetInstance(ASeq[0]);
|
|
|
|
|
- FQ := TDerInteger.GetInstance(ASeq[1]);
|
|
|
|
|
- FG := TDerInteger.GetInstance(ASeq[2]);
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
-constructor TDsaParameter.Create(const AP, AQ, AG: TBigInteger);
|
|
|
|
|
-begin
|
|
|
|
|
- Inherited Create();
|
|
|
|
|
- FP := TDerInteger.Create(AP);
|
|
|
|
|
- FQ := TDerInteger.Create(AQ);
|
|
|
|
|
- FG := TDerInteger.Create(AG);
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
-class function TDsaParameter.GetInstance(AObj: TObject): IDsaParameter;
|
|
|
|
|
-begin
|
|
|
|
|
- if AObj = nil then
|
|
|
|
|
- begin
|
|
|
|
|
- Result := nil;
|
|
|
|
|
- Exit;
|
|
|
|
|
- end;
|
|
|
|
|
-
|
|
|
|
|
- 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 := nil;
|
|
|
|
|
- Exit;
|
|
|
|
|
- end;
|
|
|
|
|
-
|
|
|
|
|
- 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.GetTagged(const ATaggedObject: IAsn1TaggedObject; ADeclaredExplicit: Boolean): IDsaParameter;
|
|
|
|
|
-begin
|
|
|
|
|
- Result := TDsaParameter.Create(TAsn1Sequence.GetTagged(ATaggedObject, ADeclaredExplicit));
|
|
|
|
|
-end;
|
|
|
|
|
-
|
|
|
|
|
{ TDistributionPointName }
|
|
{ TDistributionPointName }
|
|
|
|
|
|
|
|
class function TDistributionPointName.GetInstance(AObj: TObject): IDistributionPointName;
|
|
class function TDistributionPointName.GetInstance(AObj: TObject): IDistributionPointName;
|