示例#1
0
 internal DigestFactory(TParams parameters, IEngineProvider <IDigest> digestProvider, int digestSize)
 {
     this.approvedOnlyMode = CryptoServicesRegistrar.IsInApprovedOnlyMode();
     this.parameters       = parameters;
     this.digestProvider   = digestProvider;
     this.digestSize       = digestSize;
 }
示例#2
0
        static FipsDsa()
        {
            IEngineProvider <DsaSigner> provider = new DsaProvider();

            // FSM_STATE:3.DSA.0,"POWER ON SELF-TEST", "DSA SIGN VERIFY KAT", "The module is performing ECDSA sign and verify KAT self-test"
            // FSM_TRANS:3.DSA.0,"POWER ON SELF-TEST", "DSA SIGN VERIFY KAT", "Invoke DSA Sign/Verify KAT self-test"
            provider.CreateEngine(EngineUsage.GENERAL);
            // FSM_TRANS:3.DSA.1,"DSA SIGN VERIFY KAT", "POWER ON SELF-TEST", "DSA Sign/Verify KAT self-test successful completion"

            ENGINE_PROVIDER = provider;
        }
示例#3
0
        public IMacFactory <TAuthParam> CreateMacFactory(TAuthParam parameters)
        {
            if (CryptoServicesRegistrar.IsInApprovedOnlyMode())
            {
                throw new CryptoUnapprovedOperationError("Attempt to create unapproved MAC factory in approved only mode");
            }

            IEngineProvider <IMac> macProvider = ProviderUtils.CreateMacProvider(name, parameters, engineProvider);

            return(new MacFactory <TAuthParam>(parameters, macProvider, (parameters.MacSizeInBits + 7) / 8));
        }
示例#4
0
        internal GeneralBlockCipherProvider(string name, IEngineProvider <Internal.IBlockCipher> engineProvider)
        {
            CryptoStatus.IsReady();

            if (CryptoServicesRegistrar.IsInApprovedOnlyMode())
            {
                throw new CryptoUnapprovedOperationError("Attempt to create provider for unapproved algorithm in approved only mode");
            }

            this.name           = name;
            this.engineProvider = engineProvider;
        }
 internal SignatureFactory(TParams parameters, IEngineProvider <ISigner> signerProvider)
 {
     this.parameters     = parameters;
     this.signerProvider = signerProvider;
 }
示例#6
0
 private static void rsaKeyTransportTest(IEngineProvider <RsaBlindedEngine> provider)
 {
     SelfTestExecutor.Validate(WrapOaep.Algorithm, new RsaOaepKeyTransportTest(provider));
 }
示例#7
0
 internal RsaOaepKeyTransportTest(IEngineProvider <RsaBlindedEngine> provider) : base(WrapOaep.Algorithm)
 {
     this.provider = provider;
 }
示例#8
0
 private static void rsaSignTest(IEngineProvider <RsaBlindedEngine> provider)
 {
     SelfTestExecutor.Validate(Pkcs1v15.Algorithm, new RsaSignTest(provider));
 }
示例#9
0
 internal RsaSignTest(IEngineProvider <RsaBlindedEngine> provider) : base(Pkcs1v15.Algorithm)
 {
     this.provider = provider;
 }
示例#10
0
 internal CcmMacProvider(IEngineProvider <Internal.IBlockCipher> baseProvider, IAuthenticationParametersWithIV <IParameters <Algorithm>, Algorithm> parameters)
 {
     this.baseProvider = baseProvider;
     this.parameters   = parameters;
 }
示例#11
0
        internal static IWrapper CreateWrapper(string name, AlgorithmMode algorithmMode, bool useInverse, bool forWrapping, IEngineProvider <Internal.IBlockCipher> baseCipherProvider)
        {
            Internal.IBlockCipher baseCipher = baseCipherProvider.CreateEngine(GetWrapUsage(useInverse, forWrapping));
            IWrapper cipher;

            switch (algorithmMode)
            {
            case AlgorithmMode.WRAP:
                cipher = new SP80038FWrapEngine(baseCipher, useInverse);
                break;

            case AlgorithmMode.WRAPPAD:
                cipher = new SP80038FWrapWithPaddingEngine(baseCipher, useInverse);
                break;

            default:
                throw new ArgumentException("Unknown wrapper algorithm passed to " + name + ".Provider: " + algorithmMode);
            }

            cipher.Init(forWrapping, null);

            return(cipher);
        }
示例#12
0
 public Provider(String name, IEngineProvider <Internal.IBlockCipher> engine)
 {
     this.desEdeEngineProvider = engine;
 }
示例#13
0
        internal static IEngineProvider <IMac> CreateMacProvider(string name, IAuthenticationParametersWithIV <IParameters <Algorithm>, Algorithm> parameters, IEngineProvider <Org.BouncyCastle.Crypto.Internal.IBlockCipher> baseCipher)
        {
            switch (parameters.Algorithm.Mode)
            {
            case AlgorithmMode.CCM:
                return(new CcmMacProvider(baseCipher, parameters));

            case AlgorithmMode.GMAC:
                return(new GMacProvider(baseCipher, parameters));

            default:
                throw new ArgumentException("Unknown MAC algorithm passed to " + name + ".Provider: " + parameters.Algorithm.Mode);
            }
        }
