Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- IdnMapping.cs
- ResourceKey.cs
- ConfigXmlAttribute.cs
- CfgParser.cs
- SchemaSetCompiler.cs
- Walker.cs
- SelectionChangedEventArgs.cs
- ClientSettings.cs
- Pen.cs
- AnimationLayer.cs
- remotingproxy.cs
- RawContentTypeMapper.cs
- BindingSource.cs
- Config.cs
- FacetValues.cs
- FlowDocumentFormatter.cs
- ConfigXmlDocument.cs
- PopupRootAutomationPeer.cs
- TextTreeUndo.cs
- UIElement3D.cs
- IgnoreSectionHandler.cs
- QuaternionRotation3D.cs
- ToolStripSplitButton.cs
- XmlnsCompatibleWithAttribute.cs
- DataKeyArray.cs
- SplineKeyFrames.cs
- DefaultSerializationProviderAttribute.cs
- BulletDecorator.cs
- PermissionSet.cs
- KeyInterop.cs
- TextCompositionManager.cs
- HttpProfileGroupBase.cs
- QualifiedCellIdBoolean.cs
- ViewBox.cs
- HttpHostedTransportConfiguration.cs
- SqlUdtInfo.cs
- CodeTypeMember.cs
- CharConverter.cs
- BindingMAnagerBase.cs
- ToolStripTextBox.cs
- WorkflowRuntimeSection.cs
- ToolStripGripRenderEventArgs.cs
- CfgRule.cs
- ConcurrentQueue.cs
- SQLConvert.cs
- XPathEmptyIterator.cs
- DataGridCell.cs
- ExpressionBuilderContext.cs
- TextEndOfLine.cs
- TargetControlTypeCache.cs
- GraphicsPathIterator.cs
- InputManager.cs
- XomlSerializationHelpers.cs
- AccessViolationException.cs
- DataGridLength.cs
- ConnectionConsumerAttribute.cs
- NopReturnReader.cs
- QilLoop.cs
- SHA1CryptoServiceProvider.cs
- DBSqlParser.cs
- ProfessionalColors.cs
- WebPartConnectionsCloseVerb.cs
- ReadContentAsBinaryHelper.cs
- UIElementAutomationPeer.cs
- AutoGeneratedFieldProperties.cs
- Int32Converter.cs
- MenuAutomationPeer.cs
- __ConsoleStream.cs
- ObjectDataSourceView.cs
- NetworkCredential.cs
- ValueTable.cs
- NativeWindow.cs
- SettingsBindableAttribute.cs
- GridViewRow.cs
- TextBoxBase.cs
- StateBag.cs
- StatusBarDrawItemEvent.cs
- OrCondition.cs
- CriticalHandle.cs
- CodeObjectCreateExpression.cs
- FreeFormDesigner.cs
- WeakEventTable.cs
- DataServiceQueryProvider.cs
- BoolExpr.cs
- assertwrapper.cs
- ResourceCollectionInfo.cs
- ExtensibleClassFactory.cs
- DesignerVerbCollection.cs
- HighContrastHelper.cs
- DesigntimeLicenseContext.cs
- DataGridViewCellValidatingEventArgs.cs
- WindowsRichEditRange.cs
- Parser.cs
- X509Logo.cs
- NotificationContext.cs
- WsatServiceCertificate.cs
- Bold.cs
- DataServiceQueryContinuation.cs
- ActivationArguments.cs
- TriggerAction.cs