Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Security / Cryptography / RC2.cs / 1305376 / 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 // [System.Security.SecuritySafeCritical] // auto-generated new static public RC2 Create() { return Create("System.Security.Cryptography.RC2"); } [System.Security.SecuritySafeCritical] // auto-generated 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 // [System.Security.SecuritySafeCritical] // auto-generated new static public RC2 Create() { return Create("System.Security.Cryptography.RC2"); } [System.Security.SecuritySafeCritical] // auto-generated 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
- TransformValueSerializer.cs
- GetBrowserTokenRequest.cs
- BinaryCommonClasses.cs
- RuntimeConfigurationRecord.cs
- NativeMethods.cs
- ButtonBase.cs
- DynamicAttribute.cs
- WCFBuildProvider.cs
- TextSelection.cs
- EmptyQuery.cs
- ClientUriBehavior.cs
- XsltLoader.cs
- UserControlDesigner.cs
- Underline.cs
- HttpHeaderCollection.cs
- WebScriptEnablingElement.cs
- unsafenativemethodsother.cs
- SliderAutomationPeer.cs
- UInt64Converter.cs
- ToolStripDropDownClosedEventArgs.cs
- NullableFloatSumAggregationOperator.cs
- ExpandoClass.cs
- ResourceReferenceExpression.cs
- TextEditorLists.cs
- ChildTable.cs
- TabPageDesigner.cs
- XmlNodeChangedEventArgs.cs
- KeyboardDevice.cs
- CultureMapper.cs
- LayoutEditorPart.cs
- SingleStorage.cs
- CryptoKeySecurity.cs
- Configuration.cs
- DataControlImageButton.cs
- Bitmap.cs
- HyperLinkField.cs
- InitializerFacet.cs
- RepeatButton.cs
- SEHException.cs
- Property.cs
- StopRoutingHandler.cs
- Section.cs
- EncoderExceptionFallback.cs
- SafeNativeMethods.cs
- BufferedGraphicsContext.cs
- Inflater.cs
- SatelliteContractVersionAttribute.cs
- ToolStripKeyboardHandlingService.cs
- SynchronizationFilter.cs
- UpdateTranslator.cs
- EventProvider.cs
- XamlSerializer.cs
- HttpCookieCollection.cs
- ToolStripDropDownItemDesigner.cs
- HttpModulesSection.cs
- RelationshipManager.cs
- CheckBox.cs
- ArraySegment.cs
- ExpandableObjectConverter.cs
- CompiledQuery.cs
- Assembly.cs
- DodSequenceMerge.cs
- AttachedAnnotationChangedEventArgs.cs
- DiscreteKeyFrames.cs
- SqlClientWrapperSmiStream.cs
- OrderingQueryOperator.cs
- KnownTypes.cs
- CategoryValueConverter.cs
- ItemsChangedEventArgs.cs
- FamilyMapCollection.cs
- RIPEMD160Managed.cs
- UIElementParagraph.cs
- XsltSettings.cs
- StyleHelper.cs
- CheckBoxStandardAdapter.cs
- ResourcePermissionBase.cs
- UrlAuthorizationModule.cs
- XPathBinder.cs
- XmlCountingReader.cs
- DtrList.cs
- BitmapPalettes.cs
- DESCryptoServiceProvider.cs
- PeekCompletedEventArgs.cs
- MergePropertyDescriptor.cs
- BinaryObjectInfo.cs
- Label.cs
- MobileCategoryAttribute.cs
- ProxyWebPartManager.cs
- EventBuilder.cs
- PrivilegeNotHeldException.cs
- SystemDiagnosticsSection.cs
- SocketPermission.cs
- PerformanceCounter.cs
- RadioButtonStandardAdapter.cs
- SoapClientProtocol.cs
- DataGridViewSelectedRowCollection.cs
- SchemaCollectionCompiler.cs
- WebPartMinimizeVerb.cs
- MsmqEncryptionAlgorithm.cs
- FormsAuthentication.cs