示例#14
0
            public IMacFactory <AuthenticationParametersWithIV> CreateMacFactory(AuthenticationParametersWithIV algorithmDetails)
            {
                IEngineProvider <IMac> macProvider = ProviderUtils.CreateMacProvider("FipsAES", algorithmDetails, aesEngineProvider);

                return(new MacFactory <AuthenticationParametersWithIV>(algorithmDetails, macProvider, (algorithmDetails.MacSizeInBits + 7) / 8));
            }
示例#15
0
 public Provider(IEngineProvider <Internal.IStreamCipher> engineProvider)
 {
     this.engineProvider = engineProvider;
 }
示例#16
0
 internal Service(Poly1305.Key key)
 {
     engineProvider = new EngineProvider(key);
 }
示例#17
0
        internal static IBufferedCipher CreateBufferedCipher(string name, AlgorithmMode algorithmMode, IParametersWithIV <IParameters <Algorithm>, Algorithm> parameters, bool forEncryption, IEngineProvider <Internal.IBlockCipher> cipherProvider)
        {
            Internal.IBlockCipher baseCipher = cipherProvider.CreateEngine(GetUsage(forEncryption, algorithmMode));
            Internal.IBlockCipher cipher;

            switch (algorithmMode)
            {
            case AlgorithmMode.CBC:
                cipher = new CbcBlockCipher(baseCipher);
                break;

            case AlgorithmMode.CS1:
                return(new NistCtsBlockCipher(NistCtsBlockCipher.CS1, baseCipher));

            case AlgorithmMode.CS2:
                return(new NistCtsBlockCipher(NistCtsBlockCipher.CS2, baseCipher));

            case AlgorithmMode.CS3:
                return(new NistCtsBlockCipher(NistCtsBlockCipher.CS3, baseCipher));

            case AlgorithmMode.CFB8:
                cipher = new CfbBlockCipher(baseCipher, 8);
                break;

            case AlgorithmMode.CFB64:
                cipher = new CfbBlockCipher(baseCipher, 64);
                break;

            case AlgorithmMode.CFB128:
                cipher = new CfbBlockCipher(baseCipher, 128);
                break;

            case AlgorithmMode.OpenPGPCFB:
                cipher = new OpenPgpCfbBlockCipher(baseCipher);
                break;

            case AlgorithmMode.OFB64:
                cipher = new OfbBlockCipher(baseCipher, 64);
                break;

            case AlgorithmMode.OFB128:
                cipher = new OfbBlockCipher(baseCipher, 128);
                break;

            case AlgorithmMode.CTR:
                cipher = new SicBlockCipher(baseCipher);
                break;

            default:
                throw new ArgumentException("Unknown algorithm mode passed to " + name + ".Provider: " + algorithmMode);
            }

            return(new BufferedBlockCipher(cipher));
        }
示例#18
0
        internal static IAeadBlockCipher CreateAeadCipher(string name, AlgorithmMode algorithmMode, IParametersWithIV <IParameters <Algorithm>, Algorithm> parameters, bool forEncryption, IEngineProvider <Internal.IBlockCipher> cipherProvider)
        {
            Internal.IBlockCipher baseCipher = cipherProvider.CreateEngine(GetUsage(forEncryption, algorithmMode));

            switch (algorithmMode)
            {
            case AlgorithmMode.CCM:
                return(new CcmBlockCipher(baseCipher));

            case AlgorithmMode.GCM:
                return(new GcmBlockCipher(baseCipher));

            default:
                throw new ArgumentException("Unknown algorithm mode passed to " + name + ".Provider: " + algorithmMode);
            }
        }
示例#19
0
 public Provider(String name, IEngineProvider <Internal.IBlockCipher> engineProvider) : base(name, engineProvider)
 {
 }
示例#20
0
 public ScreenshotJobTaskBinder(IEngineProvider engineProvider)
 {
     _engineProvider = engineProvider;
 }
示例#21
0
 internal Service(IEngineProvider <Internal.IBlockCipher> engineProvider) : base(new Provider("SEED", engineProvider), new ProviderForIV("SEED", engineProvider))
 {
 }
示例#22
0
 internal CMacProvider(IEngineProvider <Internal.IBlockCipher> baseProvider, IAuthenticationParameters <IParameters <Algorithm>, Algorithm> parameters)
 {
     this.baseProvider  = baseProvider;
     this.macSizeInBits = parameters.MacSizeInBits;
 }
示例#23
0
            public IMacFactory <AuthenticationParameters> CreateMacFactory(AuthenticationParameters algorithmDetails)
            {
                IEngineProvider <IMac> macProvider = ProviderUtils.CreateMacProvider("FipsTripleDes", algorithmDetails, desEdeEngineProvider);

                return(new MacFactory <AuthenticationParameters>(algorithmDetails, macProvider, (algorithmDetails.MacSizeInBits + 7) / 8));
            }
示例#24
0
 internal MacFactory(TParams parameters, IEngineProvider <IMac> macProvider, int macLength)
 {
     this.parameters  = parameters;
     this.macProvider = macProvider;
     this.macLength   = macLength;
 }
示例#25
0
 internal XofFactory(TParams parameters, IEngineProvider <IXof> xofProvider)
 {
     this.approvedOnlyMode = CryptoServicesRegistrar.IsInApprovedOnlyMode();
     this.parameters       = parameters;
     this.xofProvider      = xofProvider;
 }
 public HomeController(ITireProvider tireProvider, IChassisProvider chassisProvider, IEngineProvider engineProvider)
 {
     this.tireProvider = tireProvider;
     this.chassisProvider = chassisProvider;
     this.engineProvider = engineProvider;
 }