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
- CookieProtection.cs
- ValueConversionAttribute.cs
- SerializerWriterEventHandlers.cs
- TabItem.cs
- XmlSchema.cs
- EdmProperty.cs
- TreeIterators.cs
- SchemaElementDecl.cs
- DetailsView.cs
- ping.cs
- VBCodeProvider.cs
- ImageIndexConverter.cs
- _SecureChannel.cs
- DataGridDetailsPresenterAutomationPeer.cs
- Imaging.cs
- TableLayoutPanelResizeGlyph.cs
- CharEntityEncoderFallback.cs
- HorizontalAlignConverter.cs
- Semaphore.cs
- SqlDataRecord.cs
- XmlSchema.cs
- MsmqReceiveHelper.cs
- ProxyHelper.cs
- RightsManagementEncryptedStream.cs
- SmtpSection.cs
- ClientConfigurationSystem.cs
- BinaryNode.cs
- ToolboxDataAttribute.cs
- CngAlgorithmGroup.cs
- RuntimeResourceSet.cs
- UnsafePeerToPeerMethods.cs
- MonikerBuilder.cs
- StorageAssociationSetMapping.cs
- SecurityTokenException.cs
- PassportAuthentication.cs
- HostingPreferredMapPath.cs
- ZipPackagePart.cs
- MenuItem.cs
- Size3D.cs
- GPRECTF.cs
- XmlSchemaSubstitutionGroup.cs
- SqlCacheDependency.cs
- ClientTargetSection.cs
- SettingsAttributes.cs
- HtmlProps.cs
- LocalizationComments.cs
- NTAccount.cs
- ReachPrintTicketSerializer.cs
- TransformCollection.cs
- IsolationInterop.cs
- StructuralCache.cs
- ExtentKey.cs
- Base64Decoder.cs
- IconConverter.cs
- OdbcEnvironment.cs
- CategoryGridEntry.cs
- MenuStrip.cs
- UnknownMessageReceivedEventArgs.cs
- ImageDrawing.cs
- COM2Properties.cs
- CultureInfo.cs
- TimeSpanFormat.cs
- DoubleCollectionConverter.cs
- TransformerInfoCollection.cs
- ToolboxItemAttribute.cs
- CacheHelper.cs
- StrokeSerializer.cs
- SecurityUtils.cs
- FrameworkRichTextComposition.cs
- XPathScanner.cs
- DesigntimeLicenseContextSerializer.cs
- ExtenderProvidedPropertyAttribute.cs
- Directory.cs
- WSDualHttpBinding.cs
- Menu.cs
- _emptywebproxy.cs
- WindowsListViewItem.cs
- ViewManagerAttribute.cs
- MouseEvent.cs
- NonPrimarySelectionGlyph.cs
- ChainedAsyncResult.cs
- RenderDataDrawingContext.cs
- Config.cs
- HttpException.cs
- BindingMAnagerBase.cs
- XmlObjectSerializerContext.cs
- X509ThumbprintKeyIdentifierClause.cs
- DeleteWorkflowOwnerCommand.cs
- DataGridViewComboBoxEditingControl.cs
- TcpHostedTransportConfiguration.cs
- PlainXmlSerializer.cs
- HtmlInputReset.cs
- ControlEvent.cs
- OpCodes.cs
- ReferenceEqualityComparer.cs
- UserControl.cs
- DataGridCaption.cs
- SpecularMaterial.cs
- TypeSystemHelpers.cs
- Array.cs