Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SEHException.cs
- ZipFileInfo.cs
- HttpStaticObjectsCollectionBase.cs
- PopOutPanel.cs
- InfoCardAsymmetricCrypto.cs
- DataRow.cs
- TransformGroup.cs
- __ConsoleStream.cs
- SqlDataSourceSelectingEventArgs.cs
- WindowsStatusBar.cs
- Mapping.cs
- Int16.cs
- ImageMapEventArgs.cs
- Simplifier.cs
- PersonalizationDictionary.cs
- SpellerInterop.cs
- IODescriptionAttribute.cs
- VisualStyleElement.cs
- SharedDp.cs
- RegexReplacement.cs
- WebControlsSection.cs
- MdiWindowListStrip.cs
- PrePostDescendentsWalker.cs
- XamlGridLengthSerializer.cs
- ItemCheckedEvent.cs
- BinaryMessageEncodingBindingElement.cs
- CompositeFontFamily.cs
- CompModHelpers.cs
- TextCompositionEventArgs.cs
- SecureUICommand.cs
- XmlReflectionMember.cs
- OletxVolatileEnlistment.cs
- DataQuery.cs
- TextComposition.cs
- DBDataPermission.cs
- CodeIdentifiers.cs
- HttpStaticObjectsCollectionBase.cs
- XmlSchemaObject.cs
- WindowsFormsHelpers.cs
- HtmlImage.cs
- TextOnlyOutput.cs
- RuleSettingsCollection.cs
- WebBrowserEvent.cs
- BoundField.cs
- recordstate.cs
- Point3DIndependentAnimationStorage.cs
- ExpressionBuilder.cs
- DataSet.cs
- EntryIndex.cs
- HiddenField.cs
- EnvelopedPkcs7.cs
- DbgCompiler.cs
- wmiprovider.cs
- ReflectionHelper.cs
- ObjectDataSourceView.cs
- XmlSchemaAttribute.cs
- Duration.cs
- VariableExpressionConverter.cs
- GridViewCommandEventArgs.cs
- ServerTooBusyException.cs
- GridToolTip.cs
- ItemAutomationPeer.cs
- QuadraticBezierSegment.cs
- PointIndependentAnimationStorage.cs
- CompilerCollection.cs
- ListViewUpdateEventArgs.cs
- NotifyParentPropertyAttribute.cs
- SchemeSettingElement.cs
- UnsafeNativeMethods.cs
- PagesChangedEventArgs.cs
- ListViewGroup.cs
- RoleManagerSection.cs
- TemplateNameScope.cs
- DelegateTypeInfo.cs
- AncestorChangedEventArgs.cs
- ContextMenuAutomationPeer.cs
- ScriptControlDescriptor.cs
- CorrelationQuery.cs
- CompensationHandlingFilter.cs
- DataRecordInfo.cs
- CellIdBoolean.cs
- CrossContextChannel.cs
- SqlNamer.cs
- XslAst.cs
- TypeDescriptionProviderAttribute.cs
- EventLogPermissionEntryCollection.cs
- TextRangeAdaptor.cs
- AmbientProperties.cs
- SoapFault.cs
- ParameterDataSourceExpression.cs
- SpecularMaterial.cs
- DesignerObjectListAdapter.cs
- WebColorConverter.cs
- StylusPointDescription.cs
- JavaScriptString.cs
- UIElementHelper.cs
- ToolStripTemplateNode.cs
- ToolStripItemCollection.cs
- DelayLoadType.cs
- FontFamilyConverter.cs