├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── dependabot.yml └── workflows │ ├── make.pas │ └── make.yml ├── .gitignore ├── CryptoLib.Samples ├── Delphi.Samples │ └── UsageSamples.dpr ├── FreePascal.Samples │ ├── UsageSamples.lpi │ └── UsageSamples.lpr └── src │ └── UsageExamples.pas ├── CryptoLib.Tests ├── Delphi.Tests │ ├── CryptoLib.Tests.TestInsight.dpr │ └── CryptoLib.Tests.dpr ├── FreePascal.Tests │ ├── CryptoLib.Tests.lpi │ ├── CryptoLib.lpr │ ├── CryptoLibConsole.lpi │ └── CryptoLibConsole.lpr └── src │ ├── Asn1 │ ├── Asn1IntegerTests.pas │ ├── Asn1SequenceParserTests.pas │ ├── DerApplicationSpecificTests.pas │ ├── EnumeratedTests.pas │ ├── EqualsAndHashCodeTests.pas │ ├── OIDTests.pas │ ├── ParseTests.pas │ ├── ParsingTests.pas │ ├── StringTests.pas │ └── TagTests.pas │ ├── Crypto │ ├── AESSICTests.pas │ ├── AESTestVectors.pas │ ├── AESTests.pas │ ├── Argon2Tests.pas │ ├── BlockCipherMonteCarloTests.pas │ ├── BlockCipherVectorTests.pas │ ├── BlowfishTestVectors.pas │ ├── CTSTests.pas │ ├── ChaChaTests.pas │ ├── DHTests.pas │ ├── DSATests.pas │ ├── DeterministicDsaTests.pas │ ├── DigestRandomNumberTests.pas │ ├── HMacTests.pas │ ├── HkdfGeneratorTests.pas │ ├── KMacTests.pas │ ├── Kdf1GeneratorTests.pas │ ├── Kdf2GeneratorTests.pas │ ├── MD5HMacTests.pas │ ├── PaddingTests.pas │ ├── Pkcs5Tests.pas │ ├── RIPEMD128HMacTests.pas │ ├── RIPEMD160HMacTests.pas │ ├── RijndaelTestVectors.pas │ ├── SHA1HMacTests.pas │ ├── SHA224HMacTests.pas │ ├── SHA256HMacTests.pas │ ├── SHA384HMacTests.pas │ ├── SHA512HMacTests.pas │ ├── SPECKTests.pas │ ├── Salsa20Tests.pas │ ├── ScryptTests.pas │ ├── SpeckTestVectors.pas │ ├── StreamCipherResetTests.pas │ └── XSalsa20Tests.pas │ ├── CryptoLibTestBase.pas │ ├── Math │ ├── BigIntegerTests.pas │ ├── EC │ │ ├── Custom │ │ │ └── Sec │ │ │ │ ├── SecP256R1FieldTests.pas │ │ │ │ └── SecP384R1FieldTests.pas │ │ ├── FixedPointTests.pas │ │ ├── Rfc7748 │ │ │ └── X25519Tests.pas │ │ └── Rfc8032 │ │ │ └── Ed25519Tests.pas │ ├── ECAlgorithmsTests.pas │ ├── ECIESTests.pas │ ├── ECNRTests.pas │ ├── ECPointTests.pas │ ├── IESCipherTests.pas │ └── PascalCoinECIESTests.pas │ ├── Others │ ├── DigestTests.pas │ ├── ECDsa5Tests.pas │ ├── ECSchnorrTests.pas │ ├── ECTests.pas │ ├── Ed25519HigherLevelTests.pas │ ├── NamedCurveTests.pas │ ├── ShortenedDigestTests.pas │ ├── SignerUtilitiesTests.pas │ └── X25519HigherLevelTests.pas │ ├── Security │ ├── DigestUtilitiesTests.pas │ └── SecureRandomTests.pas │ └── Utils │ ├── ClpFixedSecureRandom.pas │ ├── ClpIFixedSecureRandom.pas │ ├── ClpIShortenedDigest.pas │ └── ClpShortenedDigest.pas ├── CryptoLib └── src │ ├── Asn1 │ ├── Bsi │ │ └── ClpBsiObjectIdentifiers.pas │ ├── ClpAsn1Objects.pas │ ├── ClpOidTokenizer.pas │ ├── CryptLib │ │ └── ClpCryptLibObjectIdentifiers.pas │ ├── CryptoPro │ │ ├── ClpCryptoProObjectIdentifiers.pas │ │ └── ClpECGost3410NamedCurves.pas │ ├── Eac │ │ └── ClpEacObjectIdentifiers.pas │ ├── Edec │ │ └── ClpEdECObjectIdentifiers.pas │ ├── Iana │ │ └── ClpIanaObjectIdentifiers.pas │ ├── Misc │ │ └── ClpMiscObjectIdentifiers.pas │ ├── Nist │ │ ├── ClpNistNamedCurves.pas │ │ └── ClpNistObjectIdentifiers.pas │ ├── Oiw │ │ └── ClpOiwObjectIdentifiers.pas │ ├── Pkcs │ │ └── ClpPkcsObjectIdentifiers.pas │ ├── RossStandart │ │ └── ClpRosstandartObjectIdentifiers.pas │ ├── Sec │ │ ├── ClpSecNamedCurves.pas │ │ └── ClpSecObjectIdentifiers.pas │ ├── TeleTrust │ │ ├── ClpTeleTrusTNamedCurves.pas │ │ └── ClpTeleTrusTObjectIdentifiers.pas │ ├── X509 │ │ └── ClpDsaParameter.pas │ └── X9 │ │ ├── ClpDHDomainParameters.pas │ │ ├── ClpDHValidationParams.pas │ │ ├── ClpECNamedCurveTable.pas │ │ ├── ClpX9ECC.pas │ │ ├── ClpX9ECParameters.pas │ │ ├── ClpX9ECParametersHolder.pas │ │ └── ClpX9ObjectIdentifiers.pas │ ├── Crypto │ ├── Agreement │ │ ├── ClpDHAgreement.pas │ │ ├── ClpDHBasicAgreement.pas │ │ ├── ClpECDHBasicAgreement.pas │ │ ├── ClpECDHCBasicAgreement.pas │ │ └── ClpX25519Agreement.pas │ ├── ClpAsymmetricCipherKeyPair.pas │ ├── ClpAsymmetricKeyParameter.pas │ ├── ClpBufferedBlockCipher.pas │ ├── ClpBufferedCipherBase.pas │ ├── ClpBufferedStreamCipher.pas │ ├── ClpEphemeralKeyPair.pas │ ├── ClpIESCipher.pas │ ├── ClpKeyEncoder.pas │ ├── ClpKeyGenerationParameters.pas │ ├── Digests │ │ └── ClpDigest.pas │ ├── EC │ │ └── ClpCustomNamedCurves.pas │ ├── Engines │ │ ├── ClpAesEngine.pas │ │ ├── ClpAesLightEngine.pas │ │ ├── ClpBlowfishEngine.pas │ │ ├── ClpChaChaEngine.pas │ │ ├── ClpIESEngine.pas │ │ ├── ClpPascalCoinIESEngine.pas │ │ ├── ClpRijndaelEngine.pas │ │ ├── ClpSalsa20Engine.pas │ │ ├── ClpSpeckEngine.pas │ │ ├── ClpSpeckLegacyEngine.pas │ │ └── ClpXSalsa20Engine.pas │ ├── Generators │ │ ├── ClpArgon2ParametersGenerator.pas │ │ ├── ClpBaseKdfBytesGenerator.pas │ │ ├── ClpCipherKeyGenerator.pas │ │ ├── ClpDHBasicKeyPairGenerator.pas │ │ ├── ClpDHKeyGeneratorHelper.pas │ │ ├── ClpDHKeyPairGenerator.pas │ │ ├── ClpDHParametersGenerator.pas │ │ ├── ClpDHParametersHelper.pas │ │ ├── ClpDsaKeyPairGenerator.pas │ │ ├── ClpDsaParametersGenerator.pas │ │ ├── ClpECKeyPairGenerator.pas │ │ ├── ClpEd25519KeyPairGenerator.pas │ │ ├── ClpEphemeralKeyPairGenerator.pas │ │ ├── ClpHkdfBytesGenerator.pas │ │ ├── ClpKdf1BytesGenerator.pas │ │ ├── ClpKdf2BytesGenerator.pas │ │ ├── ClpPascalCoinECIESKdfBytesGenerator.pas │ │ ├── ClpPbeParametersGenerator.pas │ │ ├── ClpPkcs5S2ParametersGenerator.pas │ │ ├── ClpScryptParametersGenerator.pas │ │ └── ClpX25519KeyPairGenerator.pas │ ├── Macs │ │ ├── ClpHMac.pas │ │ └── ClpKMac.pas │ ├── Modes │ │ └── ClpBlockCipherModes.pas │ ├── Paddings │ │ ├── ClpPaddedBufferedBlockCipher.pas │ │ └── ClpPaddingModes.pas │ ├── Parameters │ │ ├── ClpDHKeyGenerationParameters.pas │ │ ├── ClpDHKeyParameters.pas │ │ ├── ClpDHParameters.pas │ │ ├── ClpDHPrivateKeyParameters.pas │ │ ├── ClpDHPublicKeyParameters.pas │ │ ├── ClpDHValidationParameters.pas │ │ ├── ClpDsaKeyGenerationParameters.pas │ │ ├── ClpDsaKeyParameters.pas │ │ ├── ClpDsaParameterGenerationParameters.pas │ │ ├── ClpDsaParameters.pas │ │ ├── ClpDsaPrivateKeyParameters.pas │ │ ├── ClpDsaPublicKeyParameters.pas │ │ ├── ClpDsaValidationParameters.pas │ │ ├── ClpECDomainParameters.pas │ │ ├── ClpECKeyGenerationParameters.pas │ │ ├── ClpECKeyParameters.pas │ │ ├── ClpECPrivateKeyParameters.pas │ │ ├── ClpECPublicKeyParameters.pas │ │ ├── ClpEd25519KeyGenerationParameters.pas │ │ ├── ClpEd25519PrivateKeyParameters.pas │ │ ├── ClpEd25519PublicKeyParameters.pas │ │ ├── ClpHkdfParameters.pas │ │ ├── ClpIESParameterSpec.pas │ │ ├── ClpIESParameters.pas │ │ ├── ClpIESWithCipherParameters.pas │ │ ├── ClpIso18033KdfParameters.pas │ │ ├── ClpKdfParameters.pas │ │ ├── ClpKeyParameter.pas │ │ ├── ClpParametersWithIV.pas │ │ ├── ClpParametersWithRandom.pas │ │ ├── ClpX25519KeyGenerationParameters.pas │ │ ├── ClpX25519PrivateKeyParameters.pas │ │ └── ClpX25519PublicKeyParameters.pas │ ├── Parsers │ │ └── ClpECIESPublicKeyParser.pas │ ├── Prng │ │ ├── ClpCryptoApiRandomGenerator.pas │ │ └── ClpDigestRandomGenerator.pas │ └── Signers │ │ ├── ClpDsaDigestSigner.pas │ │ ├── ClpDsaSigner.pas │ │ ├── ClpECDsaSigner.pas │ │ ├── ClpECNRSigner.pas │ │ ├── ClpECSchnorrSipaSigner.pas │ │ ├── ClpEd25519CtxSigner.pas │ │ ├── ClpEd25519PhSigner.pas │ │ ├── ClpEd25519Signer.pas │ │ ├── ClpHMacDsaKCalculator.pas │ │ ├── ClpRandomDsaKCalculator.pas │ │ ├── ClpSchnorrDigestSigner.pas │ │ └── SignersEncodings │ │ └── ClpSignersEncodings.pas │ ├── Include │ ├── CryptoLib.inc │ └── CryptoLibHelper.inc │ ├── Interfaces │ ├── ClpIAesEngine.pas │ ├── ClpIAesLightEngine.pas │ ├── ClpIAlgorithmParameterSpec.pas │ ├── ClpIArgon2ParametersGenerator.pas │ ├── ClpIAsn1Objects.pas │ ├── ClpIAsymmetricCipherKeyPair.pas │ ├── ClpIAsymmetricCipherKeyPairGenerator.pas │ ├── ClpIAsymmetricKeyParameter.pas │ ├── ClpIBaseKdfBytesGenerator.pas │ ├── ClpIBasicAgreement.pas │ ├── ClpIBlockCipher.pas │ ├── ClpIBlockCipherModes.pas │ ├── ClpIBlockCipherPadding.pas │ ├── ClpIBlowfishEngine.pas │ ├── ClpIBufferedBlockCipher.pas │ ├── ClpIBufferedCipher.pas │ ├── ClpIBufferedCipherBase.pas │ ├── ClpIBufferedStreamCipher.pas │ ├── ClpIChaChaEngine.pas │ ├── ClpICipherKeyGenerator.pas │ ├── ClpICipherParameters.pas │ ├── ClpICryptoApiRandomGenerator.pas │ ├── ClpICurve25519Custom.pas │ ├── ClpIDHAgreement.pas │ ├── ClpIDHBasicAgreement.pas │ ├── ClpIDHBasicKeyPairGenerator.pas │ ├── ClpIDHDomainParameters.pas │ ├── ClpIDHKeyGenerationParameters.pas │ ├── ClpIDHKeyGeneratorHelper.pas │ ├── ClpIDHKeyPairGenerator.pas │ ├── ClpIDHKeyParameters.pas │ ├── ClpIDHParameters.pas │ ├── ClpIDHParametersGenerator.pas │ ├── ClpIDHPrivateKeyParameters.pas │ ├── ClpIDHPublicKeyParameters.pas │ ├── ClpIDHValidationParameters.pas │ ├── ClpIDHValidationParams.pas │ ├── ClpIDerivationFunction.pas │ ├── ClpIDerivationParameters.pas │ ├── ClpIDigest.pas │ ├── ClpIDigestRandomGenerator.pas │ ├── ClpIDsa.pas │ ├── ClpIDsaDigestSigner.pas │ ├── ClpIDsaExt.pas │ ├── ClpIDsaKCalculator.pas │ ├── ClpIDsaKeyGenerationParameters.pas │ ├── ClpIDsaKeyPairGenerator.pas │ ├── ClpIDsaKeyParameters.pas │ ├── ClpIDsaParameter.pas │ ├── ClpIDsaParameterGenerationParameters.pas │ ├── ClpIDsaParameters.pas │ ├── ClpIDsaParametersGenerator.pas │ ├── ClpIDsaPrivateKeyParameters.pas │ ├── ClpIDsaPublicKeyParameters.pas │ ├── ClpIDsaSigner.pas │ ├── ClpIDsaValidationParameters.pas │ ├── ClpIECC.pas │ ├── ClpIECDHBasicAgreement.pas │ ├── ClpIECDHCBasicAgreement.pas │ ├── ClpIECDomainParameters.pas │ ├── ClpIECDsaSigner.pas │ ├── ClpIECIESPublicKeyParser.pas │ ├── ClpIECKeyGenerationParameters.pas │ ├── ClpIECKeyPairGenerator.pas │ ├── ClpIECKeyParameters.pas │ ├── ClpIECNRSigner.pas │ ├── ClpIECPrivateKeyParameters.pas │ ├── ClpIECPublicKeyParameters.pas │ ├── ClpIECSchnorrSipaSigner.pas │ ├── ClpIEd25519.pas │ ├── ClpIEd25519CtxSigner.pas │ ├── ClpIEd25519KeyGenerationParameters.pas │ ├── ClpIEd25519KeyPairGenerator.pas │ ├── ClpIEd25519PhSigner.pas │ ├── ClpIEd25519PrivateKeyParameters.pas │ ├── ClpIEd25519PublicKeyParameters.pas │ ├── ClpIEd25519Signer.pas │ ├── ClpIEndoPreCompInfo.pas │ ├── ClpIEphemeralKeyPair.pas │ ├── ClpIEphemeralKeyPairGenerator.pas │ ├── ClpIExtensionField.pas │ ├── ClpIFiniteField.pas │ ├── ClpIFixedPointPreCompInfo.pas │ ├── ClpIGF2Polynomial.pas │ ├── ClpIGenericPolynomialExtensionField.pas │ ├── ClpIGlvEndomorphism.pas │ ├── ClpIGlvTypeAEndomorphism.pas │ ├── ClpIGlvTypeAParameters.pas │ ├── ClpIGlvTypeBEndomorphism.pas │ ├── ClpIGlvTypeBParameters.pas │ ├── ClpIHMac.pas │ ├── ClpIHMacDsaKCalculator.pas │ ├── ClpIHkdfBytesGenerator.pas │ ├── ClpIHkdfParameters.pas │ ├── ClpIIESCipher.pas │ ├── ClpIIESEngine.pas │ ├── ClpIIESParameterSpec.pas │ ├── ClpIIESParameters.pas │ ├── ClpIIESWithCipherParameters.pas │ ├── ClpIIso18033KdfParameters.pas │ ├── ClpIKMac.pas │ ├── ClpIKdf1BytesGenerator.pas │ ├── ClpIKdf2BytesGenerator.pas │ ├── ClpIKdfParameters.pas │ ├── ClpIKeyEncoder.pas │ ├── ClpIKeyGenerationParameters.pas │ ├── ClpIKeyParameter.pas │ ├── ClpIKeyParser.pas │ ├── ClpIMac.pas │ ├── ClpIMultipliers.pas │ ├── ClpIOidTokenizer.pas │ ├── ClpIPaddedBufferedBlockCipher.pas │ ├── ClpIPaddingModes.pas │ ├── ClpIParametersWithIV.pas │ ├── ClpIParametersWithRandom.pas │ ├── ClpIPascalCoinECIESKdfBytesGenerator.pas │ ├── ClpIPascalCoinIESEngine.pas │ ├── ClpIPbeParametersGenerator.pas │ ├── ClpIPkcs5S2ParametersGenerator.pas │ ├── ClpIPolynomial.pas │ ├── ClpIPolynomialExtensionField.pas │ ├── ClpIPreCompCallBack.pas │ ├── ClpIPreCompInfo.pas │ ├── ClpIPrimeField.pas │ ├── ClpIRandom.pas │ ├── ClpIRandomDsaKCalculator.pas │ ├── ClpIRandomGenerator.pas │ ├── ClpIRandomNumberGenerator.pas │ ├── ClpIRawAgreement.pas │ ├── ClpIRijndaelEngine.pas │ ├── ClpISalsa20Engine.pas │ ├── ClpIScalarSplitParameters.pas │ ├── ClpIScaleXNegateYPointMap.pas │ ├── ClpIScaleXPointMap.pas │ ├── ClpIScaleYNegateXPointMap.pas │ ├── ClpISchnorr.pas │ ├── ClpISchnorrDigestSigner.pas │ ├── ClpISchnorrExt.pas │ ├── ClpIScryptParametersGenerator.pas │ ├── ClpISecP256K1Custom.pas │ ├── ClpISecP256R1Custom.pas │ ├── ClpISecP384R1Custom.pas │ ├── ClpISecP521R1Custom.pas │ ├── ClpISecT283Custom.pas │ ├── ClpISecureRandom.pas │ ├── ClpISigner.pas │ ├── ClpISignersEncodings.pas │ ├── ClpISpeckEngine.pas │ ├── ClpISpeckLegacyEngine.pas │ ├── ClpIStreamCipher.pas │ ├── ClpIValidityPreCompInfo.pas │ ├── ClpIWNafPreCompInfo.pas │ ├── ClpIWTauNafPreCompInfo.pas │ ├── ClpIX25519Agreement.pas │ ├── ClpIX25519KeyGenerationParameters.pas │ ├── ClpIX25519KeyPairGenerator.pas │ ├── ClpIX25519PrivateKeyParameters.pas │ ├── ClpIX25519PublicKeyParameters.pas │ ├── ClpIX9ECC.pas │ ├── ClpIX9ECParameters.pas │ ├── ClpIX9ECParametersHolder.pas │ ├── ClpIXSalsa20Engine.pas │ └── ClpIZTauElement.pas │ ├── Math │ ├── ClpBigInteger.pas │ ├── EC │ │ ├── Abc │ │ │ ├── ClpSimpleBigDecimal.pas │ │ │ ├── ClpTnaf.pas │ │ │ └── ClpZTauElement.pas │ │ ├── ClpECAlgorithms.pas │ │ ├── ClpECC.pas │ │ ├── ClpECCompUtilities.pas │ │ ├── ClpECCurveConstants.pas │ │ ├── ClpLongArray.pas │ │ ├── ClpScaleXNegateYPointMap.pas │ │ ├── ClpScaleXPointMap.pas │ │ ├── ClpScaleYNegateXPointMap.pas │ │ ├── Custom │ │ │ ├── Djb │ │ │ │ └── ClpCurve25519Custom.pas │ │ │ └── Sec │ │ │ │ ├── ClpSecP256K1Custom.pas │ │ │ │ ├── ClpSecP256R1Custom.pas │ │ │ │ ├── ClpSecP384R1Custom.pas │ │ │ │ ├── ClpSecP521R1Custom.pas │ │ │ │ └── ClpSecT283Custom.pas │ │ ├── Endo │ │ │ ├── ClpEndoPreCompInfo.pas │ │ │ ├── ClpGlvTypeAEndomorphism.pas │ │ │ ├── ClpGlvTypeAParameters.pas │ │ │ ├── ClpGlvTypeBEndomorphism.pas │ │ │ ├── ClpGlvTypeBParameters.pas │ │ │ └── ClpScalarSplitParameters.pas │ │ ├── Multiplier │ │ │ ├── ClpFixedPointPreCompInfo.pas │ │ │ ├── ClpMultipliers.pas │ │ │ ├── ClpValidityPreCompInfo.pas │ │ │ ├── ClpWNafPreCompInfo.pas │ │ │ └── ClpWTauNafPreCompInfo.pas │ │ ├── Rfc7748 │ │ │ ├── ClpX25519.pas │ │ │ └── ClpX25519Field.pas │ │ └── Rfc8032 │ │ │ └── ClpEd25519.pas │ ├── Field │ │ ├── ClpFiniteFields.pas │ │ ├── ClpGF2Polynomial.pas │ │ ├── ClpGenericPolynomialExtensionField.pas │ │ └── ClpPrimeField.pas │ └── Raw │ │ ├── ClpInterleave.pas │ │ ├── ClpMod.pas │ │ ├── ClpNat.pas │ │ ├── ClpNat192.pas │ │ ├── ClpNat256.pas │ │ ├── ClpNat320.pas │ │ ├── ClpNat384.pas │ │ └── ClpNat512.pas │ ├── Packages │ ├── Delphi │ │ └── CryptoLib4PascalPackage.dpk │ └── FPC │ │ ├── CryptoLib4PascalPackage.lpk │ │ └── CryptoLib4PascalPackage.pas │ ├── Security │ ├── ClpAgreementUtilities.pas │ ├── ClpCipherUtilities.pas │ ├── ClpDigestUtilities.pas │ ├── ClpGeneratorUtilities.pas │ ├── ClpMacUtilities.pas │ ├── ClpParameterUtilities.pas │ ├── ClpRandom.pas │ ├── ClpSecureRandom.pas │ └── ClpSignerUtilities.pas │ └── Utils │ ├── ClpArrayUtils.pas │ ├── ClpBigIntegers.pas │ ├── ClpBitConverter.pas │ ├── ClpBits.pas │ ├── ClpCheck.pas │ ├── ClpConverters.pas │ ├── ClpCryptoLibTypes.pas │ ├── ClpSetWeakRef.pas │ ├── ClpStringUtils.pas │ ├── ClpTimes.pas │ ├── Encoders │ └── ClpEncoders.pas │ ├── Randoms │ ├── ClpAESPRNGRandom.pas │ └── ClpOSRandom.pas │ └── Rng │ └── ClpRandomNumberGenerator.pas ├── LICENSE └── README.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: xor_el # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Environment (please complete the following information):** 24 | - OS: [e.g. Windows, Linux, Mac] 25 | - Compiler [e.g. FreePascal 3.0.0] 26 | - Package Version [e.g. 1.0] 27 | 28 | **Additional context** 29 | Add any other context about the problem here. 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 2 3 | updates: 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "monthly" 8 | -------------------------------------------------------------------------------- /.github/workflows/make.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Make 3 | 4 | on: 5 | schedule: 6 | - cron: '0 0 1 * *' 7 | push: 8 | branches: 9 | - "**" 10 | pull_request: 11 | branches: 12 | - master 13 | - main 14 | 15 | concurrency: 16 | group: ${{ github.workflow }}-${{ github.ref }} 17 | cancel-in-progress: true 18 | 19 | jobs: 20 | build: 21 | runs-on: ${{ matrix.os }} 22 | timeout-minutes: 120 23 | strategy: 24 | matrix: 25 | os: 26 | - ubuntu-latest 27 | - windows-latest 28 | 29 | steps: 30 | - name: Checkout 31 | uses: actions/checkout@v4 32 | with: 33 | submodules: true 34 | 35 | - name: Build on Linux 36 | if: runner.os == 'Linux' 37 | shell: bash 38 | run: | 39 | set -xeuo pipefail 40 | sudo bash -c 'apt-get update; apt-get install -y lazarus' >/dev/null 41 | instantfpc -Fu/usr/lib/lazarus/*/components/lazutils \ 42 | -B '.github/workflows/make.pas' 43 | 44 | - name: Build on Windows 45 | if: runner.os == 'Windows' 46 | shell: powershell 47 | run: | 48 | $ErrorActionPreference = 'stop' 49 | Set-PSDebug -Strict 50 | New-Variable -Option Constant -Name VAR -Value @{ 51 | Uri = 52 | 'https://fossies.org/windows/misc/lazarus-4.0-fpc-3.2.2-win64.exe' 53 | OutFile = (New-TemporaryFile).FullName + '.exe' 54 | } 55 | Invoke-WebRequest @VAR 56 | & $VAR.OutFile.Replace('Temp', 'Temp\.') /SP- /VERYSILENT /NORESTART ` 57 | /SUPPRESSMSGBOXES | Out-Null 58 | $Env:PATH+=';C:\Lazarus' 59 | (Get-Command 'lazbuild').Source | Out-Host 60 | $Env:PATH+=';C:\Lazarus\fpc\3.2.2\bin\x86_64-win64' 61 | (Get-Command 'instantfpc').Source | Out-Host 62 | instantfpc -FuC:\Lazarus\components\lazutils ` 63 | -B '.github/workflows/make.pas' 64 | -------------------------------------------------------------------------------- /CryptoLib.Samples/FreePascal.Samples/UsageSamples.lpr: -------------------------------------------------------------------------------- 1 | program UsageSamples; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses {$IFDEF UNIX} {$IFDEF UseCThreads} 6 | cthreads, {$ENDIF} {$ENDIF} 7 | SysUtils, 8 | UsageExamples; 9 | 10 | begin 11 | try 12 | { TODO -oUser -cConsole Main : Insert code here } 13 | TUsageExamples.GenerateKeyPairAndSignECDSA; 14 | TUsageExamples.GenerateKeyPairAndSignECSchnorr; 15 | TUsageExamples.GetPublicKeyFromPrivateKey; 16 | TUsageExamples.RecreatePublicAndPrivateKeyPairsFromByteArray; 17 | TUsageExamples.RecreatePublicKeyFromXAndYCoordByteArray; 18 | TUsageExamples.BinaryCompatiblePascalCoinAES256EncryptDecryptDemo('Pascal Rules', 'Pascal'); 19 | TUsageExamples.BinaryCompatiblePascalCoinECIESEncryptDecryptDemo('Kowalski'); 20 | // TUsageExamples.BinaryCompatiblePascalCoinECIESEncryptExistingPayloadDemo('', '', ''); 21 | // TUsageExamples.BinaryCompatiblePascalCoinECIESDecryptExistingPayloadDemo('', '', ''); 22 | Readln; 23 | except 24 | on E: Exception do 25 | Writeln(E.ClassName, ': ', E.Message); 26 | end; 27 | 28 | end. 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /CryptoLib.Tests/FreePascal.Tests/CryptoLib.lpr: -------------------------------------------------------------------------------- 1 | program CryptoLib.Tests; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | Interfaces, 7 | Forms, 8 | GuiTestRunner, 9 | Asn1SequenceParserTests, 10 | DerApplicationSpecificTests, 11 | EqualsAndHashCodeTests, 12 | OIDTests, 13 | EnumeratedTests, 14 | ParsingTests, 15 | ParseTests, 16 | StringTests, 17 | TagTests, 18 | BigIntegerTests, 19 | ECAlgorithmsTests, 20 | ECPointTests, 21 | SecP256R1FieldTests, 22 | SecP384R1FieldTests, 23 | ECDsa5Tests, 24 | ECTests, 25 | NamedCurveTests, 26 | ECSchnorrTests, 27 | SignerUtilitiesTests, 28 | SecureRandomTests, 29 | DigestRandomNumberTests, 30 | FixedPointTests, 31 | AESTests, 32 | BlockCipherVectorTests, 33 | BlockCipherMonteCarloTests, 34 | AESTestVectors, 35 | BlowfishTestVectors, 36 | SpeckTestVectors, 37 | RijndaelTestVectors, 38 | AESSICTests, 39 | SPECKTests, 40 | IESCipherTests, 41 | MD5HMacTests, 42 | SHA1HMacTests, 43 | SHA224HMacTests, 44 | SHA256HMacTests, 45 | SHA384HMacTests, 46 | SHA512HMacTests, 47 | RIPEMD128HMacTests, 48 | RIPEMD160HMacTests, 49 | HMacTests, 50 | Pkcs5Tests, 51 | HkdfGeneratorTests, 52 | ECIESTests, 53 | PascalCoinECIESTests, 54 | ECNRTests, 55 | PaddingTests, 56 | DSATests, 57 | DeterministicDsaTests, 58 | Salsa20Tests, 59 | XSalsa20Tests, 60 | ChaChaTests, 61 | StreamCipherResetTests, 62 | CTSTests, 63 | X25519Tests, 64 | Ed25519Tests, 65 | X25519HigherLevelTests, 66 | Ed25519HigherLevelTests, 67 | ShortenedDigestTests, 68 | Kdf1GeneratorTests, 69 | Kdf2GeneratorTests, 70 | Argon2Tests, 71 | ScryptTests, 72 | DigestTests, 73 | DigestUtilitiesTests, 74 | DHTests, 75 | Asn1IntegerTests, 76 | KMacTests, 77 | CryptoLibTestBase, 78 | ClpFixedSecureRandom, 79 | ClpIFixedSecureRandom, 80 | ClpShortenedDigest, 81 | ClpIShortenedDigest; 82 | 83 | {$R *.res} 84 | 85 | begin 86 | Application.Initialize; 87 | Application.CreateForm(TGuiTestRunner, TestRunner); 88 | Application.Run; 89 | end. 90 | 91 | -------------------------------------------------------------------------------- /CryptoLib.Tests/src/CryptoLibTestBase.pas: -------------------------------------------------------------------------------- 1 | unit CryptoLibTestBase; 2 | 3 | interface 4 | 5 | {$IFDEF FPC} 6 | {$MODE DELPHI} 7 | {$WARNINGS OFF} 8 | {$NOTES OFF} 9 | {$ENDIF FPC} 10 | 11 | uses 12 | SysUtils, 13 | {$IFDEF FPC} 14 | fpcunit, 15 | testregistry, 16 | {$ELSE} 17 | TestFramework, 18 | {$ENDIF FPC} 19 | ClpEncoders, 20 | ClpArrayUtils; 21 | 22 | type 23 | 24 | TCryptoLibTestCase = class abstract(TTestCase) 25 | 26 | end; 27 | 28 | type 29 | 30 | TCryptoLibAlgorithmTestCase = class abstract(TCryptoLibTestCase) 31 | protected 32 | 33 | function DecodeHex(const data: String): TBytes; 34 | function EncodeHex(const data: TBytes): String; 35 | function DecodeBase64(const data: String): TBytes; 36 | procedure ZeroFill(const data: TBytes); 37 | function Prepend(const data: TBytes; b: Byte): TBytes; 38 | function AreEqual(const A, b: TBytes): Boolean; 39 | 40 | end; 41 | 42 | implementation 43 | 44 | { TCryptoLibAlgorithmTestCase } 45 | 46 | function TCryptoLibAlgorithmTestCase.DecodeBase64(const data: String): TBytes; 47 | begin 48 | result := TBase64.Decode(data); 49 | end; 50 | 51 | function TCryptoLibAlgorithmTestCase.DecodeHex(const data: String): TBytes; 52 | begin 53 | result := THex.Decode(data); 54 | end; 55 | 56 | function TCryptoLibAlgorithmTestCase.EncodeHex(const data: TBytes): String; 57 | begin 58 | result := THex.Encode(data); 59 | end; 60 | 61 | function TCryptoLibAlgorithmTestCase.Prepend(const data: TBytes; 62 | b: Byte): TBytes; 63 | begin 64 | result := TArrayUtils.Prepend(data, b); 65 | end; 66 | 67 | procedure TCryptoLibAlgorithmTestCase.ZeroFill(const data: TBytes); 68 | begin 69 | TArrayUtils.ZeroFill(data); 70 | end; 71 | 72 | function TCryptoLibAlgorithmTestCase.AreEqual(const A, b: TBytes): Boolean; 73 | begin 74 | result := TArrayUtils.AreEqual(A, b); 75 | end; 76 | 77 | end. 78 | -------------------------------------------------------------------------------- /CryptoLib.Tests/src/Utils/ClpIShortenedDigest.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIShortenedDigest; 19 | 20 | interface 21 | 22 | {$IFDEF FPC} 23 | {$MODE DELPHI} 24 | {$ENDIF FPC} 25 | 26 | uses 27 | ClpIDigest, 28 | ClpCryptoLibTypes; 29 | 30 | type 31 | 32 | IShortenedDigest = interface(IDigest) 33 | ['{E19D250B-CAE0-4959-9211-80853FCF4ADD}'] 34 | 35 | end; 36 | 37 | implementation 38 | 39 | end. 40 | -------------------------------------------------------------------------------- /CryptoLib/src/Crypto/Parameters/ClpEd25519KeyGenerationParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpEd25519KeyGenerationParameters; 19 | 20 | {$I ..\..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpISecureRandom, 26 | ClpIEd25519KeyGenerationParameters, 27 | ClpKeyGenerationParameters; 28 | 29 | type 30 | TEd25519KeyGenerationParameters = class sealed(TKeyGenerationParameters, 31 | IEd25519KeyGenerationParameters) 32 | 33 | public 34 | constructor Create(const random: ISecureRandom); 35 | 36 | end; 37 | 38 | implementation 39 | 40 | { TEd25519KeyGenerationParameters } 41 | 42 | constructor TEd25519KeyGenerationParameters.Create(const random: ISecureRandom); 43 | begin 44 | Inherited Create(random, 256); 45 | end; 46 | 47 | end. 48 | -------------------------------------------------------------------------------- /CryptoLib/src/Crypto/Parameters/ClpX25519KeyGenerationParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpX25519KeyGenerationParameters; 19 | 20 | {$I ..\..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpISecureRandom, 26 | ClpIX25519KeyGenerationParameters, 27 | ClpKeyGenerationParameters; 28 | 29 | type 30 | TX25519KeyGenerationParameters = class sealed(TKeyGenerationParameters, 31 | IX25519KeyGenerationParameters) 32 | 33 | public 34 | constructor Create(const random: ISecureRandom); 35 | 36 | end; 37 | 38 | implementation 39 | 40 | { TX25519KeyGenerationParameters } 41 | 42 | constructor TX25519KeyGenerationParameters.Create(const random: ISecureRandom); 43 | begin 44 | Inherited Create(random, 255); 45 | end; 46 | 47 | end. 48 | -------------------------------------------------------------------------------- /CryptoLib/src/Include/CryptoLibHelper.inc: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | {$MACRO ON} 19 | {$IFDEF ENDIAN_BIG} 20 | {$MESSAGE FATAL 'This Library does not support "Big Endian" processors yet.'} 21 | {$ENDIF} 22 | // FPC 3.0.4 and Above 23 | // Had to Include this here since Delphi does not allow it Compile in "CryptoLib.inc". 24 | {$IF FPC_FULLVERSION < 30004} 25 | {$MESSAGE ERROR 'This Library requires FreePascal 3.0.4 or higher.'} 26 | {$IFEND} 27 | 28 | {$IF FPC_FULLVERSION > 30004} 29 | {$DEFINE FPC_GREATER_THAN_3.0.4} 30 | {$IFEND} 31 | 32 | {$IF FPC_FULLVERSION >= 30301} 33 | {$DEFINE HAS_VOLATILE} 34 | {$IFEND} 35 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIAesEngine.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIAesEngine; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIBlockCipher; 26 | 27 | type 28 | 29 | IAesEngine = interface(IBlockCipher) 30 | ['{984D6EC6-DBFC-4CEC-88B6-29B1C0BEA6CD}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIAesLightEngine.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIAesLightEngine; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIBlockCipher; 26 | 27 | type 28 | 29 | IAesLightEngine = interface(IBlockCipher) 30 | ['{DC3E80FD-A8C7-454D-9727-C8E68B006BA6}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIAlgorithmParameterSpec.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIAlgorithmParameterSpec; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | type 25 | IAlgorithmParameterSpec = interface(IInterface) 26 | ['{FBA69725-AEFF-4B99-92C0-1819E5DE2DA1}'] 27 | end; 28 | 29 | implementation 30 | 31 | end. 32 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIAsymmetricCipherKeyPair.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIAsymmetricCipherKeyPair; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIAsymmetricKeyParameter; 26 | 27 | type 28 | IAsymmetricCipherKeyPair = interface(IInterface) 29 | ['{66AD23CF-CE95-49C3-B9F0-83153174E9D7}'] 30 | 31 | function GetPrivate: IAsymmetricKeyParameter; 32 | function GetPublic: IAsymmetricKeyParameter; 33 | 34 | /// 35 | /// return the public key parameters. 36 | /// 37 | property &Public: IAsymmetricKeyParameter read GetPublic; 38 | 39 | /// 40 | /// return the private key parameters. 41 | /// 42 | property &Private: IAsymmetricKeyParameter read GetPrivate; 43 | 44 | end; 45 | 46 | implementation 47 | 48 | end. 49 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIAsymmetricCipherKeyPairGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIAsymmetricCipherKeyPairGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIKeyGenerationParameters, 26 | ClpIAsymmetricCipherKeyPair; 27 | 28 | type 29 | IAsymmetricCipherKeyPairGenerator = interface(IInterface) 30 | ['{BC73E9BF-24B2-4833-A8DA-B690FCC81A2F}'] 31 | 32 | // /** 33 | // * intialise the key pair generator. 34 | // * 35 | // * @param the parameters the key pair is to be initialised with. 36 | // */ 37 | procedure Init(const parameters: IKeyGenerationParameters); 38 | 39 | // /** 40 | // * return an AsymmetricCipherKeyPair containing the Generated keys. 41 | // * 42 | // * @return an AsymmetricCipherKeyPair containing the Generated keys. 43 | // */ 44 | function GenerateKeyPair(): IAsymmetricCipherKeyPair; 45 | 46 | end; 47 | 48 | implementation 49 | 50 | end. 51 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIAsymmetricKeyParameter.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIAsymmetricKeyParameter; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpICipherParameters; 26 | 27 | type 28 | 29 | IAsymmetricKeyParameter = interface(ICipherParameters) 30 | ['{306A2860-9D12-46BF-9994-BCDCEF63214F}'] 31 | 32 | function GetIsPrivate: Boolean; 33 | function GetPrivateKey: Boolean; 34 | property IsPrivate: Boolean read GetIsPrivate; 35 | property PrivateKey: Boolean read GetPrivateKey; 36 | function Equals(const other: IAsymmetricKeyParameter): Boolean; 37 | function GetHashCode(): {$IFDEF DELPHI}Int32; {$ELSE}PtrInt; 38 | {$ENDIF DELPHI} 39 | end; 40 | 41 | implementation 42 | 43 | end. 44 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIBaseKdfBytesGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIBaseKdfBytesGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDerivationFunction; 26 | 27 | type 28 | 29 | IBaseKdfBytesGenerator = interface(IDerivationFunction) 30 | ['{EFA36EF4-5403-4F47-A222-2F64820C9188}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIBlowfishEngine.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIBlowfishEngine; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIBlockCipher; 26 | 27 | type 28 | 29 | IBlowfishEngine = interface(IBlockCipher) 30 | ['{005CFC45-DEB3-4AC1-896D-1370AF09F3C5}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIBufferedBlockCipher.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIBufferedBlockCipher; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIBufferedCipherBase; 26 | 27 | type 28 | IBufferedBlockCipher = interface(IBufferedCipherBase) 29 | 30 | ['{A71190C5-154E-4C2B-B6B2-BC4460B201B5}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIBufferedCipherBase.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIBufferedCipherBase; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIBufferedCipher; 26 | 27 | type 28 | 29 | IBufferedCipherBase = interface(IBufferedCipher) 30 | ['{3CA69950-0A10-4227-B536-BFB3151076F9}'] 31 | end; 32 | 33 | implementation 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIBufferedStreamCipher.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIBufferedStreamCipher; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIBufferedCipherBase; 26 | 27 | type 28 | IBufferedStreamCipher = interface(IBufferedCipherBase) 29 | 30 | ['{F20A1BF7-4AA6-445C-8218-9EA0DF7FC123}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIChaChaEngine.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIChaChaEngine; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpISalsa20Engine; 26 | 27 | type 28 | 29 | IChaChaEngine = interface(ISalsa20Engine) 30 | ['{8CD31B82-B157-4A56-B529-E2F1079BADD8}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpICipherParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpICipherParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | type 25 | 26 | /// 27 | /// all parameter classes implement this. 28 | /// 29 | ICipherParameters = interface(IInterface) 30 | ['{F0418659-D74C-4B6A-85C0-A76E7CD1A9A2}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpICryptoApiRandomGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpICryptoApiRandomGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIRandomGenerator; 26 | 27 | type 28 | 29 | ICryptoApiRandomGenerator = interface(IRandomGenerator) 30 | ['{9602F758-A63D-4F60-94AF-26572B85BC81}'] 31 | end; 32 | 33 | implementation 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDHBasicAgreement.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDHBasicAgreement; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIBasicAgreement; 26 | 27 | type 28 | /// 29 | /// 30 | /// a Diffie-Hellman key agreement class. 31 | /// 32 | /// 33 | /// note: This is only the basic algorithm, it doesn't take advantage 34 | /// of long term public keys if they are available. See the DHAgreement 35 | /// class for a "better" implementation. 36 | /// 37 | /// 38 | IDHBasicAgreement = interface(IBasicAgreement) 39 | 40 | ['{913FB2D8-1DDB-4E68-8C67-2BDD796BE3A1}'] 41 | 42 | end; 43 | 44 | implementation 45 | 46 | end. 47 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDHBasicKeyPairGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDHBasicKeyPairGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIAsymmetricCipherKeyPairGenerator; 26 | 27 | type 28 | IDHBasicKeyPairGenerator = interface(IAsymmetricCipherKeyPairGenerator) 29 | ['{F8C67480-A3D5-45AC-BEB1-DA3C484844EC}'] 30 | end; 31 | 32 | implementation 33 | 34 | end. 35 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDHDomainParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDHDomainParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDHValidationParams, 26 | ClpIAsn1Objects; 27 | 28 | type 29 | IDHDomainParameters = interface(IAsn1Encodable) 30 | ['{18288135-B71F-48B4-8595-57AAB9092FC8}'] 31 | 32 | function GetP: IDerInteger; 33 | property p: IDerInteger read GetP; 34 | 35 | function GetG: IDerInteger; 36 | property g: IDerInteger read GetG; 37 | 38 | function GetQ: IDerInteger; 39 | property q: IDerInteger read GetQ; 40 | 41 | function GetJ: IDerInteger; 42 | property j: IDerInteger read GetJ; 43 | 44 | function GetValidationParams: IDHValidationParams; 45 | property validationParams: IDHValidationParams read GetValidationParams; 46 | 47 | end; 48 | 49 | implementation 50 | 51 | end. 52 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDHKeyGenerationParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDHKeyGenerationParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDHParameters, 26 | ClpIKeyGenerationParameters; 27 | 28 | type 29 | IDHKeyGenerationParameters = interface(IKeyGenerationParameters) 30 | ['{B513182A-1697-468E-A090-0E09C246BD8B}'] 31 | 32 | function GetParameters: IDHParameters; 33 | 34 | property parameters: IDHParameters read GetParameters; 35 | 36 | end; 37 | 38 | implementation 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDHKeyGeneratorHelper.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDHKeyGeneratorHelper; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpISecureRandom, 26 | ClpBigInteger, 27 | ClpIDHParameters; 28 | 29 | type 30 | IDHKeyGeneratorHelper = interface(IInterface) 31 | ['{D4A55B45-E354-45A8-BCB7-871D7208A855}'] 32 | 33 | function CalculatePrivate(const dhParams: IDHParameters; 34 | const random: ISecureRandom): TBigInteger; 35 | 36 | function CalculatePublic(const dhParams: IDHParameters; 37 | const x: TBigInteger): TBigInteger; 38 | 39 | end; 40 | 41 | implementation 42 | 43 | end. 44 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDHKeyPairGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDHKeyPairGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIAsymmetricCipherKeyPairGenerator; 26 | 27 | type 28 | IDHKeyPairGenerator = interface(IAsymmetricCipherKeyPairGenerator) 29 | ['{016112AA-A9AD-43E3-A3AA-25428682396F}'] 30 | end; 31 | 32 | implementation 33 | 34 | end. 35 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDHKeyParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDHKeyParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDHParameters, 26 | ClpIAsn1Objects, 27 | ClpIAsymmetricKeyParameter; 28 | 29 | type 30 | IDHKeyParameters = interface(IAsymmetricKeyParameter) 31 | ['{53834D98-B75A-4607-BA38-3CD9DE3B3CF4}'] 32 | 33 | function GetParameters: IDHParameters; 34 | function GetAlgorithmOid: IDerObjectIdentifier; 35 | 36 | function Equals(const other: IDHKeyParameters): Boolean; overload; 37 | property parameters: IDHParameters read GetParameters; 38 | property AlgorithmOid: IDerObjectIdentifier read GetAlgorithmOid; 39 | 40 | end; 41 | 42 | implementation 43 | 44 | end. 45 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDHParametersGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDHParametersGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpISecureRandom, 26 | ClpIDHParameters; 27 | 28 | type 29 | IDHParametersGenerator = interface(IInterface) 30 | ['{ECE2C3CF-4DA4-450B-BB37-2C100BC72FF6}'] 31 | 32 | procedure Init(size, certainty: Int32; const random: ISecureRandom); 33 | 34 | /// 35 | /// 36 | /// which Generates the p and g values from the given parameters, 37 | /// returning the DHParameters object. 38 | /// 39 | /// 40 | /// Note: can take a while... 41 | /// 42 | /// 43 | function GenerateParameters(): IDHParameters; 44 | 45 | end; 46 | 47 | implementation 48 | 49 | end. 50 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDHPrivateKeyParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDHPrivateKeyParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDHKeyParameters, 26 | ClpBigInteger; 27 | 28 | type 29 | IDHPrivateKeyParameters = interface(IDHKeyParameters) 30 | ['{946AD4C3-6B77-46F5-871C-C8958DD371E0}'] 31 | 32 | function GetX: TBigInteger; 33 | 34 | function Equals(const other: IDHPrivateKeyParameters): Boolean; overload; 35 | property X: TBigInteger read GetX; 36 | 37 | end; 38 | 39 | implementation 40 | 41 | end. 42 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDHPublicKeyParameters.pas: -------------------------------------------------------------------------------- 1 | { * Github Repository * } 2 | 3 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 4 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 5 | 6 | { * Acknowledgements: * } 7 | { * * } 8 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 9 | { * development of this library * } 10 | 11 | { * ******************************************************************************* * } 12 | 13 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 14 | 15 | unit ClpIDHPublicKeyParameters; 16 | 17 | {$I ..\Include\CryptoLib.inc} 18 | 19 | interface 20 | 21 | uses 22 | ClpIDHKeyParameters, 23 | ClpBigInteger; 24 | 25 | type 26 | IDHPublicKeyParameters = interface(IDHKeyParameters) 27 | ['{F78EC20B-B591-42AB-87F3-22011F1DE05E}'] 28 | 29 | function GetY: TBigInteger; 30 | 31 | function Equals(const other: IDHPublicKeyParameters): Boolean; overload; 32 | property y: TBigInteger read GetY; 33 | 34 | end; 35 | 36 | implementation 37 | 38 | end. 39 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDHValidationParameters.pas: -------------------------------------------------------------------------------- 1 | { * Github Repository * } 2 | 3 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 4 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 5 | 6 | { * Acknowledgements: * } 7 | { * * } 8 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 9 | { * development of this library * } 10 | 11 | { * ******************************************************************************* * } 12 | 13 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 14 | 15 | unit ClpIDHValidationParameters; 16 | 17 | {$I ..\Include\CryptoLib.inc} 18 | 19 | interface 20 | 21 | uses 22 | ClpCryptoLibTypes; 23 | 24 | type 25 | IDHValidationParameters = interface(IInterface) 26 | ['{6F7404A7-0588-4154-8955-8C1A5C757B17}'] 27 | 28 | function GetCounter: Int32; 29 | function GetSeed: TCryptoLibByteArray; 30 | 31 | function Equals(const other: IDHValidationParameters): Boolean; 32 | function GetHashCode(): {$IFDEF DELPHI}Int32; {$ELSE}PtrInt; 33 | {$ENDIF DELPHI} 34 | property counter: Int32 read GetCounter; 35 | property seed: TCryptoLibByteArray read GetSeed; 36 | end; 37 | 38 | implementation 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDHValidationParams.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDHValidationParams; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIAsn1Objects; 26 | 27 | type 28 | IDHValidationParams = interface(IAsn1Encodable) 29 | ['{A75D3486-080A-43F5-9296-9C74B7DEE7DC}'] 30 | 31 | function GetSeed: IDerBitString; 32 | property Seed: IDerBitString read GetSeed; 33 | 34 | function GetPGenCounter: IDerInteger; 35 | property PGenCounter: IDerInteger read GetPGenCounter; 36 | 37 | end; 38 | 39 | implementation 40 | 41 | end. 42 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDerivationParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDerivationParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | type 25 | 26 | /// 27 | /// Parameters for key/byte stream derivation classes 28 | /// 29 | IDerivationParameters = interface(IInterface) 30 | ['{4F245EE6-734C-4D45-ADB5-F719F4098BB5}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDigestRandomGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDigestRandomGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIRandomGenerator; 26 | 27 | type 28 | 29 | IDigestRandomGenerator = interface(IRandomGenerator) 30 | ['{1D9AA8E6-1709-4121-8835-61A7F543FB54}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDsaDigestSigner.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDsaDigestSigner; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpBigInteger, 26 | ClpISigner; 27 | 28 | type 29 | 30 | IDsaDigestSigner = interface(ISigner) 31 | ['{6BED77E2-6D92-4DB7-8F3F-588EC528A2D7}'] 32 | 33 | function GetOrder(): TBigInteger; 34 | 35 | end; 36 | 37 | implementation 38 | 39 | end. 40 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDsaExt.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDsaExt; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDsa, 26 | ClpBigInteger; 27 | 28 | type 29 | /// 30 | /// An "extended" interface for classes implementing DSA-style algorithms, that provides access 31 | /// to the group order. 32 | /// 33 | IDsaExt = interface(IDsa) 34 | ['{FF9421DB-97F1-4409-AC00-B0000EE5EAFB}'] 35 | 36 | function GetOrder: TBigInteger; 37 | /// The order of the group that the r, s values in signatures belong to. 38 | property Order: TBigInteger read GetOrder; 39 | 40 | end; 41 | 42 | implementation 43 | 44 | end. 45 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDsaKeyGenerationParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDsaKeyGenerationParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDsaParameters, 26 | ClpIKeyGenerationParameters; 27 | 28 | type 29 | IDsaKeyGenerationParameters = interface(IKeyGenerationParameters) 30 | ['{0EBFC33A-31D3-4F20-8836-35250F53EA73}'] 31 | 32 | function GetParameters: IDsaParameters; 33 | 34 | property parameters: IDsaParameters read GetParameters; 35 | 36 | end; 37 | 38 | implementation 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDsaKeyPairGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDsaKeyPairGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIAsymmetricCipherKeyPairGenerator; 26 | 27 | type 28 | IDsaKeyPairGenerator = interface(IAsymmetricCipherKeyPairGenerator) 29 | ['{37A4647D-2D9A-4EB1-A2AF-B3FBE72B66F3}'] 30 | end; 31 | 32 | implementation 33 | 34 | end. 35 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDsaKeyParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDsaKeyParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDsaParameters, 26 | ClpIAsymmetricKeyParameter; 27 | 28 | type 29 | IDsaKeyParameters = interface(IAsymmetricKeyParameter) 30 | ['{1E3454DF-DC9F-4EA0-91DA-0768A77387C5}'] 31 | 32 | function GetParameters: IDsaParameters; 33 | 34 | function Equals(const other: IDsaKeyParameters): Boolean; overload; 35 | property parameters: IDsaParameters read GetParameters; 36 | 37 | end; 38 | 39 | implementation 40 | 41 | end. 42 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDsaParameter.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDsaParameter; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIAsn1Objects, 26 | ClpBigInteger; 27 | 28 | type 29 | IDsaParameter = interface(IAsn1Encodable) 30 | ['{037E0113-0BD6-4A61-8BDC-DBEBE6136A6C}'] 31 | 32 | function GetP: TBigInteger; 33 | property p: TBigInteger read GetP; 34 | 35 | function GetG: TBigInteger; 36 | property g: TBigInteger read GetG; 37 | 38 | function GetQ: TBigInteger; 39 | property q: TBigInteger read GetQ; 40 | 41 | end; 42 | 43 | implementation 44 | 45 | end. 46 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDsaParameterGenerationParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDsaParameterGenerationParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpISecureRandom; 26 | 27 | type 28 | IDsaParameterGenerationParameters = interface(IInterface) 29 | ['{52ACCC72-7FF6-4934-81E5-F616BEB0EE04}'] 30 | 31 | function GetL: Int32; 32 | property L: Int32 read GetL; 33 | 34 | function GetN: Int32; 35 | property N: Int32 read GetN; 36 | 37 | function GetUsageIndex: Int32; 38 | property usageIndex: Int32 read GetUsageIndex; 39 | 40 | function GetCertainty: Int32; 41 | property certainty: Int32 read GetCertainty; 42 | 43 | function GetRandom: ISecureRandom; 44 | property random: ISecureRandom read GetRandom; 45 | end; 46 | 47 | implementation 48 | 49 | end. 50 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDsaParameters.pas: -------------------------------------------------------------------------------- 1 | { * Github Repository * } 2 | 3 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 4 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 5 | 6 | { * Acknowledgements: * } 7 | { * * } 8 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 9 | { * development of this library * } 10 | 11 | { * ******************************************************************************* * } 12 | 13 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 14 | 15 | unit ClpIDsaParameters; 16 | 17 | {$I ..\Include\CryptoLib.inc} 18 | 19 | interface 20 | 21 | uses 22 | ClpICipherParameters, 23 | ClpIDsaValidationParameters, 24 | ClpBigInteger; 25 | 26 | type 27 | IDsaParameters = interface(ICipherParameters) 28 | ['{6A088962-AF58-4699-83B9-ADDABFC65A7E}'] 29 | 30 | function GetG: TBigInteger; 31 | function GetP: TBigInteger; 32 | function GetQ: TBigInteger; 33 | function GetValidationParameters: IDsaValidationParameters; 34 | 35 | function Equals(const other: IDsaParameters): Boolean; 36 | function GetHashCode(): {$IFDEF DELPHI}Int32; {$ELSE}PtrInt; 37 | {$ENDIF DELPHI} 38 | property p: TBigInteger read GetP; 39 | property q: TBigInteger read GetQ; 40 | property g: TBigInteger read GetG; 41 | property ValidationParameters: IDsaValidationParameters 42 | read GetValidationParameters; 43 | 44 | end; 45 | 46 | implementation 47 | 48 | end. 49 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDsaPrivateKeyParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDsaPrivateKeyParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDsaKeyParameters, 26 | ClpBigInteger; 27 | 28 | type 29 | IDsaPrivateKeyParameters = interface(IDsaKeyParameters) 30 | ['{A956E21D-0A60-4073-8F17-5EA8B4615B68}'] 31 | 32 | function GetX: TBigInteger; 33 | 34 | function Equals(const other: IDsaPrivateKeyParameters): Boolean; overload; 35 | property X: TBigInteger read GetX; 36 | 37 | end; 38 | 39 | implementation 40 | 41 | end. 42 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDsaPublicKeyParameters.pas: -------------------------------------------------------------------------------- 1 | { * Github Repository * } 2 | 3 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 4 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 5 | 6 | { * Acknowledgements: * } 7 | { * * } 8 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 9 | { * development of this library * } 10 | 11 | { * ******************************************************************************* * } 12 | 13 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 14 | 15 | unit ClpIDsaPublicKeyParameters; 16 | 17 | {$I ..\Include\CryptoLib.inc} 18 | 19 | interface 20 | 21 | uses 22 | ClpIDsaKeyParameters, 23 | ClpBigInteger; 24 | 25 | type 26 | IDsaPublicKeyParameters = interface(IDsaKeyParameters) 27 | ['{B3F14490-AF3D-437C-9E42-B6940B2ECADE}'] 28 | 29 | function GetY: TBigInteger; 30 | 31 | function Equals(const other: IDsaPublicKeyParameters): Boolean; overload; 32 | property y: TBigInteger read GetY; 33 | 34 | end; 35 | 36 | implementation 37 | 38 | end. 39 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDsaSigner.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIDsaSigner; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDsaExt, 26 | ClpISecureRandom, 27 | ClpBigInteger, 28 | ClpCryptoLibTypes; 29 | 30 | type 31 | IDsaSigner = interface(IDsaExt) 32 | ['{687C14CD-F126-4886-87FC-535DEB083C2F}'] 33 | 34 | function CalculateE(const n: TBigInteger; 35 | const &message: TCryptoLibByteArray): TBigInteger; 36 | 37 | function InitSecureRandom(needed: Boolean; const provided: ISecureRandom) 38 | : ISecureRandom; 39 | 40 | end; 41 | 42 | implementation 43 | 44 | end. 45 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIDsaValidationParameters.pas: -------------------------------------------------------------------------------- 1 | { * Github Repository * } 2 | 3 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 4 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 5 | 6 | { * Acknowledgements: * } 7 | { * * } 8 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 9 | { * development of this library * } 10 | 11 | { * ******************************************************************************* * } 12 | 13 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 14 | 15 | unit ClpIDsaValidationParameters; 16 | 17 | {$I ..\Include\CryptoLib.inc} 18 | 19 | interface 20 | 21 | uses 22 | ClpCryptoLibTypes; 23 | 24 | type 25 | IDsaValidationParameters = interface(IInterface) 26 | ['{F7C394CB-BDC3-47B5-835F-6216FBBF90F9}'] 27 | 28 | function GetCounter: Int32; 29 | function GetUsageIndex: Int32; 30 | function GetSeed: TCryptoLibByteArray; 31 | 32 | function Equals(const other: IDsaValidationParameters): Boolean; 33 | function GetHashCode(): {$IFDEF DELPHI}Int32; {$ELSE}PtrInt; 34 | {$ENDIF DELPHI} 35 | property counter: Int32 read GetCounter; 36 | property usageIndex: Int32 read GetUsageIndex; 37 | property seed: TCryptoLibByteArray read GetSeed; 38 | end; 39 | 40 | implementation 41 | 42 | end. 43 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIECDsaSigner.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIECDsaSigner; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDsaExt, 26 | ClpISecureRandom, 27 | ClpBigInteger, 28 | ClpCryptoLibTypes, 29 | ClpIECC; 30 | 31 | type 32 | IECDsaSigner = interface(IDsaExt) 33 | 34 | ['{72930065-5893-46CA-B49F-51254C2E73FF}'] 35 | 36 | function CalculateE(const n: TBigInteger; 37 | const &message: TCryptoLibByteArray): TBigInteger; 38 | 39 | function CreateBasePointMultiplier(): IECMultiplier; 40 | 41 | function GetDenominator(coordinateSystem: Int32; const p: IECPoint) 42 | : IECFieldElement; 43 | 44 | function InitSecureRandom(needed: Boolean; const provided: ISecureRandom) 45 | : ISecureRandom; 46 | 47 | end; 48 | 49 | implementation 50 | 51 | end. 52 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIECIESPublicKeyParser.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIECIESPublicKeyParser; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | Classes, 26 | ClpIKeyParser; 27 | 28 | type 29 | 30 | IECIESPublicKeyParser = interface(IKeyParser) 31 | ['{7A948776-4DD9-4290-BCDF-EB96800AEAF6}'] 32 | 33 | end; 34 | 35 | implementation 36 | 37 | end. 38 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIECKeyGenerationParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIECKeyGenerationParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIECDomainParameters, 26 | ClpIKeyGenerationParameters; 27 | 28 | type 29 | IECKeyGenerationParameters = interface(IKeyGenerationParameters) 30 | ['{B9343CA3-9274-4812-9FFC-2CC27486261E}'] 31 | 32 | function GetDomainParameters: IECDomainParameters; 33 | property domainParameters: IECDomainParameters read GetDomainParameters; 34 | end; 35 | 36 | implementation 37 | 38 | end. 39 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIECKeyPairGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIECKeyPairGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIAsymmetricCipherKeyPairGenerator; 26 | 27 | type 28 | IECKeyPairGenerator = interface(IAsymmetricCipherKeyPairGenerator) 29 | ['{D9EB8914-BCE1-413B-A1CF-79ECED965C4F}'] 30 | 31 | end; 32 | 33 | implementation 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIECKeyParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIECKeyParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | 26 | ClpIAsymmetricKeyParameter, 27 | ClpIECDomainParameters; 28 | 29 | type 30 | IECKeyParameters = interface(IAsymmetricKeyParameter) 31 | ['{50966A0E-21A4-41C3-9246-87B4ED67CE4D}'] 32 | 33 | function GetAlgorithmName: String; 34 | function GetParameters: IECDomainParameters; 35 | 36 | function Equals(const other: IECKeyParameters): Boolean; overload; 37 | 38 | property AlgorithmName: String read GetAlgorithmName; 39 | property Parameters: IECDomainParameters read GetParameters; 40 | 41 | end; 42 | 43 | implementation 44 | 45 | end. 46 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIECNRSigner.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIECNRSigner; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDsaExt, 26 | ClpBigInteger, 27 | ClpCryptoLibTypes; 28 | 29 | type 30 | IECNRSigner = interface(IDsaExt) 31 | ['{C136F005-404E-4022-886E-DE5EFCECFF9C}'] 32 | 33 | function GetRecoveredMessage(const r, s: TBigInteger): TCryptoLibByteArray; 34 | 35 | end; 36 | 37 | implementation 38 | 39 | end. 40 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIECPrivateKeyParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIECPrivateKeyParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpBigInteger, 26 | ClpIECKeyParameters; 27 | 28 | type 29 | 30 | IECPrivateKeyParameters = interface(IECKeyParameters) 31 | ['{49066428-4021-4E3C-A9F5-AB2127289A67}'] 32 | 33 | function Equals(const other: IECPrivateKeyParameters): Boolean; overload; 34 | function GetD: TBigInteger; 35 | property D: TBigInteger read GetD; 36 | end; 37 | 38 | implementation 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIECPublicKeyParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIECPublicKeyParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIECC, 26 | ClpIECKeyParameters; 27 | 28 | type 29 | 30 | IECPublicKeyParameters = interface(IECKeyParameters) 31 | ['{4BABC163-847A-4FE2-AA16-5CD100F76124}'] 32 | 33 | function Equals(const other: IECPublicKeyParameters): Boolean; overload; 34 | function GetQ: IECPoint; 35 | property Q: IECPoint read GetQ; 36 | end; 37 | 38 | implementation 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIECSchnorrSipaSigner.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIECSchnorrSipaSigner; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpISchnorrExt; 26 | 27 | type 28 | IECSchnorrSipaSigner = interface(ISchnorrExt) 29 | ['{8941641A-4EF7-4BC7-96FC-F6E98F418DC8}'] 30 | 31 | end; 32 | 33 | implementation 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIEd25519CtxSigner.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIEd25519CtxSigner; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpISigner; 26 | 27 | type 28 | IEd25519CtxSigner = interface(ISigner) 29 | 30 | ['{EF0302AE-A4FE-46B8-8839-8B7450EE977B}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIEd25519KeyGenerationParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIEd25519KeyGenerationParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIKeyGenerationParameters; 26 | 27 | type 28 | IEd25519KeyGenerationParameters = interface(IKeyGenerationParameters) 29 | ['{65D7E76D-588F-4499-BE57-ADA4273C68B9}'] 30 | 31 | end; 32 | 33 | implementation 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIEd25519KeyPairGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIEd25519KeyPairGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIAsymmetricCipherKeyPairGenerator; 26 | 27 | type 28 | IEd25519KeyPairGenerator = interface(IAsymmetricCipherKeyPairGenerator) 29 | ['{7A9A2591-E1F0-4D41-8DB3-8D56822B5AF0}'] 30 | 31 | end; 32 | 33 | implementation 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIEd25519PhSigner.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIEd25519PhSigner; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpISigner; 26 | 27 | type 28 | IEd25519PhSigner = interface(ISigner) 29 | 30 | ['{7E2EBA92-1D10-474D-8342-2ED64D0DACE5}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIEd25519PublicKeyParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIEd25519PublicKeyParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIAsymmetricKeyParameter, 26 | ClpCryptoLibTypes; 27 | 28 | type 29 | IEd25519PublicKeyParameters = interface(IAsymmetricKeyParameter) 30 | ['{84C0E096-F4BA-438D-9E20-3ECFAE341E63}'] 31 | 32 | procedure Encode(const buf: TCryptoLibByteArray; off: Int32); 33 | function GetEncoded(): TCryptoLibByteArray; 34 | 35 | function Equals(const other: IEd25519PublicKeyParameters): Boolean; 36 | overload; 37 | end; 38 | 39 | implementation 40 | 41 | end. 42 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIEd25519Signer.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIEd25519Signer; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpISigner; 26 | 27 | type 28 | IEd25519Signer = interface(ISigner) 29 | 30 | ['{A7DC401C-ABF9-4615-AEB0-705B278DBEB9}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIEndoPreCompInfo.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIEndoPreCompInfo; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIECC, 26 | ClpIPreCompInfo; 27 | 28 | type 29 | IEndoPreCompInfo = interface(IPreCompInfo) 30 | ['{84C79A80-8162-4079-8146-AA1D46A739ED}'] 31 | 32 | function GetEndomorphism: IECEndomorphism; 33 | procedure SetEndomorphism(const value: IECEndomorphism); 34 | 35 | property Endomorphism: IECEndomorphism read GetEndomorphism 36 | write SetEndomorphism; 37 | 38 | function GetMappedPoint: IECPoint; 39 | procedure SetMappedPoint(const value: IECPoint); 40 | 41 | property MappedPoint: IECPoint read GetMappedPoint write SetMappedPoint; 42 | 43 | end; 44 | 45 | implementation 46 | 47 | end. 48 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIEphemeralKeyPair.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIEphemeralKeyPair; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIAsymmetricCipherKeyPair, 26 | ClpCryptoLibTypes; 27 | 28 | type 29 | IEphemeralKeyPair = interface(IInterface) 30 | ['{E3CEA842-F26D-445C-8DDE-BAB041018DA0}'] 31 | 32 | function GetKeyPair(): IAsymmetricCipherKeyPair; 33 | 34 | function GetEncodedPublicKey(): TCryptoLibByteArray; 35 | 36 | end; 37 | 38 | implementation 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIEphemeralKeyPairGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIEphemeralKeyPairGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIEphemeralKeyPair; 26 | 27 | type 28 | IEphemeralKeyPairGenerator = interface(IInterface) 29 | ['{22E74B03-0BAA-47CA-8E62-764720D87663}'] 30 | 31 | function Generate(): IEphemeralKeyPair; 32 | 33 | end; 34 | 35 | implementation 36 | 37 | end. 38 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIExtensionField.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIExtensionField; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIFiniteField; 26 | 27 | type 28 | 29 | IExtensionField = interface(IFiniteField) 30 | ['{262CB0BB-E070-4B0A-971B-33F4357BC4B5}'] 31 | 32 | function GetDegree: Int32; 33 | function GetSubfield: IFiniteField; 34 | property Degree: Int32 read GetDegree; 35 | property Subfield: IFiniteField read GetSubfield; 36 | 37 | end; 38 | 39 | implementation 40 | 41 | end. 42 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIFiniteField.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIFiniteField; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpBigInteger; 26 | 27 | type 28 | 29 | IFiniteField = interface(IInterface) 30 | ['{54DEBFF8-A0DF-4406-8F0C-FB1D0BD2619B}'] 31 | 32 | function GetCharacteristic: TBigInteger; 33 | function GetDimension: Int32; 34 | property Characteristic: TBigInteger read GetCharacteristic; 35 | property Dimension: Int32 read GetDimension; 36 | 37 | end; 38 | 39 | implementation 40 | 41 | end. 42 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIFixedPointPreCompInfo.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIFixedPointPreCompInfo; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpCryptoLibTypes, 26 | ClpIECC, 27 | ClpIPreCompInfo; 28 | 29 | type 30 | IFixedPointPreCompInfo = interface(IPreCompInfo) 31 | ['{FD2E7BE8-D353-4229-981A-744A50EE9F7F}'] 32 | 33 | function GetWidth: Int32; 34 | procedure SetWidth(const Value: Int32); 35 | function GetLookupTable: IECLookupTable; 36 | procedure SetLookupTable(const Value: IECLookupTable); 37 | function GetOffset: IECPoint; 38 | procedure SetOffset(const Value: IECPoint); 39 | 40 | property Offset: IECPoint read GetOffset write SetOffset; 41 | 42 | property LookupTable: IECLookupTable read GetLookupTable 43 | write SetLookupTable; 44 | property Width: Int32 read GetWidth write SetWidth; 45 | 46 | end; 47 | 48 | implementation 49 | 50 | end. 51 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIGF2Polynomial.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIGF2Polynomial; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpCryptoLibTypes, 26 | ClpIPolynomial; 27 | 28 | type 29 | IGF2Polynomial = interface(IPolynomial) 30 | ['{B60318B7-B459-4C09-9D0A-67C84DF794B3}'] 31 | 32 | function GetExponents: TCryptoLibInt32Array; 33 | 34 | function Equals(const other: IGF2Polynomial): Boolean; 35 | function GetHashCode(): {$IFDEF DELPHI}Int32; {$ELSE}PtrInt; 36 | {$ENDIF DELPHI} 37 | property exponents: TCryptoLibInt32Array read GetExponents; 38 | 39 | end; 40 | 41 | implementation 42 | 43 | end. 44 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIGenericPolynomialExtensionField.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIGenericPolynomialExtensionField; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpBigInteger, 26 | ClpIPolynomialExtensionField; 27 | 28 | type 29 | IGenericPolynomialExtensionField = interface(IPolynomialExtensionField) 30 | ['{BB3A963B-38E1-4DF0-A0C6-86DF5CE830FA}'] 31 | 32 | function Equals(other: TObject): Boolean; overload; 33 | function Equals(const other: IGenericPolynomialExtensionField) 34 | : Boolean; overload; 35 | function GetHashCode(): {$IFDEF DELPHI}Int32; {$ELSE}PtrInt; 36 | {$ENDIF DELPHI} 37 | end; 38 | 39 | implementation 40 | 41 | end. 42 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIGlvEndomorphism.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIGlvEndomorphism; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpCryptoLibTypes, 26 | ClpBigInteger, 27 | ClpIECC; 28 | 29 | type 30 | IGlvEndomorphism = interface(IECEndomorphism) 31 | 32 | ['{FC8EE19A-A707-438F-81CF-C6C6C7D7C36C}'] 33 | 34 | function DecomposeScalar(const k: TBigInteger) 35 | : TCryptoLibGenericArray; 36 | 37 | end; 38 | 39 | implementation 40 | 41 | end. 42 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIGlvTypeAEndomorphism.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIGlvTypeAEndomorphism; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpBigInteger, 26 | ClpIGlvEndomorphism; 27 | 28 | type 29 | IGlvTypeAEndomorphism = interface(IGlvEndomorphism) 30 | ['{961A1588-7D37-46C5-BC67-F71063641B42}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIGlvTypeAParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIGlvTypeAParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpBigInteger, 26 | ClpIScalarSplitParameters, 27 | ClpCryptoLibTypes; 28 | 29 | type 30 | 31 | IGlvTypeAParameters = interface(IInterface) 32 | ['{B5DDABB5-B51C-41F4-B2FD-6C8733300502}'] 33 | 34 | function GetI: TBigInteger; 35 | function GetLambda: TBigInteger; 36 | function GetSplitParams: IScalarSplitParameters; 37 | 38 | property I: TBigInteger read GetI; 39 | property lambda: TBigInteger read GetLambda; 40 | property splitParams: IScalarSplitParameters read GetSplitParams; 41 | 42 | end; 43 | 44 | implementation 45 | 46 | end. 47 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIGlvTypeBEndomorphism.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIGlvTypeBEndomorphism; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpBigInteger, 26 | ClpIGlvEndomorphism; 27 | 28 | type 29 | IGlvTypeBEndomorphism = interface(IGlvEndomorphism) 30 | ['{4F285F6A-F627-4873-9F4C-FBC7A7B83A9C}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIGlvTypeBParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIGlvTypeBParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpBigInteger, 26 | ClpIScalarSplitParameters, 27 | ClpCryptoLibTypes; 28 | 29 | type 30 | 31 | IGlvTypeBParameters = interface(IInterface) 32 | ['{089AC2AB-15A1-47F5-BED0-C09EA77BECB9}'] 33 | 34 | function GetLambda: TBigInteger; 35 | function GetBeta: TBigInteger; 36 | function GetSplitParams: IScalarSplitParameters; 37 | 38 | property lambda: TBigInteger read GetLambda; 39 | property beta: TBigInteger read GetBeta; 40 | property splitParams: IScalarSplitParameters read GetSplitParams; 41 | 42 | end; 43 | 44 | implementation 45 | 46 | end. 47 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIHMac.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIHMac; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDigest, 26 | ClpIMac; 27 | 28 | type 29 | 30 | IHMac = interface(IMac) 31 | ['{B1182608-04D5-4985-91C8-571C51E07CB5}'] 32 | 33 | function GetUnderlyingDigest: IDigest; 34 | 35 | end; 36 | 37 | implementation 38 | 39 | end. 40 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIHMacDsaKCalculator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIHMacDsaKCalculator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDsaKCalculator; 26 | 27 | type 28 | /// 29 | /// A deterministic K calculator based on the algorithm in section 3.2 of 30 | /// RFC 6979. 31 | /// 32 | IHMacDsaKCalculator = interface(IDsaKCalculator) 33 | ['{A075E2C3-2EE8-4CAC-BDF8-977408617B98}'] 34 | 35 | end; 36 | 37 | implementation 38 | 39 | end. 40 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIHkdfBytesGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIHkdfBytesGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDerivationFunction; 26 | 27 | type 28 | IHkdfBytesGenerator = interface(IDerivationFunction) 29 | ['{79B29B35-33BB-4056-9101-828C88D1ADB0}'] 30 | 31 | end; 32 | 33 | implementation 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIIESWithCipherParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIIESWithCipherParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIIESParameters, 26 | ClpCryptoLibTypes; 27 | 28 | type 29 | 30 | IIESWithCipherParameters = interface(IIESParameters) 31 | ['{77F38EA8-08F2-4D0D-A8E9-F3796DCCCA54}'] 32 | 33 | function GetCipherKeySize: Int32; 34 | 35 | /// 36 | /// Return the key size in bits for the block cipher used with the message 37 | /// 38 | /// 39 | /// the key size in bits for the block cipher used with the message 40 | /// 41 | property CipherKeySize: Int32 read GetCipherKeySize; 42 | 43 | end; 44 | 45 | implementation 46 | 47 | end. 48 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIIso18033KdfParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIIso18033KdfParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDerivationParameters, 26 | ClpCryptoLibTypes; 27 | 28 | type 29 | 30 | IIso18033KdfParameters = interface(IDerivationParameters) 31 | ['{FFECB534-B0D3-47C1-83EE-B91B5760F07D}'] 32 | 33 | function GetSeed(): TCryptoLibByteArray; 34 | 35 | end; 36 | 37 | implementation 38 | 39 | end. 40 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIKMac.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIKMac; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIMac; 26 | 27 | type 28 | 29 | IKMac = interface(IMac) 30 | ['{8C0D16C4-80DD-4E8A-8D1D-958AD7C442DD}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIKdf1BytesGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIKdf1BytesGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIBaseKdfBytesGenerator; 26 | 27 | type 28 | 29 | IKdf1BytesGenerator = interface(IBaseKdfBytesGenerator) 30 | ['{FD2AF455-8C5D-4860-A1D5-B70E5D417841}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIKdf2BytesGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIKdf2BytesGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIBaseKdfBytesGenerator; 26 | 27 | type 28 | 29 | IKdf2BytesGenerator = interface(IBaseKdfBytesGenerator) 30 | ['{771B832D-12FA-45D0-A8AC-E3EE068706BB}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIKdfParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIKdfParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIDerivationParameters, 26 | ClpCryptoLibTypes; 27 | 28 | type 29 | 30 | IKdfParameters = interface(IDerivationParameters) 31 | ['{2DCF1BDD-90A5-4501-8F7A-F22E896A0219}'] 32 | 33 | function GetSharedSecret(): TCryptoLibByteArray; 34 | function GetIV(): TCryptoLibByteArray; 35 | 36 | end; 37 | 38 | implementation 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIKeyEncoder.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIKeyEncoder; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIAsymmetricKeyParameter, 26 | ClpCryptoLibTypes; 27 | 28 | type 29 | IKeyEncoder = interface(IInterface) 30 | ['{CB751E36-F07C-46B7-B799-F20D0E7E888A}'] 31 | 32 | function GetEncoded(const keyParameter: IAsymmetricKeyParameter) 33 | : TCryptoLibByteArray; 34 | end; 35 | 36 | implementation 37 | 38 | end. 39 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIKeyParameter.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIKeyParameter; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpICipherParameters, 26 | ClpCryptoLibTypes; 27 | 28 | type 29 | 30 | IKeyParameter = interface(ICipherParameters) 31 | ['{92E7D4F7-40E5-4DC1-8058-23BE60848CC3}'] 32 | 33 | function GetKey(): TCryptoLibByteArray; 34 | procedure Clear(); 35 | 36 | end; 37 | 38 | implementation 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIKeyParser.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIKeyParser; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | Classes, 26 | ClpIAsymmetricKeyParameter; 27 | 28 | type 29 | IKeyParser = interface(IInterface) 30 | 31 | ['{12C134F7-7A7F-4F52-B963-ACA8DC933B48}'] 32 | 33 | // raises EIOCryptoLibException if read fails 34 | function ReadKey(const stream: TStream): IAsymmetricKeyParameter; 35 | 36 | end; 37 | 38 | implementation 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIOidTokenizer.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIOidTokenizer; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | type 25 | 26 | IOidTokenizer = interface(IInterface) 27 | ['{726E895B-44AC-4EC1-B20E-837598CB9D44}'] 28 | 29 | function GetHasMoreTokens: Boolean; 30 | 31 | function NextToken(): String; 32 | 33 | property HasMoreTokens: Boolean read GetHasMoreTokens; 34 | 35 | end; 36 | 37 | implementation 38 | 39 | end. 40 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIPaddedBufferedBlockCipher.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIPaddedBufferedBlockCipher; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIBufferedBlockCipher; 26 | 27 | type 28 | 29 | IPaddedBufferedBlockCipher = interface(IBufferedBlockCipher) 30 | 31 | ['{26445506-BDA8-43A0-8184-1D9D8E9AE386}'] 32 | 33 | end; 34 | 35 | implementation 36 | 37 | end. 38 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIParametersWithIV.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIParametersWithIV; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpICipherParameters, 26 | ClpCryptoLibTypes; 27 | 28 | type 29 | IParametersWithIV = interface(ICipherParameters) 30 | ['{9EC8D509-C7FA-4A25-AB5A-CD0B2EA57591}'] 31 | 32 | function GetIV(): TCryptoLibByteArray; 33 | function GetParameters: ICipherParameters; 34 | property Parameters: ICipherParameters read GetParameters; 35 | procedure Clear(); 36 | 37 | end; 38 | 39 | implementation 40 | 41 | end. 42 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIParametersWithRandom.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIParametersWithRandom; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpISecureRandom, 26 | ClpICipherParameters; 27 | 28 | type 29 | IParametersWithRandom = interface(ICipherParameters) 30 | 31 | ['{7528E638-E8DD-4B5E-ADF9-9495A9507087}'] 32 | 33 | function GetRandom: ISecureRandom; 34 | function GetParameters: ICipherParameters; 35 | 36 | property random: ISecureRandom read GetRandom; 37 | 38 | property parameters: ICipherParameters read GetParameters; 39 | 40 | end; 41 | 42 | implementation 43 | 44 | end. 45 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIPascalCoinECIESKdfBytesGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIPascalCoinECIESKdfBytesGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIBaseKdfBytesGenerator, 26 | ClpCryptoLibTypes; 27 | 28 | type 29 | 30 | IPascalCoinECIESKdfBytesGenerator = interface(IBaseKdfBytesGenerator) 31 | ['{F6C7D34B-BA6A-45DB-B2A2-088F36557396}'] 32 | 33 | end; 34 | 35 | implementation 36 | 37 | end. 38 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIPascalCoinIESEngine.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIPascalCoinIESEngine; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIIESEngine; 26 | 27 | type 28 | 29 | IPascalCoinIESEngine = interface(IIESEngine) 30 | ['{CEB707A3-6000-4771-A0F9-7C146B8DDE7A}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIPkcs5S2ParametersGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIPkcs5S2ParametersGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIPbeParametersGenerator, 26 | ClpIDigest, 27 | ClpCryptoLibTypes; 28 | 29 | type 30 | IPkcs5S2ParametersGenerator = interface(IPbeParametersGenerator) 31 | 32 | ['{AD345DB8-2341-4C56-B401-23444C2A81BA}'] 33 | 34 | procedure Init(const password, salt: TCryptoLibByteArray; 35 | iterationCount: Int32); 36 | 37 | function GetDigest: IDigest; 38 | 39 | /// 40 | /// the underlying digest. 41 | /// 42 | property digest: IDigest read GetDigest; 43 | 44 | end; 45 | 46 | implementation 47 | 48 | end. 49 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIPolynomial.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIPolynomial; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpCryptoLibTypes; 26 | 27 | type 28 | 29 | IPolynomial = interface(IInterface) 30 | ['{955B9231-3DE9-42D9-9D3C-20B080C1D951}'] 31 | 32 | function GetExponentsPresent(): TCryptoLibInt32Array; 33 | function GetDegree: Int32; 34 | property Degree: Int32 read GetDegree; 35 | 36 | end; 37 | 38 | implementation 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIPolynomialExtensionField.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIPolynomialExtensionField; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIPolynomial, 26 | ClpIExtensionField; 27 | 28 | type 29 | 30 | IPolynomialExtensionField = interface(IExtensionField) 31 | ['{40B4388E-7014-4E15-9E93-9F5173F7F7E0}'] 32 | 33 | function GetMinimalPolynomial: IPolynomial; 34 | property MinimalPolynomial: IPolynomial read GetMinimalPolynomial; 35 | 36 | end; 37 | 38 | implementation 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIPreCompCallBack.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIPreCompCallBack; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIPreCompInfo; 26 | 27 | type 28 | IPreCompCallback = interface(IInterface) 29 | ['{3C0F2A0E-B396-4F0A-82B4-690F204D27ED}'] 30 | function Precompute(const existing: IPreCompInfo): IPreCompInfo; 31 | end; 32 | 33 | implementation 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIPreCompInfo.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIPreCompInfo; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | type 25 | 26 | /// 27 | /// Interface for classes storing precomputation data for multiplication 28 | /// algorithms. Used as a Memento (see GOF patterns) for 29 | /// <code>WNafMultiplier</code>. 30 | /// 31 | IPreCompInfo = interface(IInterface) 32 | ['{8274B14C-C784-4964-9412-AAB3F7A36AB2}'] 33 | end; 34 | 35 | implementation 36 | 37 | end. 38 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIPrimeField.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIPrimeField; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpBigInteger, 26 | ClpIFiniteField; 27 | 28 | type 29 | IPrimeField = interface(IFiniteField) 30 | ['{242D0BB8-1F38-4AC2-B7F7-D67AF94F7EEE}'] 31 | 32 | function Equals(other: TObject): Boolean; overload; 33 | function Equals(const other: IPrimeField): Boolean; overload; 34 | function GetHashCode(): {$IFDEF DELPHI}Int32; {$ELSE}PtrInt; 35 | {$ENDIF DELPHI} 36 | end; 37 | 38 | implementation 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIRandom.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIRandom; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpCryptoLibTypes; 26 | 27 | type 28 | 29 | IRandom = interface(IInterface) 30 | ['{509F9F51-2FC4-40E6-8E4A-68B59808BF5A}'] 31 | 32 | procedure NextBytes(const buf: TCryptoLibByteArray); overload; 33 | 34 | function NextDouble(): Double; 35 | 36 | function Next(): Int32; overload; 37 | function Next(maxValue: Int32): Int32; overload; 38 | function Next(minValue, maxValue: Int32): Int32; overload; 39 | 40 | end; 41 | 42 | implementation 43 | 44 | end. 45 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIRandomDsaKCalculator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIRandomDsaKCalculator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpBigInteger, 26 | ClpIDsaKCalculator; 27 | 28 | type 29 | IRandomDsaKCalculator = interface(IDsaKCalculator) 30 | 31 | ['{79C48638-0015-4D65-901B-638D9F4154E4}'] 32 | 33 | end; 34 | 35 | implementation 36 | 37 | end. 38 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIRandomNumberGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIRandomNumberGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpCryptoLibTypes; 26 | 27 | type 28 | IRandomNumberGenerator = interface(IInterface) 29 | ['{48F39DBB-8BE4-4167-8CE9-265F9B3B785E}'] 30 | 31 | procedure GetBytes(const data: TCryptoLibByteArray); 32 | 33 | procedure GetNonZeroBytes(const data: TCryptoLibByteArray); 34 | 35 | end; 36 | 37 | type 38 | IOSRandomNumberGenerator = interface(IRandomNumberGenerator) 39 | ['{EF52111D-1E69-42D7-99E0-D1C733D17995}'] 40 | 41 | end; 42 | 43 | type 44 | IPCGRandomNumberGenerator = interface(IRandomNumberGenerator) 45 | ['{49D3C867-E4F0-4EA3-BD81-0BCD6C0F08A8}'] 46 | 47 | end; 48 | 49 | type 50 | IAESPRNGRandomNumberGenerator = interface(IRandomNumberGenerator) 51 | ['{9E0D8D8F-D9D4-42D6-9D55-36271293B59E}'] 52 | 53 | end; 54 | 55 | implementation 56 | 57 | end. 58 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIRawAgreement.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIRawAgreement; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpICipherParameters, 26 | ClpCryptoLibTypes; 27 | 28 | type 29 | IRawAgreement = interface(IInterface) 30 | ['{B3C55CE5-1F35-4C77-8CDB-757C07DBF4AA}'] 31 | 32 | procedure Init(const parameters: ICipherParameters); 33 | 34 | function GetAgreementSize(): Int32; 35 | property AgreementSize: Int32 read GetAgreementSize; 36 | 37 | procedure CalculateAgreement(const publicKey: ICipherParameters; 38 | const buf: TCryptoLibByteArray; off: Int32); 39 | end; 40 | 41 | implementation 42 | 43 | end. 44 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIRijndaelEngine.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIRijndaelEngine; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIBlockCipher; 26 | 27 | type 28 | 29 | IRijndaelEngine = interface(IBlockCipher) 30 | ['{F4BB47F6-082F-4318-8434-95F06C26CE77}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpISalsa20Engine.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpISalsa20Engine; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIStreamCipher; 26 | 27 | type 28 | 29 | ISalsa20Engine = interface(IStreamCipher) 30 | ['{F60193BE-E5E6-4C7A-9596-5AAF6B8B8E9C}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIScalarSplitParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIScalarSplitParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpBigInteger; 26 | 27 | type 28 | IScalarSplitParameters = interface(IInterface) 29 | ['{C36FF223-C4F3-4483-B280-A50EF95497AF}'] 30 | 31 | function GetG1: TBigInteger; 32 | function GetG2: TBigInteger; 33 | function GetV1A: TBigInteger; 34 | function GetV1B: TBigInteger; 35 | function GetV2A: TBigInteger; 36 | function GetV2B: TBigInteger; 37 | function GetBits: Int32; 38 | 39 | property g1: TBigInteger read GetG1; 40 | property g2: TBigInteger read GetG2; 41 | property V1A: TBigInteger read GetV1A; 42 | property V1B: TBigInteger read GetV1B; 43 | property V2A: TBigInteger read GetV2A; 44 | property V2B: TBigInteger read GetV2B; 45 | property bits: Int32 read GetBits; 46 | 47 | end; 48 | 49 | implementation 50 | 51 | end. 52 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIScaleXNegateYPointMap.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIScaleXNegateYPointMap; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIECC; 26 | 27 | type 28 | IScaleXNegateYPointMap = interface(IECPointMap) 29 | 30 | ['{D4FF6900-B627-45AB-8066-00E763213CE5}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIScaleXPointMap.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIScaleXPointMap; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIECC; 26 | 27 | type 28 | IScaleXPointMap = interface(IECPointMap) 29 | 30 | ['{3449A622-7472-4B51-A9EF-01B5E586813C}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIScaleYNegateXPointMap.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIScaleYNegateXPointMap; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIECC; 26 | 27 | type 28 | IScaleYNegateXPointMap = interface(IECPointMap) 29 | 30 | ['{6284EFA2-DE75-437F-86D3-DD93BCAF511B}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpISchnorrDigestSigner.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpISchnorrDigestSigner; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpISigner, 26 | ClpBigInteger; 27 | 28 | type 29 | 30 | ISchnorrDigestSigner = interface(ISigner) 31 | ['{FD48778F-A071-459A-9008-423566240F09}'] 32 | 33 | function GetOrder(): TBigInteger; 34 | 35 | end; 36 | 37 | implementation 38 | 39 | end. 40 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpISchnorrExt.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpISchnorrExt; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpISchnorr, 26 | ClpBigInteger; 27 | 28 | type 29 | /// 30 | /// An "extended" interface for classes implementing Schnorr-style algorithms, that provides access 31 | /// to the group order. 32 | /// 33 | ISchnorrExt = interface(ISchnorr) 34 | ['{0BCED764-F352-4C6C-B30C-9E0D7A2B042B}'] 35 | 36 | function GetOrder: TBigInteger; 37 | /// The order of the group that the r, s values in signatures belong to. 38 | property Order: TBigInteger read GetOrder; 39 | 40 | end; 41 | 42 | implementation 43 | 44 | end. 45 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIScryptParametersGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIScryptParametersGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIPbeParametersGenerator, 26 | ClpCryptoLibTypes; 27 | 28 | type 29 | IScryptParametersGenerator = interface(IPbeParametersGenerator) 30 | 31 | ['{1EB9E081-1F90-409F-A5B9-3A999EB6CC70}'] 32 | 33 | procedure Init(const password, salt: TCryptoLibByteArray; 34 | cost, blockSize, parallelism: Int32); 35 | 36 | end; 37 | 38 | implementation 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpISecureRandom.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpISecureRandom; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIRandom, 26 | ClpCryptoLibTypes; 27 | 28 | type 29 | 30 | ISecureRandom = interface(IRandom) 31 | ['{BF2E135B-E889-4B2F-837E-6B2049213C83}'] 32 | 33 | function GenerateSeed(length: Int32): TCryptoLibByteArray; 34 | procedure SetSeed(const seed: TCryptoLibByteArray); overload; 35 | procedure SetSeed(seed: Int64); overload; 36 | 37 | procedure NextBytes(const buf: TCryptoLibByteArray; 38 | off, len: Int32); overload; 39 | function NextInt32(): Int32; 40 | function NextInt64(): Int64; 41 | 42 | end; 43 | 44 | implementation 45 | 46 | end. 47 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpISpeckEngine.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpISpeckEngine; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIBlockCipher; 26 | 27 | type 28 | 29 | ISpeckEngine = interface(IBlockCipher) 30 | ['{60AEDFFF-5FAB-4018-90E7-ED9BD1B3D406}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpISpeckLegacyEngine.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpISpeckLegacyEngine; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIBlockCipher; 26 | 27 | type 28 | 29 | ISpeckLegacyEngine = interface(IBlockCipher) 30 | ['{8BD403C6-B761-4C24-9907-B7ABEA0FEF1B}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIValidityPreCompInfo.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIValidityPreCompInfo; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIPreCompInfo; 26 | 27 | type 28 | IValidityPreCompInfo = interface(IPreCompInfo) 29 | 30 | ['{2339F5CA-A4B3-4E95-B358-4D4F4CA97EB3}'] 31 | 32 | function HasFailed(): Boolean; 33 | procedure ReportFailed(); 34 | function HasCurveEquationPassed(): Boolean; 35 | procedure ReportCurveEquationPassed(); 36 | function HasOrderPassed(): Boolean; 37 | procedure ReportOrderPassed(); 38 | 39 | end; 40 | 41 | implementation 42 | 43 | end. 44 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIWTauNafPreCompInfo.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIWTauNafPreCompInfo; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIECC, 26 | ClpCryptoLibTypes, 27 | ClpIPreCompInfo; 28 | 29 | type 30 | IWTauNafPreCompInfo = interface(IPreCompInfo) 31 | ['{E2E76FDB-8DD6-4DB5-9EC7-58C87DE8AD3D}'] 32 | 33 | function GetPreComp: TCryptoLibGenericArray; 34 | procedure SetPreComp(const value 35 | : TCryptoLibGenericArray); 36 | 37 | property PreComp: TCryptoLibGenericArray read GetPreComp 38 | write SetPreComp; 39 | 40 | end; 41 | 42 | implementation 43 | 44 | end. 45 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIX25519Agreement.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIX25519Agreement; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIRawAgreement; 26 | 27 | type 28 | 29 | IX25519Agreement = interface(IRawAgreement) 30 | 31 | ['{5561516C-4BC6-4D97-BF1A-FBC35A3B7A03}'] 32 | 33 | end; 34 | 35 | implementation 36 | 37 | end. 38 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIX25519KeyGenerationParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIX25519KeyGenerationParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIKeyGenerationParameters; 26 | 27 | type 28 | IX25519KeyGenerationParameters = interface(IKeyGenerationParameters) 29 | ['{BDDAF238-C842-4449-A7B8-3A537E405A62}'] 30 | 31 | end; 32 | 33 | implementation 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIX25519KeyPairGenerator.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIX25519KeyPairGenerator; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIAsymmetricCipherKeyPairGenerator; 26 | 27 | type 28 | IX25519KeyPairGenerator = interface(IAsymmetricCipherKeyPairGenerator) 29 | ['{EC906E22-1587-4E06-85D0-697368365F97}'] 30 | 31 | end; 32 | 33 | implementation 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIX25519PrivateKeyParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIX25519PrivateKeyParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIX25519PublicKeyParameters, 26 | ClpIAsymmetricKeyParameter, 27 | ClpCryptoLibTypes; 28 | 29 | type 30 | IX25519PrivateKeyParameters = interface(IAsymmetricKeyParameter) 31 | ['{6C7D2CD5-33A1-4153-A84C-70455CA69729}'] 32 | 33 | procedure Encode(const buf: TCryptoLibByteArray; off: Int32); 34 | function GetEncoded(): TCryptoLibByteArray; 35 | function GeneratePublicKey(): IX25519PublicKeyParameters; 36 | procedure GenerateSecret(const publicKey: IX25519PublicKeyParameters; 37 | const buf: TCryptoLibByteArray; off: Int32); 38 | 39 | function Equals(const other: IX25519PrivateKeyParameters): Boolean; 40 | overload; 41 | end; 42 | 43 | implementation 44 | 45 | end. 46 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIX25519PublicKeyParameters.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIX25519PublicKeyParameters; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIAsymmetricKeyParameter, 26 | ClpCryptoLibTypes; 27 | 28 | type 29 | IX25519PublicKeyParameters = interface(IAsymmetricKeyParameter) 30 | ['{52D136C4-4DD1-4AF1-9AB8-0783136EF04A}'] 31 | 32 | procedure Encode(const buf: TCryptoLibByteArray; off: Int32); 33 | function GetEncoded(): TCryptoLibByteArray; 34 | 35 | function Equals(const other: IX25519PublicKeyParameters): Boolean; overload; 36 | end; 37 | 38 | implementation 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIX9ECParametersHolder.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIX9ECParametersHolder; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIX9ECParameters; 26 | 27 | type 28 | IX9ECParametersHolder = interface(IInterface) 29 | ['{F24A1BB5-8A39-45A4-9BEF-68DD0EE79E0D}'] 30 | 31 | function CreateParameters(): IX9ECParameters; 32 | function GetParameters: IX9ECParameters; 33 | property Parameters: IX9ECParameters read GetParameters; 34 | 35 | end; 36 | 37 | implementation 38 | 39 | end. 40 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIXSalsa20Engine.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIXSalsa20Engine; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpISalsa20Engine; 26 | 27 | type 28 | 29 | IXSalsa20Engine = interface(ISalsa20Engine) 30 | ['{D95969E8-EAB0-4D2D-8542-40B55925F68D}'] 31 | 32 | end; 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /CryptoLib/src/Interfaces/ClpIZTauElement.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpIZTauElement; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpBigInteger; 26 | 27 | type 28 | IZTauElement = interface(IInterface) 29 | ['{607ABBF3-AE3E-45AC-B772-92423508528A}'] 30 | 31 | function GetU: TBigInteger; 32 | function GetV: TBigInteger; 33 | 34 | // /** 35 | // * The "real" part of λ. 36 | // */ 37 | property U: TBigInteger read GetU; 38 | // /** 39 | // * The "τ-adic" part of λ. 40 | // */ 41 | property V: TBigInteger read GetV; 42 | 43 | end; 44 | 45 | implementation 46 | 47 | end. 48 | -------------------------------------------------------------------------------- /CryptoLib/src/Math/EC/ClpECCurveConstants.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpECCurveConstants; 19 | 20 | {$I ..\..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | type 25 | TECCurveConstants = class sealed(TObject) 26 | 27 | public 28 | 29 | const 30 | COORD_AFFINE = Int32(0); 31 | COORD_HOMOGENEOUS = Int32(1); 32 | COORD_JACOBIAN = Int32(2); 33 | COORD_JACOBIAN_CHUDNOVSKY = Int32(3); 34 | COORD_JACOBIAN_MODIFIED = Int32(4); 35 | COORD_LAMBDA_AFFINE = Int32(5); 36 | COORD_LAMBDA_PROJECTIVE = Int32(6); 37 | COORD_SKEWED = Int32(7); 38 | 39 | end; 40 | 41 | implementation 42 | 43 | end. 44 | -------------------------------------------------------------------------------- /CryptoLib/src/Math/EC/ClpScaleXNegateYPointMap.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpScaleXNegateYPointMap; 19 | 20 | {$I ..\..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIECC, 26 | ClpIScaleXNegateYPointMap; 27 | 28 | type 29 | TScaleXNegateYPointMap = class(TInterfacedObject, IECPointMap, 30 | IScaleXNegateYPointMap) 31 | 32 | strict protected 33 | var 34 | Fscale: IECFieldElement; 35 | 36 | public 37 | constructor Create(const scale: IECFieldElement); 38 | function Map(const p: IECPoint): IECPoint; virtual; 39 | end; 40 | 41 | implementation 42 | 43 | { TScaleXNegateYPointMap } 44 | 45 | constructor TScaleXNegateYPointMap.Create(const scale: IECFieldElement); 46 | begin 47 | Inherited Create(); 48 | Fscale := scale; 49 | end; 50 | 51 | function TScaleXNegateYPointMap.Map(const p: IECPoint): IECPoint; 52 | begin 53 | Result := p.ScaleXNegateY(Fscale); 54 | end; 55 | 56 | end. 57 | -------------------------------------------------------------------------------- /CryptoLib/src/Math/EC/ClpScaleYNegateXPointMap.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpScaleYNegateXPointMap; 19 | 20 | {$I ..\..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpIECC, 26 | ClpIScaleYNegateXPointMap; 27 | 28 | type 29 | TScaleYNegateXPointMap = class(TInterfacedObject, IECPointMap, 30 | IScaleYNegateXPointMap) 31 | 32 | strict protected 33 | var 34 | Fscale: IECFieldElement; 35 | 36 | public 37 | constructor Create(const scale: IECFieldElement); 38 | function Map(const p: IECPoint): IECPoint; virtual; 39 | end; 40 | 41 | implementation 42 | 43 | { TScaleYNegateXPointMap } 44 | 45 | constructor TScaleYNegateXPointMap.Create(const scale: IECFieldElement); 46 | begin 47 | Inherited Create(); 48 | Fscale := scale; 49 | end; 50 | 51 | function TScaleYNegateXPointMap.Map(const p: IECPoint): IECPoint; 52 | begin 53 | Result := p.ScaleYNegateX(Fscale); 54 | end; 55 | 56 | end. 57 | -------------------------------------------------------------------------------- /CryptoLib/src/Utils/ClpSetWeakRef.pas: -------------------------------------------------------------------------------- 1 | { *********************************************************************************** } 2 | { * CryptoLib Library * } 3 | { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } 4 | { * Github Repository * } 5 | 6 | { * Distributed under the MIT software license, see the accompanying file LICENSE * } 7 | { * or visit http://www.opensource.org/licenses/mit-license.php. * } 8 | 9 | { * Acknowledgements: * } 10 | { * * } 11 | { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } 12 | { * development of this library * } 13 | 14 | { * ******************************************************************************* * } 15 | 16 | (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 17 | 18 | unit ClpSetWeakRef; 19 | 20 | {$I ..\Include\CryptoLib.inc} 21 | 22 | interface 23 | 24 | uses 25 | ClpCryptoLibTypes; 26 | 27 | type 28 | TSetWeakRef = class(TObject) 29 | 30 | public 31 | class procedure SetWeakReference(aInterfaceField: PIInterface; 32 | const aValue: IInterface); static; 33 | end; 34 | 35 | implementation 36 | 37 | { TSetWeakRef } 38 | 39 | class procedure TSetWeakRef.SetWeakReference(aInterfaceField: PIInterface; 40 | const aValue: IInterface); 41 | begin 42 | PPointer(aInterfaceField)^ := Pointer(aValue); 43 | end; 44 | 45 | end. 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | --------------------------------------------------------------------------------