Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / clr / src / BCL / System / Security / Cryptography / RC2.cs / 1 / RC2.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // RC2.cs // namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public abstract class RC2 : SymmetricAlgorithm { protected int EffectiveKeySizeValue; private static KeySizes[] s_legalBlockSizes = { new KeySizes(64, 64, 0) }; private static KeySizes[] s_legalKeySizes = { new KeySizes(40, 1024, 8) // 1024 bits is theoretical max according to the RFC }; // // protected constructors // protected RC2() { KeySizeValue = 128; BlockSizeValue = 64; FeedbackSizeValue = BlockSizeValue; LegalBlockSizesValue = s_legalBlockSizes; LegalKeySizesValue = s_legalKeySizes; } // // public properties // public virtual int EffectiveKeySize { get { if (EffectiveKeySizeValue == 0) return KeySizeValue; return EffectiveKeySizeValue; } set { if (value > KeySizeValue) { throw new CryptographicException(Environment.GetResourceString("Cryptography_RC2_EKSKS")); } else if (value == 0) { EffectiveKeySizeValue = value; } else if (value < 40) { throw new CryptographicException(Environment.GetResourceString("Cryptography_RC2_EKS40")); } else { if (ValidKeySize(value)) EffectiveKeySizeValue = value; else throw new CryptographicException(Environment.GetResourceString("Cryptography_InvalidKeySize")); } } } public override int KeySize { get { return KeySizeValue; } set { if (value < EffectiveKeySizeValue) throw new CryptographicException(Environment.GetResourceString("Cryptography_RC2_EKSKS")); base.KeySize = value; } } // // public methods // new static public RC2 Create() { return Create("System.Security.Cryptography.RC2"); } new static public RC2 Create(String AlgName) { return (RC2) CryptoConfig.CreateFromName(AlgName); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // RC2.cs // namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public abstract class RC2 : SymmetricAlgorithm { protected int EffectiveKeySizeValue; private static KeySizes[] s_legalBlockSizes = { new KeySizes(64, 64, 0) }; private static KeySizes[] s_legalKeySizes = { new KeySizes(40, 1024, 8) // 1024 bits is theoretical max according to the RFC }; // // protected constructors // protected RC2() { KeySizeValue = 128; BlockSizeValue = 64; FeedbackSizeValue = BlockSizeValue; LegalBlockSizesValue = s_legalBlockSizes; LegalKeySizesValue = s_legalKeySizes; } // // public properties // public virtual int EffectiveKeySize { get { if (EffectiveKeySizeValue == 0) return KeySizeValue; return EffectiveKeySizeValue; } set { if (value > KeySizeValue) { throw new CryptographicException(Environment.GetResourceString("Cryptography_RC2_EKSKS")); } else if (value == 0) { EffectiveKeySizeValue = value; } else if (value < 40) { throw new CryptographicException(Environment.GetResourceString("Cryptography_RC2_EKS40")); } else { if (ValidKeySize(value)) EffectiveKeySizeValue = value; else throw new CryptographicException(Environment.GetResourceString("Cryptography_InvalidKeySize")); } } } public override int KeySize { get { return KeySizeValue; } set { if (value < EffectiveKeySizeValue) throw new CryptographicException(Environment.GetResourceString("Cryptography_RC2_EKSKS")); base.KeySize = value; } } // // public methods // new static public RC2 Create() { return Create("System.Security.Cryptography.RC2"); } new static public RC2 Create(String AlgName) { return (RC2) CryptoConfig.CreateFromName(AlgName); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- _ConnectStream.cs
- SessionIDManager.cs
- TabPanel.cs
- COM2Properties.cs
- IntegrationExceptionEventArgs.cs
- PolicyValidator.cs
- XpsFilter.cs
- MemoryStream.cs
- RoutedEvent.cs
- AspCompat.cs
- OrderByBuilder.cs
- KeyProperty.cs
- Configuration.cs
- InkCanvasSelection.cs
- GreenMethods.cs
- RawKeyboardInputReport.cs
- BoundColumn.cs
- DataGridViewDataConnection.cs
- ObjectListSelectEventArgs.cs
- DependencyObjectCodeDomSerializer.cs
- HtmlSelectionListAdapter.cs
- URLIdentityPermission.cs
- FindRequestContext.cs
- ThemeDictionaryExtension.cs
- SplitContainer.cs
- ProgressChangedEventArgs.cs
- StructuredProperty.cs
- FragmentQuery.cs
- CacheOutputQuery.cs
- InvalidStoreProtectionKeyException.cs
- DisableDpiAwarenessAttribute.cs
- WpfKnownTypeInvoker.cs
- TabControlEvent.cs
- ModuleElement.cs
- AutomationEventArgs.cs
- ServiceDescriptions.cs
- ExceptionHandler.cs
- TextViewDesigner.cs
- EndpointAddress10.cs
- TreeNodeMouseHoverEvent.cs
- ScriptResourceInfo.cs
- GeometryModel3D.cs
- ShaderEffect.cs
- MarginCollapsingState.cs
- WebPartConnectionsEventArgs.cs
- AdRotator.cs
- UriSection.cs
- EntityDataSourceContextCreatingEventArgs.cs
- ServiceThrottlingElement.cs
- IgnoreFileBuildProvider.cs
- loginstatus.cs
- OracleEncoding.cs
- HtmlDocument.cs
- InheritanceUI.cs
- MessageBox.cs
- ErrorBehavior.cs
- DbConnectionPool.cs
- PermissionSetTriple.cs
- TemplateContentLoader.cs
- RegistrationServices.cs
- UIElementPropertyUndoUnit.cs
- SqlRewriteScalarSubqueries.cs
- EventDescriptor.cs
- FamilyTypefaceCollection.cs
- Transform3DGroup.cs
- CompiledAction.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- Binding.cs
- CollectionsUtil.cs
- DefaultHttpHandler.cs
- PartialTrustVisibleAssembly.cs
- EDesignUtil.cs
- EntityClassGenerator.cs
- EntitySet.cs
- mediaclock.cs
- NativeMethods.cs
- CachedResourceDictionaryExtension.cs
- XmlTextReader.cs
- StylusSystemGestureEventArgs.cs
- UnionExpr.cs
- SimpleHandlerBuildProvider.cs
- ApplicationGesture.cs
- DesignerSerializerAttribute.cs
- RouteParser.cs
- LineBreakRecord.cs
- shaperfactory.cs
- datacache.cs
- UserValidatedEventArgs.cs
- XsltLoader.cs
- HitTestFilterBehavior.cs
- WebPartHeaderCloseVerb.cs
- SystemWebCachingSectionGroup.cs
- Point3DValueSerializer.cs
- ContentDesigner.cs
- EncodingFallbackAwareXmlTextWriter.cs
- StreamMarshaler.cs
- ChtmlSelectionListAdapter.cs
- ComboBox.cs
- DataGridViewCellCollection.cs
- ComponentSerializationService.cs