Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- TextEditorCharacters.cs
- TraceXPathNavigator.cs
- DirectoryRootQuery.cs
- FontInfo.cs
- ObjectRef.cs
- glyphs.cs
- FlowDocumentReader.cs
- IndependentlyAnimatedPropertyMetadata.cs
- StreamResourceInfo.cs
- NumberAction.cs
- CustomValidator.cs
- RegexTypeEditor.cs
- PackWebRequest.cs
- cache.cs
- AutomationEvent.cs
- RegexGroup.cs
- XmlText.cs
- BaseParser.cs
- Asn1IntegerConverter.cs
- ConfigXmlCDataSection.cs
- IgnoreDeviceFilterElement.cs
- DetailsViewModeEventArgs.cs
- PropertyDescriptors.cs
- DataGridItemEventArgs.cs
- DataObject.cs
- MimePart.cs
- TreeNodeMouseHoverEvent.cs
- PasswordTextContainer.cs
- SourceFileBuildProvider.cs
- UniqueEventHelper.cs
- DiscoveryClientBindingElement.cs
- OletxDependentTransaction.cs
- FontDifferentiator.cs
- PackUriHelper.cs
- ScriptIgnoreAttribute.cs
- Model3DGroup.cs
- Cursors.cs
- PropertyChangedEventManager.cs
- CodeCompiler.cs
- _CacheStreams.cs
- StructuredProperty.cs
- EditorZoneBase.cs
- FlowDocumentView.cs
- StatusBarItem.cs
- MULTI_QI.cs
- Brush.cs
- WorkflowTerminatedException.cs
- SqlFacetAttribute.cs
- ProfileGroupSettings.cs
- LingerOption.cs
- LazyLoadBehavior.cs
- Misc.cs
- TimeoutHelper.cs
- WebDisplayNameAttribute.cs
- COM2IProvidePropertyBuilderHandler.cs
- SecurityRuntime.cs
- Operand.cs
- MetabaseSettingsIis7.cs
- MimeTypeMapper.cs
- FormattedTextSymbols.cs
- Hashtable.cs
- HashCodeCombiner.cs
- RtType.cs
- RadioButton.cs
- BamlLocalizabilityResolver.cs
- ClientEndpointLoader.cs
- SafeFileMappingHandle.cs
- BuildProviderAppliesToAttribute.cs
- DebuggerAttributes.cs
- SQLStringStorage.cs
- ThousandthOfEmRealDoubles.cs
- DataGridColumnCollectionEditor.cs
- PreloadedPackages.cs
- SqlBuffer.cs
- CustomSignedXml.cs
- LeftCellWrapper.cs
- IdentitySection.cs
- KnownTypesHelper.cs
- SqlUdtInfo.cs
- AttachedPropertyMethodSelector.cs
- RewritingValidator.cs
- _NTAuthentication.cs
- RepeaterItem.cs
- BeginEvent.cs
- MouseGesture.cs
- TemplatePagerField.cs
- KeyGestureConverter.cs
- DropShadowBitmapEffect.cs
- WaitingCursor.cs
- SimpleWebHandlerParser.cs
- MSAANativeProvider.cs
- PkcsUtils.cs
- PermissionSet.cs
- SubstitutionDesigner.cs
- DateTimeSerializationSection.cs
- ConfigViewGenerator.cs
- MsmqIntegrationOutputChannel.cs
- _ListenerRequestStream.cs
- MailMessageEventArgs.cs
- RightsManagementPermission.cs