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
- ParameterBuilder.cs
- RenderingEventArgs.cs
- SqlConnectionManager.cs
- ManagementOperationWatcher.cs
- ArrayExtension.cs
- DrawingBrush.cs
- ReliableReplySessionChannel.cs
- PropertyMap.cs
- RegularExpressionValidator.cs
- PrtCap_Base.cs
- SafeRightsManagementHandle.cs
- PromptBuilder.cs
- SoapObjectWriter.cs
- clipboard.cs
- WindowsScrollBar.cs
- ClientUriBehavior.cs
- AssemblySettingAttributes.cs
- TypedServiceChannelBuilder.cs
- SqlLiftIndependentRowExpressions.cs
- VirtualizedItemProviderWrapper.cs
- ClientUtils.cs
- _UncName.cs
- ConnectionInterfaceCollection.cs
- StylusTouchDevice.cs
- LocalizedNameDescriptionPair.cs
- ConstraintManager.cs
- EventLogHandle.cs
- SiteMapHierarchicalDataSourceView.cs
- MediaScriptCommandRoutedEventArgs.cs
- ImageIndexConverter.cs
- ScriptResourceDefinition.cs
- XmlSchemaAttribute.cs
- EntityRecordInfo.cs
- AnyReturnReader.cs
- SoapParser.cs
- PassportAuthentication.cs
- ExceptionAggregator.cs
- Rfc4050KeyFormatter.cs
- DynamicILGenerator.cs
- XXXOnTypeBuilderInstantiation.cs
- ButtonAutomationPeer.cs
- SerTrace.cs
- TrustManagerPromptUI.cs
- OutputCacheSection.cs
- TargetFrameworkAttribute.cs
- StaticResourceExtension.cs
- UserNameServiceElement.cs
- SQLInt32Storage.cs
- DataGridViewColumnHeaderCell.cs
- DefaultObjectMappingItemCollection.cs
- SimpleTypesSurrogate.cs
- ImportContext.cs
- MessageQueuePermissionEntryCollection.cs
- DataGridViewCellContextMenuStripNeededEventArgs.cs
- DataPointer.cs
- DataGridViewRowPostPaintEventArgs.cs
- VerticalAlignConverter.cs
- Renderer.cs
- SqlDataSourceConfigureSortForm.cs
- FormConverter.cs
- ReflectionPermission.cs
- FixedPosition.cs
- Timer.cs
- FontStyle.cs
- BrushValueSerializer.cs
- Accessible.cs
- Ray3DHitTestResult.cs
- GPStream.cs
- DataException.cs
- UTF7Encoding.cs
- TerminatorSinks.cs
- TextSelectionHighlightLayer.cs
- HttpRuntimeSection.cs
- DataGridViewCellLinkedList.cs
- HostingPreferredMapPath.cs
- RemoteWebConfigurationHostServer.cs
- StringPropertyBuilder.cs
- RijndaelManagedTransform.cs
- ObjectListDataBindEventArgs.cs
- ProbeMatchesApril2005.cs
- SiteMapProvider.cs
- NGCSerializationManagerAsync.cs
- IHttpResponseInternal.cs
- IFlowDocumentViewer.cs
- SecurityPermission.cs
- SimpleFileLog.cs
- StatusBar.cs
- ParameterCollectionEditorForm.cs
- UserUseLicenseDictionaryLoader.cs
- ToolstripProfessionalRenderer.cs
- GeneralTransform.cs
- GroupItemAutomationPeer.cs
- TextDecorations.cs
- CodeDelegateCreateExpression.cs
- NavigationCommands.cs
- NetworkInterface.cs
- Viewport3DVisual.cs
- WebServiceErrorEvent.cs
- CqlLexer.cs
- MSAAEventDispatcher.cs