├── .gitattributes ├── .gitignore ├── ConversationExport ├── ConversationExport.zip ├── css │ ├── bootstrap-theme.css │ ├── bootstrap-theme.css.map │ ├── bootstrap-theme.min.css │ ├── bootstrap-theme.min.css.map │ ├── bootstrap.css │ ├── bootstrap.css.map │ ├── bootstrap.min.css │ ├── bootstrap.min.css.map │ ├── main.css │ └── normalize.css ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── img │ └── ic_broken_image_black_48dp_2x.png ├── index.html └── js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── main.js │ ├── npm.js │ ├── plugins.js │ └── vendor │ ├── angular.min.js │ ├── jquery-1.12.0.min.js │ └── modernizr-2.8.3.min.js ├── Disa.Framework.Mobile.Shared ├── Disa.Framework.Mobile.Shared.projitems ├── Disa.Framework.Mobile.Shared.shproj ├── EmailEntry.cs ├── IPluginDescription.cs ├── IPluginPage.cs ├── IPluginPageControls.cs ├── PhoneEntry.cs └── UserProfile.cs ├── Disa.Framework.Mobile ├── Disa.Framework.Mobile.csproj ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── Disa.Framework.Shared ├── Analytics.cs ├── Axolotl.cs ├── AxolotlImplementation.cs ├── Bots │ ├── BotCommand.cs │ ├── BotInfo.cs │ ├── BotInlineMessage.cs │ ├── BotInlineResult.cs │ ├── BotResults.cs │ ├── BubbleMarkup.cs │ ├── Document.cs │ ├── DocumentAttribute.cs │ ├── FileLocation.cs │ ├── GeoPoint.cs │ ├── InlineBotSwitchPM.cs │ ├── InputBotInlineMessage.cs │ ├── InputBotInlineMessageID.cs │ ├── InputBotInlineResult.cs │ ├── InputStickerSet.cs │ ├── KeyboardButton.cs │ ├── KeyboardButtonRow.cs │ ├── KeyboardMarkup.cs │ ├── MessagesBotCallbackAnswer.cs │ ├── MessagesBotResults.cs │ ├── Photo.cs │ ├── PhotoSize.cs │ └── Update.cs ├── BubbleGroup.cs ├── BubbleGroupCache.cs ├── BubbleGroupCacheManager.cs ├── BubbleGroupDatabase.cs ├── BubbleGroupDatabasePrimitives.cs ├── BubbleGroupEvents.cs ├── BubbleGroupExport.cs ├── BubbleGroupFactory.cs ├── BubbleGroupIndex.cs ├── BubbleGroupManager.cs ├── BubbleGroupSettings.cs ├── BubbleGroupSettingsManager.cs ├── BubbleGroupSync.cs ├── BubbleGroupUpdater.cs ├── BubbleGroupUtils.cs ├── BubbleManager.cs ├── BubbleQueueManager.cs ├── BubbleTransfer.cs ├── Bubbles │ ├── AbstractBubble.cs │ ├── AudioBubble.cs │ ├── Bubble.cs │ ├── ComposeBubble.cs │ ├── ContactBubble.cs │ ├── DeliveredBubble.cs │ ├── DeliveredBubbleReceipt.cs │ ├── FileBubble.cs │ ├── ImageBubble.cs │ ├── LocationBubble.cs │ ├── NewBubble.cs │ ├── NewDayBubble.cs │ ├── PartyInformationBubble.cs │ ├── PresenceBubble.cs │ ├── ReadBubble.cs │ ├── SoloInformationBubble.cs │ ├── StickerBubble.cs │ ├── SubscribeBubble.cs │ ├── TextBubble.cs │ ├── TypingBubble.cs │ ├── VideoBubble.cs │ └── VisualBubble.cs ├── ComposeBubbleGroup.cs ├── Contact.cs ├── ContactCard.cs ├── Disa.Framework.Shared.projitems ├── Disa.Framework.Shared.shproj ├── DisaMutableSettings.cs ├── DisaParticipant.cs ├── DisaParticipantNickname.cs ├── DisaQuotedTitle.cs ├── DisaReadTime.cs ├── DisaServiceUserSettings.cs ├── DisaSettings.cs ├── DisaThumbnail.cs ├── DisaUnifiedBubbleGroupEntry.cs ├── Emoji.cs ├── Hashtag.cs ├── IAnnouncement.cs ├── IBots.cs ├── IMediaDownloader.cs ├── IMediaDownloaderCustom.cs ├── IMentions.cs ├── IMessageIntent.cs ├── INewChannel.cs ├── INewMessage.cs ├── INewMessageExtended.cs ├── IPartyBlockedParticipants.cs ├── IPartyOptions.cs ├── IPartyOptionsExtended.cs ├── IPartyOptionsSettings.cs ├── IPartyParticipantRequests.cs ├── IPartyThumbnail.cs ├── IPrivacyList.cs ├── ITerminal.cs ├── IThumbnailDownloader.cs ├── ITimeFormatter.cs ├── IUserInformation.cs ├── IUserInformationExtended.cs ├── IVisualBubbleServiceId.cs ├── IconType.cs ├── LogsManager.cs ├── MediaManager.cs ├── Mention.cs ├── MutableSettingsManager.cs ├── NotificationManager.cs ├── OkHttpClient.cs ├── PhoneBook.cs ├── PhoneBookContact.cs ├── Platform.cs ├── PlatformImplementation.cs ├── PlatformManager.cs ├── Queue.cs ├── SendBubbleAction.cs ├── Service.cs ├── ServiceBubbleGroupAddressException.cs ├── ServiceBubbleSendFailedException.cs ├── ServiceEvents.cs ├── ServiceExpiredException.cs ├── ServiceInfo.cs ├── ServiceManager.cs ├── ServiceManagerException.cs ├── ServiceQueueBubbleException.cs ├── ServiceRestartException.cs ├── ServiceSchedulerException.cs ├── ServiceSpecialRestartException.cs ├── ServiceUserSettingsManager.cs ├── ServiceWarningException.cs ├── SettingsChangedManager.cs ├── SettingsManager.cs ├── SimpleDatabase.cs ├── Socket.cs ├── SqlDatabase.cs ├── SslSocket.cs ├── ThreadSafeList.cs ├── ThumbnailTransfer.cs ├── Time.cs ├── UnifiedBubbleGroup.cs ├── UserInformation.cs ├── Utils.cs ├── WakeLock.cs ├── WakeLockBalancer.cs ├── WebClient.cs └── ZipStorer.cs ├── Disa.Framework.Telegram.Mobile.Shared ├── Description.cs ├── Disa.Framework.Telegram.Mobile.Shared.projitems ├── Disa.Framework.Telegram.Mobile.Shared.shproj ├── PluginManifest.xml ├── Properties │ └── AssemblyInfo.cs ├── Settings.cs └── Setup.cs ├── Disa.Framework.Telegram.Mobile ├── Disa.Framework.Telegram.Mobile.csproj └── packages.config ├── Disa.Framework.Telegram.Shared ├── Authentication.cs ├── BigMath │ ├── BigInteger.cs │ ├── Int128.cs │ ├── Int256.cs │ └── Utils │ │ ├── ArrayUtils.cs │ │ ├── Crc32.cs │ │ ├── ExtendedBitConverter.cs │ │ └── MathUtils.cs ├── CachedChat.cs ├── CachedDialogs.cs ├── CachedThumbnail.cs ├── CachedUser.cs ├── Constants.cs ├── Contact.cs ├── DcManager.cs ├── Disa.Framework.Telegram.Shared.projitems ├── Disa.Framework.Telegram.Shared.shproj ├── DownloadManager.cs ├── FileInformation.cs ├── FullClient.cs ├── HttpUtilities.cs ├── Localize.cs ├── MediaDownloader.cs ├── MessageIntent.cs ├── Nito.AsyncEx │ ├── Base │ │ ├── AsyncAutoResetEvent.cs │ │ ├── AsyncBarrier.cs │ │ ├── AsyncConditionVariable.cs │ │ ├── AsyncContext.SynchronizationContext.cs │ │ ├── AsyncContext.TaskQueue.cs │ │ ├── AsyncContext.TaskScheduler.cs │ │ ├── AsyncContext.cs │ │ ├── AsyncContextThread.cs │ │ ├── AsyncCountdownEvent.cs │ │ ├── AsyncFactory (of TResult).FromAsync.cs │ │ ├── AsyncFactory (of TResult).FromAsync.tt │ │ ├── AsyncFactory (of TResult).cs │ │ ├── AsyncFactory.FromAsync.cs │ │ ├── AsyncFactory.FromAsync.tt │ │ ├── AsyncFactory.cs │ │ ├── AsyncLazy.cs │ │ ├── AsyncLock.cs │ │ ├── AsyncManualResetEvent.cs │ │ ├── AsyncMonitor.cs │ │ ├── AsyncProducerConsumerQueue.cs │ │ ├── AsyncReaderWriterLock.cs │ │ ├── AsyncSemaphore.cs │ │ ├── AsyncWaitQueue.cs │ │ ├── AwaitableDisposable.cs │ │ ├── CancellationTokenExtensions.cs │ │ ├── CancellationTokenHelpers.cs │ │ ├── DeferralManager.cs │ │ ├── Deque.cs │ │ ├── ExceptionHelpers.cs │ │ ├── Internal │ │ │ ├── IdManager.cs │ │ │ ├── ReflectionShim.cs │ │ │ └── TaskShim.cs │ │ ├── Nito.AsyncEx (NET45, Win8, WP8, WPA81).csproj │ │ ├── NormalizedCancellationToken.cs │ │ ├── NotifyTaskCompletion.cs │ │ ├── PauseToken.cs │ │ ├── PropertyProgress.cs │ │ ├── SynchronizationContextHelpers.cs │ │ ├── Synchronous │ │ │ └── TaskExtensions.cs │ │ ├── TaskCompletionSource.cs │ │ ├── TaskCompletionSourceExtensions.cs │ │ ├── TaskConstants.cs │ │ ├── TaskExtensions.cs │ │ ├── TaskFactoryExtensions.cs │ │ └── packages.config │ └── Enlightement │ │ ├── EnlightenmentVerification.cs │ │ └── Internal │ │ └── PlatformEnlightenment │ │ ├── AsyncEnlightenment.cs │ │ ├── BlockingQueue.cs │ │ ├── ExceptionEnlightenment.cs │ │ ├── Lazy.cs │ │ ├── SingleThreadedApartmentThread.cs │ │ ├── SynchronizationContextEnlightenment.cs │ │ └── ThreadPoolEnlightenment.cs ├── ObjectDumper.cs ├── PrivacyList.cs ├── Properties │ └── AssemblyInfo.cs ├── RSAPublicKey.cs ├── Raksha │ ├── Apache │ │ └── Bzip2 │ │ │ ├── BZip2Constants.cs │ │ │ ├── CBZip2InputStream.cs │ │ │ ├── CBZip2OutputStream.cs │ │ │ └── CRC.cs │ ├── Asn1 │ │ ├── ASN1Generator.cs │ │ ├── ASN1OctetStringParser.cs │ │ ├── ASN1SequenceParser.cs │ │ ├── ASN1SetParser.cs │ │ ├── ASN1StreamParser.cs │ │ ├── ASN1TaggedObjectParser.cs │ │ ├── Asn1Encodable.cs │ │ ├── Asn1EncodableVector.cs │ │ ├── Asn1Exception.cs │ │ ├── Asn1InputStream.cs │ │ ├── Asn1Null.cs │ │ ├── Asn1Object.cs │ │ ├── Asn1OctetString.cs │ │ ├── Asn1OutputStream.cs │ │ ├── Asn1ParsingException.cs │ │ ├── Asn1Sequence.cs │ │ ├── Asn1Set.cs │ │ ├── Asn1TaggedObject.cs │ │ ├── Asn1Tags.cs │ │ ├── BC │ │ │ └── BCObjectIdentifiers.cs │ │ ├── BERGenerator.cs │ │ ├── BEROctetStringGenerator.cs │ │ ├── BEROctetStringParser.cs │ │ ├── BERSequenceGenerator.cs │ │ ├── BERSequenceParser.cs │ │ ├── BERSetGenerator.cs │ │ ├── BERSetParser.cs │ │ ├── BERTaggedObjectParser.cs │ │ ├── BerApplicationSpecific.cs │ │ ├── BerApplicationSpecificParser.cs │ │ ├── BerNull.cs │ │ ├── BerOctetString.cs │ │ ├── BerOutputStream.cs │ │ ├── BerSequence.cs │ │ ├── BerSet.cs │ │ ├── BerTaggedObject.cs │ │ ├── Cmp │ │ │ ├── CAKeyUpdAnnContent.cs │ │ │ ├── CertConfirmContent.cs │ │ │ ├── CertOrEncCert.cs │ │ │ ├── CertRepMessage.cs │ │ │ ├── CertResponse.cs │ │ │ ├── CertStatus.cs │ │ │ ├── CertifiedKeyPair.cs │ │ │ ├── Challenge.cs │ │ │ ├── CmpCertificate.cs │ │ │ ├── CmpObjectIdentifiers.cs │ │ │ ├── CrlAnnContent.cs │ │ │ ├── ErrorMsgContent.cs │ │ │ ├── GenMsgContent.cs │ │ │ ├── GenRepContent.cs │ │ │ ├── InfoTypeAndValue.cs │ │ │ ├── KeyRecRepContent.cs │ │ │ ├── OobCertHash.cs │ │ │ ├── PKIBody.cs │ │ │ ├── PKIConfirmContent.cs │ │ │ ├── PKIFailureInfo.cs │ │ │ ├── PKIFreeText.cs │ │ │ ├── PKIHeader.cs │ │ │ ├── PKIHeaderBuilder.cs │ │ │ ├── PKIMessage.cs │ │ │ ├── PKIMessages.cs │ │ │ ├── PKIStatus.cs │ │ │ ├── PKIStatusInfo.cs │ │ │ ├── PbmParameter.cs │ │ │ ├── PollRepContent.cs │ │ │ ├── PollReqContent.cs │ │ │ ├── PopoDecKeyChallContent.cs │ │ │ ├── PopoDecKeyRespContent.cs │ │ │ ├── ProtectedPart.cs │ │ │ ├── RevAnnContent.cs │ │ │ ├── RevDetails.cs │ │ │ ├── RevRepContent.cs │ │ │ ├── RevRepContentBuilder.cs │ │ │ └── RevReqContent.cs │ │ ├── Cms │ │ │ ├── Attribute.cs │ │ │ ├── AttributeTable.cs │ │ │ ├── Attributes.cs │ │ │ ├── AuthEnvelopedData.cs │ │ │ ├── AuthEnvelopedDataParser.cs │ │ │ ├── AuthenticatedData.cs │ │ │ ├── AuthenticatedDataParser.cs │ │ │ ├── CMSAttributes.cs │ │ │ ├── CMSObjectIdentifiers.cs │ │ │ ├── CompressedData.cs │ │ │ ├── CompressedDataParser.cs │ │ │ ├── ContentInfo.cs │ │ │ ├── ContentInfoParser.cs │ │ │ ├── Ecc │ │ │ │ └── MQVuserKeyingMaterial.cs │ │ │ ├── EncryptedContentInfo.cs │ │ │ ├── EncryptedContentInfoParser.cs │ │ │ ├── EncryptedData.cs │ │ │ ├── EnvelopedData.cs │ │ │ ├── EnvelopedDataParser.cs │ │ │ ├── Evidence.cs │ │ │ ├── IssuerAndSerialNumber.cs │ │ │ ├── KEKIdentifier.cs │ │ │ ├── KEKRecipientInfo.cs │ │ │ ├── KeyAgreeRecipientIdentifier.cs │ │ │ ├── KeyAgreeRecipientInfo.cs │ │ │ ├── KeyTransRecipientInfo.cs │ │ │ ├── MetaData.cs │ │ │ ├── OriginatorIdentifierOrKey.cs │ │ │ ├── OriginatorInfo.cs │ │ │ ├── OriginatorPublicKey.cs │ │ │ ├── OtherKeyAttribute.cs │ │ │ ├── OtherRecipientInfo.cs │ │ │ ├── PasswordRecipientInfo.cs │ │ │ ├── RecipientEncryptedKey.cs │ │ │ ├── RecipientIdentifier.cs │ │ │ ├── RecipientInfo.cs │ │ │ ├── RecipientKeyIdentifier.cs │ │ │ ├── SignedData.cs │ │ │ ├── SignedDataParser.cs │ │ │ ├── SignerIdentifier.cs │ │ │ ├── SignerInfo.cs │ │ │ ├── Time.cs │ │ │ ├── TimeStampAndCRL.cs │ │ │ ├── TimeStampTokenEvidence.cs │ │ │ ├── TimeStampedData.cs │ │ │ └── TimeStampedDataParser.cs │ │ ├── ConstructedOctetStream.cs │ │ ├── Crmf │ │ │ ├── AttributeTypeAndValue.cs │ │ │ ├── CertId.cs │ │ │ ├── CertReqMessages.cs │ │ │ ├── CertReqMsg.cs │ │ │ ├── CertRequest.cs │ │ │ ├── CertTemplate.cs │ │ │ ├── CertTemplateBuilder.cs │ │ │ ├── Controls.cs │ │ │ ├── CrmfObjectIdentifiers.cs │ │ │ ├── EncKeyWithID.cs │ │ │ ├── EncryptedKey.cs │ │ │ ├── EncryptedValue.cs │ │ │ ├── OptionalValidity.cs │ │ │ ├── PKIArchiveOptions.cs │ │ │ ├── PKIPublicationInfo.cs │ │ │ ├── PKMacValue.cs │ │ │ ├── PopoPrivKey.cs │ │ │ ├── PopoSigningKey.cs │ │ │ ├── PopoSigningKeyInput.cs │ │ │ ├── ProofOfPossession.cs │ │ │ ├── SinglePubInfo.cs │ │ │ └── SubsequentMessage.cs │ │ ├── CryptoPro │ │ │ ├── CryptoProObjectIdentifiers.cs │ │ │ ├── ECGOST3410NamedCurves.cs │ │ │ ├── ECGOST3410ParamSetParameters.cs │ │ │ ├── GOST28147Parameters.cs │ │ │ ├── GOST3410NamedParameters.cs │ │ │ ├── GOST3410ParamSetParameters.cs │ │ │ └── GOST3410PublicKeyAlgParameters.cs │ │ ├── DERExternal.cs │ │ ├── DERExternalParser.cs │ │ ├── DERGenerator.cs │ │ ├── DEROctetStringParser.cs │ │ ├── DERSequenceGenerator.cs │ │ ├── DERSequenceParser.cs │ │ ├── DERSetGenerator.cs │ │ ├── DERSetParser.cs │ │ ├── DefiniteLengthInputStream.cs │ │ ├── DerApplicationSpecific.cs │ │ ├── DerBMPString.cs │ │ ├── DerBitString.cs │ │ ├── DerBoolean.cs │ │ ├── DerEnumerated.cs │ │ ├── DerGeneralString.cs │ │ ├── DerGeneralizedTime.cs │ │ ├── DerIA5String.cs │ │ ├── DerInteger.cs │ │ ├── DerNull.cs │ │ ├── DerNumericString.cs │ │ ├── DerObjectIdentifier.cs │ │ ├── DerOctetString.cs │ │ ├── DerOutputStream.cs │ │ ├── DerPrintableString.cs │ │ ├── DerSequence.cs │ │ ├── DerSet.cs │ │ ├── DerStringBase.cs │ │ ├── DerT61String.cs │ │ ├── DerTaggedObject.cs │ │ ├── DerUTCTime.cs │ │ ├── DerUTF8String.cs │ │ ├── DerUniversalString.cs │ │ ├── DerUnknownTag.cs │ │ ├── DerVisibleString.cs │ │ ├── Eac │ │ │ └── EACObjectIdentifiers.cs │ │ ├── Esf │ │ │ ├── CertificateValues.cs │ │ │ ├── CommitmentTypeIdentifier.cs │ │ │ ├── CommitmentTypeIndication.cs │ │ │ ├── CommitmentTypeQualifier.cs │ │ │ ├── CompleteCertificateRefs.cs │ │ │ ├── CompleteRevocationRefs.cs │ │ │ ├── CrlIdentifier.cs │ │ │ ├── CrlListID.cs │ │ │ ├── CrlOcspRef.cs │ │ │ ├── CrlValidatedID.cs │ │ │ ├── ESFAttributes.cs │ │ │ ├── OcspIdentifier.cs │ │ │ ├── OcspListID.cs │ │ │ ├── OcspResponsesID.cs │ │ │ ├── OtherCertID.cs │ │ │ ├── OtherHash.cs │ │ │ ├── OtherHashAlgAndValue.cs │ │ │ ├── OtherRevRefs.cs │ │ │ ├── OtherRevVals.cs │ │ │ ├── OtherSigningCertificate.cs │ │ │ ├── RevocationValues.cs │ │ │ ├── SigPolicyQualifierInfo.cs │ │ │ ├── SignaturePolicyId.cs │ │ │ ├── SignaturePolicyIdentifier.cs │ │ │ ├── SignerAttribute.cs │ │ │ └── SignerLocation.cs │ │ ├── Ess │ │ │ ├── ContentHints.cs │ │ │ ├── ContentIdentifier.cs │ │ │ ├── ESSCertID.cs │ │ │ ├── ESSCertIDv2.cs │ │ │ ├── OtherCertID.cs │ │ │ ├── OtherSigningCertificate.cs │ │ │ ├── SigningCertificate.cs │ │ │ └── SigningCertificateV2.cs │ │ ├── Gnu │ │ │ └── GNUObjectIdentifiers.cs │ │ ├── IAsn1ApplicationSpecificParser.cs │ │ ├── IAsn1Choice.cs │ │ ├── IAsn1Convertible.cs │ │ ├── IAsn1String.cs │ │ ├── Iana │ │ │ └── IANAObjectIdentifiers.cs │ │ ├── Icao │ │ │ ├── CscaMasterList.cs │ │ │ ├── DataGroupHash.cs │ │ │ ├── ICAOObjectIdentifiers.cs │ │ │ ├── LDSSecurityObject.cs │ │ │ └── LDSVersionInfo.cs │ │ ├── IndefiniteLengthInputStream.cs │ │ ├── IsisMtt │ │ │ ├── ISISMTTObjectIdentifiers.cs │ │ │ ├── Ocsp │ │ │ │ ├── CertHash.cs │ │ │ │ └── RequestedCertificate.cs │ │ │ └── X509 │ │ │ │ ├── AdditionalInformationSyntax.cs │ │ │ │ ├── AdmissionSyntax.cs │ │ │ │ ├── Admissions.cs │ │ │ │ ├── DeclarationOfMajority.cs │ │ │ │ ├── MonetaryLimit.cs │ │ │ │ ├── NamingAuthority.cs │ │ │ │ ├── ProcurationSyntax.cs │ │ │ │ ├── ProfessionInfo.cs │ │ │ │ └── Restriction.cs │ │ ├── Kisa │ │ │ └── KISAObjectIdentifiers.cs │ │ ├── LazyASN1InputStream.cs │ │ ├── LazyDERSequence.cs │ │ ├── LazyDERSet.cs │ │ ├── LimitedInputStream.cs │ │ ├── Microsoft │ │ │ └── MicrosoftObjectIdentifiers.cs │ │ ├── Misc │ │ │ ├── CAST5CBCParameters.cs │ │ │ ├── MiscObjectIdentifiers.cs │ │ │ ├── NetscapeCertType.cs │ │ │ ├── NetscapeRevocationURL.cs │ │ │ └── VerisignCzagExtension.cs │ │ ├── Mozilla │ │ │ └── PublicKeyAndChallenge.cs │ │ ├── Nist │ │ │ ├── NISTNamedCurves.cs │ │ │ └── NISTObjectIdentifiers.cs │ │ ├── Ntt │ │ │ └── NTTObjectIdentifiers.cs │ │ ├── Ocsp │ │ │ ├── BasicOCSPResponse.cs │ │ │ ├── CertID.cs │ │ │ ├── CertStatus.cs │ │ │ ├── CrlID.cs │ │ │ ├── OCSPObjectIdentifiers.cs │ │ │ ├── OCSPRequest.cs │ │ │ ├── OCSPResponse.cs │ │ │ ├── OCSPResponseStatus.cs │ │ │ ├── Request.cs │ │ │ ├── ResponderID.cs │ │ │ ├── ResponseBytes.cs │ │ │ ├── ResponseData.cs │ │ │ ├── RevokedInfo.cs │ │ │ ├── ServiceLocator.cs │ │ │ ├── Signature.cs │ │ │ ├── SingleResponse.cs │ │ │ └── TBSRequest.cs │ │ ├── OidTokenizer.cs │ │ ├── Oiw │ │ │ ├── ElGamalParameter.cs │ │ │ └── OIWObjectIdentifiers.cs │ │ ├── Pkcs │ │ │ ├── Attribute.cs │ │ │ ├── AuthenticatedSafe.cs │ │ │ ├── CertBag.cs │ │ │ ├── CertificationRequest.cs │ │ │ ├── CertificationRequestInfo.cs │ │ │ ├── ContentInfo.cs │ │ │ ├── DHParameter.cs │ │ │ ├── EncryptedData.cs │ │ │ ├── EncryptedPrivateKeyInfo.cs │ │ │ ├── EncryptionScheme.cs │ │ │ ├── IssuerAndSerialNumber.cs │ │ │ ├── KeyDerivationFunc.cs │ │ │ ├── MacData.cs │ │ │ ├── PBEParameter.cs │ │ │ ├── PBES2Parameters.cs │ │ │ ├── PBKDF2Params.cs │ │ │ ├── PKCS12PBEParams.cs │ │ │ ├── PKCSObjectIdentifiers.cs │ │ │ ├── Pfx.cs │ │ │ ├── PrivateKeyInfo.cs │ │ │ ├── RC2CBCParameter.cs │ │ │ ├── RSAESOAEPparams.cs │ │ │ ├── RSAPrivateKeyStructure.cs │ │ │ ├── RSASSAPSSparams.cs │ │ │ ├── SafeBag.cs │ │ │ ├── SignedData.cs │ │ │ └── SignerInfo.cs │ │ ├── Sec │ │ │ ├── ECPrivateKeyStructure.cs │ │ │ ├── SECNamedCurves.cs │ │ │ └── SECObjectIdentifiers.cs │ │ ├── Smime │ │ │ ├── SMIMEAttributes.cs │ │ │ ├── SMIMECapabilities.cs │ │ │ ├── SMIMECapabilitiesAttribute.cs │ │ │ ├── SMIMECapability.cs │ │ │ ├── SMIMECapabilityVector.cs │ │ │ └── SMIMEEncryptionKeyPreferenceAttribute.cs │ │ ├── TeleTrust │ │ │ ├── TeleTrusTNamedCurves.cs │ │ │ └── TeleTrusTObjectIdentifiers.cs │ │ ├── Tsp │ │ │ ├── Accuracy.cs │ │ │ ├── MessageImprint.cs │ │ │ ├── TSTInfo.cs │ │ │ ├── TimeStampReq.cs │ │ │ └── TimeStampResp.cs │ │ ├── Utilities │ │ │ ├── Asn1Dump.cs │ │ │ └── FilterStream.cs │ │ ├── X500 │ │ │ └── DirectoryString.cs │ │ ├── X509 │ │ │ ├── AccessDescription.cs │ │ │ ├── AlgorithmIdentifier.cs │ │ │ ├── AttCertIssuer.cs │ │ │ ├── AttCertValidityPeriod.cs │ │ │ ├── Attribute.cs │ │ │ ├── AttributeCertificate.cs │ │ │ ├── AttributeCertificateInfo.cs │ │ │ ├── AttributeTable.cs │ │ │ ├── AuthorityInformationAccess.cs │ │ │ ├── AuthorityKeyIdentifier.cs │ │ │ ├── BasicConstraints.cs │ │ │ ├── CRLDistPoint.cs │ │ │ ├── CRLNumber.cs │ │ │ ├── CRLReason.cs │ │ │ ├── CertPolicyId.cs │ │ │ ├── CertificateList.cs │ │ │ ├── CertificatePair.cs │ │ │ ├── DSAParameter.cs │ │ │ ├── DigestInfo.cs │ │ │ ├── DisplayText.cs │ │ │ ├── DistributionPoint.cs │ │ │ ├── DistributionPointName.cs │ │ │ ├── ExtendedKeyUsage.cs │ │ │ ├── GeneralName.cs │ │ │ ├── GeneralNames.cs │ │ │ ├── GeneralSubtree.cs │ │ │ ├── Holder.cs │ │ │ ├── IetfAttrSyntax.cs │ │ │ ├── IssuerSerial.cs │ │ │ ├── IssuingDistributionPoint.cs │ │ │ ├── KeyPurposeId.cs │ │ │ ├── KeyUsage.cs │ │ │ ├── NameConstraints.cs │ │ │ ├── NoticeReference.cs │ │ │ ├── ObjectDigestInfo.cs │ │ │ ├── PolicyInformation.cs │ │ │ ├── PolicyMappings.cs │ │ │ ├── PolicyQualifierId.cs │ │ │ ├── PolicyQualifierInfo.cs │ │ │ ├── PrivateKeyUsagePeriod.cs │ │ │ ├── Qualified │ │ │ │ ├── BiometricData.cs │ │ │ │ ├── ETSIQCObjectIdentifiers.cs │ │ │ │ ├── Iso4217CurrencyCode.cs │ │ │ │ ├── MonetaryValue.cs │ │ │ │ ├── QCStatement.cs │ │ │ │ ├── RFC3739QCObjectIdentifiers.cs │ │ │ │ ├── SemanticsInformation.cs │ │ │ │ └── TypeOfBiometricData.cs │ │ │ ├── RSAPublicKeyStructure.cs │ │ │ ├── ReasonFlags.cs │ │ │ ├── RoleSyntax.cs │ │ │ ├── SigI │ │ │ │ ├── NameOrPseudonym.cs │ │ │ │ ├── PersonalData.cs │ │ │ │ └── SigIObjectIdentifiers.cs │ │ │ ├── SubjectDirectoryAttributes.cs │ │ │ ├── SubjectKeyIdentifier.cs │ │ │ ├── SubjectPublicKeyInfo.cs │ │ │ ├── TBSCertList.cs │ │ │ ├── TBSCertificateStructure.cs │ │ │ ├── Target.cs │ │ │ ├── TargetInformation.cs │ │ │ ├── Targets.cs │ │ │ ├── Time.cs │ │ │ ├── UserNotice.cs │ │ │ ├── V1TBSCertificateGenerator.cs │ │ │ ├── V2AttributeCertificateInfoGenerator.cs │ │ │ ├── V2Form.cs │ │ │ ├── V2TBSCertListGenerator.cs │ │ │ ├── V3TBSCertificateGenerator.cs │ │ │ ├── X509Attributes.cs │ │ │ ├── X509CertificateStructure.cs │ │ │ ├── X509DefaultEntryConverter.cs │ │ │ ├── X509Extension.cs │ │ │ ├── X509Extensions.cs │ │ │ ├── X509ExtensionsGenerator.cs │ │ │ ├── X509Name.cs │ │ │ ├── X509NameEntryConverter.cs │ │ │ ├── X509NameTokenizer.cs │ │ │ └── X509ObjectIdentifiers.cs │ │ └── X9 │ │ │ ├── DHDomainParameters.cs │ │ │ ├── DHPublicKey.cs │ │ │ ├── DHValidationParms.cs │ │ │ ├── KeySpecificInfo.cs │ │ │ ├── OtherInfo.cs │ │ │ ├── X962NamedCurves.cs │ │ │ ├── X962Parameters.cs │ │ │ ├── X9Curve.cs │ │ │ ├── X9ECParameters.cs │ │ │ ├── X9ECParametersHolder.cs │ │ │ ├── X9ECPoint.cs │ │ │ ├── X9FieldElement.cs │ │ │ ├── X9FieldID.cs │ │ │ ├── X9IntegerConverter.cs │ │ │ └── X9ObjectIdentifiers.cs │ ├── Bcpg │ │ ├── ArmoredInputStream.cs │ │ ├── ArmoredOutputStream.cs │ │ ├── Attr │ │ │ └── ImageAttrib.cs │ │ ├── BcpgInputStream.cs │ │ ├── BcpgObject.cs │ │ ├── BcpgOutputStream.cs │ │ ├── CompressedDataPacket.cs │ │ ├── CompressionAlgorithmTags.cs │ │ ├── ContainedPacket.cs │ │ ├── Crc24.cs │ │ ├── DsaPublicBcpgKey.cs │ │ ├── DsaSecretBcpgKey.cs │ │ ├── ElGamalPublicBcpgKey.cs │ │ ├── ElGamalSecretBcpgKey.cs │ │ ├── ExperimentalPacket.cs │ │ ├── HashAlgorithmTags.cs │ │ ├── IBcpgKey.cs │ │ ├── InputStreamPacket.cs │ │ ├── LiteralDataPacket.cs │ │ ├── MPInteger.cs │ │ ├── MarkerPacket.cs │ │ ├── ModDetectionCodePacket.cs │ │ ├── OnePassSignaturePacket.cs │ │ ├── OpenPgp │ │ │ ├── IStreamGenerator.cs │ │ │ ├── PGPKeyRing.cs │ │ │ ├── PGPObject.cs │ │ │ ├── PGPUserAttributeSubpacketVectorGenerator.cs │ │ │ ├── PgpCompressedData.cs │ │ │ ├── PgpCompressedDataGenerator.cs │ │ │ ├── PgpDataValidationException.cs │ │ │ ├── PgpEncryptedData.cs │ │ │ ├── PgpEncryptedDataGenerator.cs │ │ │ ├── PgpEncryptedDataList.cs │ │ │ ├── PgpException.cs │ │ │ ├── PgpExperimental.cs │ │ │ ├── PgpKeyFlags.cs │ │ │ ├── PgpKeyPair.cs │ │ │ ├── PgpKeyRingGenerator.cs │ │ │ ├── PgpKeyValidationException.cs │ │ │ ├── PgpLiteralData.cs │ │ │ ├── PgpLiteralDataGenerator.cs │ │ │ ├── PgpMarker.cs │ │ │ ├── PgpObjectFactory.cs │ │ │ ├── PgpOnePassSignature.cs │ │ │ ├── PgpOnePassSignatureList.cs │ │ │ ├── PgpPbeEncryptedData.cs │ │ │ ├── PgpPrivateKey.cs │ │ │ ├── PgpPublicKey.cs │ │ │ ├── PgpPublicKeyEncryptedData.cs │ │ │ ├── PgpPublicKeyRing.cs │ │ │ ├── PgpPublicKeyRingBundle.cs │ │ │ ├── PgpSecretKey.cs │ │ │ ├── PgpSecretKeyRing.cs │ │ │ ├── PgpSecretKeyRingBundle.cs │ │ │ ├── PgpSignature.cs │ │ │ ├── PgpSignatureGenerator.cs │ │ │ ├── PgpSignatureList.cs │ │ │ ├── PgpSignatureSubpacketGenerator.cs │ │ │ ├── PgpSignatureSubpacketVector.cs │ │ │ ├── PgpUserAttributeSubpacketVector.cs │ │ │ ├── PgpUtilities.cs │ │ │ ├── PgpV3SignatureGenerator.cs │ │ │ └── WrappedGeneratorStream.cs │ │ ├── OutputStreamPacket.cs │ │ ├── Packet.cs │ │ ├── PacketTags.cs │ │ ├── PublicKeyAlgorithmTags.cs │ │ ├── PublicKeyEncSessionPacket.cs │ │ ├── PublicKeyPacket.cs │ │ ├── PublicSubkeyPacket.cs │ │ ├── RsaPublicBcpgKey.cs │ │ ├── RsaSecretBcpgKey.cs │ │ ├── S2k.cs │ │ ├── SecretKeyPacket.cs │ │ ├── SecretSubkeyPacket.cs │ │ ├── Sig │ │ │ ├── EmbeddedSignature.cs │ │ │ ├── Exportable.cs │ │ │ ├── IssuerKeyId.cs │ │ │ ├── KeyExpirationTime.cs │ │ │ ├── KeyFlags.cs │ │ │ ├── NotationData.cs │ │ │ ├── PreferredAlgorithms.cs │ │ │ ├── PrimaryUserId.cs │ │ │ ├── Revocable.cs │ │ │ ├── SignatureCreationTime.cs │ │ │ ├── SignatureExpirationTime.cs │ │ │ ├── SignerUserId.cs │ │ │ └── TrustSignature.cs │ │ ├── SignaturePacket.cs │ │ ├── SignatureSubpacket.cs │ │ ├── SignatureSubpacketTags.cs │ │ ├── SignatureSubpacketsReader.cs │ │ ├── SymmetricEncDataPacket.cs │ │ ├── SymmetricEncIntegrityPacket.cs │ │ ├── SymmetricKeyAlgorithmTags.cs │ │ ├── SymmetricKeyEncSessionPacket.cs │ │ ├── TrustPacket.cs │ │ ├── UserAttributePacket.cs │ │ ├── UserAttributeSubpacket.cs │ │ ├── UserAttributeSubpacketTags.cs │ │ ├── UserAttributeSubpacketsReader.cs │ │ └── UserIdPacket.cs │ ├── Cms │ │ ├── BaseDigestCalculator.cs │ │ ├── CMSAttributeTableGenerationException.cs │ │ ├── CMSAttributeTableGenerator.cs │ │ ├── CMSAuthEnvelopedData.cs │ │ ├── CMSAuthEnvelopedGenerator.cs │ │ ├── CMSAuthenticatedData.cs │ │ ├── CMSAuthenticatedDataGenerator.cs │ │ ├── CMSAuthenticatedDataParser.cs │ │ ├── CMSAuthenticatedDataStreamGenerator.cs │ │ ├── CMSAuthenticatedGenerator.cs │ │ ├── CMSCompressedData.cs │ │ ├── CMSCompressedDataGenerator.cs │ │ ├── CMSCompressedDataParser.cs │ │ ├── CMSCompressedDataStreamGenerator.cs │ │ ├── CMSContentInfoParser.cs │ │ ├── CMSEnvelopedData.cs │ │ ├── CMSEnvelopedDataGenerator.cs │ │ ├── CMSEnvelopedDataParser.cs │ │ ├── CMSEnvelopedDataStreamGenerator.cs │ │ ├── CMSEnvelopedGenerator.cs │ │ ├── CMSEnvelopedHelper.cs │ │ ├── CMSException.cs │ │ ├── CMSPBEKey.cs │ │ ├── CMSProcessable.cs │ │ ├── CMSProcessableByteArray.cs │ │ ├── CMSProcessableFile.cs │ │ ├── CMSProcessableInputStream.cs │ │ ├── CMSReadable.cs │ │ ├── CMSSecureReadable.cs │ │ ├── CMSSignedData.cs │ │ ├── CMSSignedDataGenerator.cs │ │ ├── CMSSignedDataParser.cs │ │ ├── CMSSignedDataStreamGenerator.cs │ │ ├── CMSSignedGenerator.cs │ │ ├── CMSSignedHelper.cs │ │ ├── CMSStreamException.cs │ │ ├── CMSTypedStream.cs │ │ ├── CMSUtils.cs │ │ ├── CounterSignatureDigestCalculator.cs │ │ ├── DefaultAuthenticatedAttributeTableGenerator.cs │ │ ├── DefaultSignedAttributeTableGenerator.cs │ │ ├── DigOutputStream.cs │ │ ├── IDigestCalculator.cs │ │ ├── KEKRecipientInfoGenerator.cs │ │ ├── KEKRecipientInformation.cs │ │ ├── KeyAgreeRecipientInfoGenerator.cs │ │ ├── KeyAgreeRecipientInformation.cs │ │ ├── KeyTransRecipientInfoGenerator.cs │ │ ├── KeyTransRecipientInformation.cs │ │ ├── MacOutputStream.cs │ │ ├── NullOutputStream.cs │ │ ├── OriginatorId.cs │ │ ├── PKCS5Scheme2PBEKey.cs │ │ ├── PKCS5Scheme2UTF8PBEKey.cs │ │ ├── PasswordRecipientInfoGenerator.cs │ │ ├── PasswordRecipientInformation.cs │ │ ├── RecipientId.cs │ │ ├── RecipientInfoGenerator.cs │ │ ├── RecipientInformation.cs │ │ ├── RecipientInformationStore.cs │ │ ├── SigOutputStream.cs │ │ ├── SignerId.cs │ │ ├── SignerInfoGenerator.cs │ │ ├── SignerInformation.cs │ │ ├── SignerInformationStore.cs │ │ └── SimpleAttributeTableGenerator.cs │ ├── Crypto │ │ ├── Agreement │ │ │ ├── DHAgreement.cs │ │ │ ├── DHBasicAgreement.cs │ │ │ ├── ECDHBasicAgreement.cs │ │ │ ├── ECDHCBasicAgreement.cs │ │ │ ├── ECDHWithKdfBasicAgreement.cs │ │ │ ├── ECMqvBasicAgreement.cs │ │ │ ├── ECMqvWithKdfBasicAgreement.cs │ │ │ ├── Kdf │ │ │ │ ├── DHKdfParameters.cs │ │ │ │ ├── DHKekGenerator.cs │ │ │ │ └── ECDHKekGenerator.cs │ │ │ └── Srp │ │ │ │ ├── SRP6Client.cs │ │ │ │ ├── SRP6Server.cs │ │ │ │ ├── SRP6Utilities.cs │ │ │ │ └── SRP6VerifierGenerator.cs │ │ ├── AsymmetricCipherKeyPair.cs │ │ ├── AsymmetricKeyParameter.cs │ │ ├── BufferedAeadBlockCipher.cs │ │ ├── BufferedAsymmetricBlockCipher.cs │ │ ├── BufferedBlockCipher.cs │ │ ├── BufferedCipherBase.cs │ │ ├── BufferedIesCipher.cs │ │ ├── BufferedStreamCipher.cs │ │ ├── CipherKeyGenerator.cs │ │ ├── CryptoException.cs │ │ ├── DataLengthException.cs │ │ ├── Digests │ │ │ ├── GOST3411Digest.cs │ │ │ ├── GeneralDigest.cs │ │ │ ├── LongDigest.cs │ │ │ ├── MD2Digest.cs │ │ │ ├── MD4Digest.cs │ │ │ ├── MD5Digest.cs │ │ │ ├── NullDigest.cs │ │ │ ├── RipeMD128Digest.cs │ │ │ ├── RipeMD160Digest.cs │ │ │ ├── RipeMD256Digest.cs │ │ │ ├── RipeMD320Digest.cs │ │ │ ├── Sha1Digest.cs │ │ │ ├── Sha224Digest.cs │ │ │ ├── Sha256Digest.cs │ │ │ ├── Sha384Digest.cs │ │ │ ├── Sha512Digest.cs │ │ │ ├── ShortenedDigest.cs │ │ │ ├── TigerDigest.cs │ │ │ └── WhirlpoolDigest.cs │ │ ├── Encodings │ │ │ ├── ISO9796d1Encoding.cs │ │ │ ├── OaepEncoding.cs │ │ │ └── Pkcs1Encoding.cs │ │ ├── Engines │ │ │ ├── AesEngine.cs │ │ │ ├── AesFastEngine.cs │ │ │ ├── AesLightEngine.cs │ │ │ ├── AesWrapEngine.cs │ │ │ ├── BlowfishEngine.cs │ │ │ ├── CamelliaEngine.cs │ │ │ ├── CamelliaLightEngine.cs │ │ │ ├── CamelliaWrapEngine.cs │ │ │ ├── Cast5Engine.cs │ │ │ ├── Cast6Engine.cs │ │ │ ├── DesEdeEngine.cs │ │ │ ├── DesEdeWrapEngine.cs │ │ │ ├── DesEngine.cs │ │ │ ├── ElGamalEngine.cs │ │ │ ├── GOST28147Engine.cs │ │ │ ├── HC128Engine.cs │ │ │ ├── HC256Engine.cs │ │ │ ├── ISAACEngine.cs │ │ │ ├── IesEngine.cs │ │ │ ├── NaccacheSternEngine.cs │ │ │ ├── NoekeonEngine.cs │ │ │ ├── NullEngine.cs │ │ │ ├── RC2Engine.cs │ │ │ ├── RC2WrapEngine.cs │ │ │ ├── RC4Engine.cs │ │ │ ├── RC532Engine.cs │ │ │ ├── RC564Engine.cs │ │ │ ├── RC6Engine.cs │ │ │ ├── RFC3211WrapEngine.cs │ │ │ ├── RFC3394WrapEngine.cs │ │ │ ├── RSABlindedEngine.cs │ │ │ ├── RSABlindingEngine.cs │ │ │ ├── RSACoreEngine.cs │ │ │ ├── RijndaelEngine.cs │ │ │ ├── RsaEngine.cs │ │ │ ├── SEEDEngine.cs │ │ │ ├── SEEDWrapEngine.cs │ │ │ ├── Salsa20Engine.cs │ │ │ ├── SerpentEngine.cs │ │ │ ├── SkipjackEngine.cs │ │ │ ├── TEAEngine.cs │ │ │ ├── TwofishEngine.cs │ │ │ ├── VMPCEngine.cs │ │ │ ├── VMPCKSA3Engine.cs │ │ │ └── XTEAEngine.cs │ │ ├── Generators │ │ │ ├── BaseKdfBytesGenerator.cs │ │ │ ├── DHBasicKeyPairGenerator.cs │ │ │ ├── DHKeyGeneratorHelper.cs │ │ │ ├── DHKeyPairGenerator.cs │ │ │ ├── DHParametersGenerator.cs │ │ │ ├── DHParametersHelper.cs │ │ │ ├── DesEdeKeyGenerator.cs │ │ │ ├── DesKeyGenerator.cs │ │ │ ├── DsaKeyPairGenerator.cs │ │ │ ├── DsaParametersGenerator.cs │ │ │ ├── ECKeyPairGenerator.cs │ │ │ ├── ElGamalKeyPairGenerator.cs │ │ │ ├── ElGamalParametersGenerator.cs │ │ │ ├── GOST3410KeyPairGenerator.cs │ │ │ ├── GOST3410ParametersGenerator.cs │ │ │ ├── Kdf1BytesGenerator.cs │ │ │ ├── Kdf2BytesGenerator.cs │ │ │ ├── Mgf1BytesGenerator.cs │ │ │ ├── NaccacheSternKeyPairGenerator.cs │ │ │ ├── OpenSSLPBEParametersGenerator.cs │ │ │ ├── Pkcs12ParametersGenerator.cs │ │ │ ├── Pkcs5S1ParametersGenerator.cs │ │ │ ├── Pkcs5S2ParametersGenerator.cs │ │ │ ├── RSABlindingFactorGenerator.cs │ │ │ └── RsaKeyPairGenerator.cs │ │ ├── IAsymmetricBlockCipher.cs │ │ ├── IAsymmetricCipherKeyPairGenerator.cs │ │ ├── IBasicAgreement.cs │ │ ├── IBlockCipher.cs │ │ ├── IBufferedCipher.cs │ │ ├── ICipherParameters.cs │ │ ├── IDSA.cs │ │ ├── IDerivationFunction.cs │ │ ├── IDerivationParameters.cs │ │ ├── IDigest.cs │ │ ├── IMac.cs │ │ ├── IO │ │ │ ├── CipherStream.cs │ │ │ ├── DigestStream.cs │ │ │ ├── MacStream.cs │ │ │ └── SignerStream.cs │ │ ├── ISigner.cs │ │ ├── ISignerWithRecovery.cs │ │ ├── IStreamCipher.cs │ │ ├── IWrapper.cs │ │ ├── InvalidCipherTextException.cs │ │ ├── KeyGenerationParameters.cs │ │ ├── Macs │ │ │ ├── CMac.cs │ │ │ ├── CbcBlockCipherMac.cs │ │ │ ├── CfbBlockCipherMac.cs │ │ │ ├── GOST28147Mac.cs │ │ │ ├── HMac.cs │ │ │ ├── ISO9797Alg3Mac.cs │ │ │ └── VMPCMac.cs │ │ ├── MaxBytesExceededException.cs │ │ ├── Modes │ │ │ ├── CbcBlockCipher.cs │ │ │ ├── CcmBlockCipher.cs │ │ │ ├── CfbBlockCipher.cs │ │ │ ├── CtsBlockCipher.cs │ │ │ ├── EAXBlockCipher.cs │ │ │ ├── GCMBlockCipher.cs │ │ │ ├── GOFBBlockCipher.cs │ │ │ ├── Gcm │ │ │ │ ├── BasicGcmExponentiator.cs │ │ │ │ ├── BasicGcmMultiplier.cs │ │ │ │ ├── GcmUtilities.cs │ │ │ │ ├── IGcmExponentiator.cs │ │ │ │ ├── IGcmMultiplier.cs │ │ │ │ ├── Tables1kGcmExponentiator.cs │ │ │ │ ├── Tables64kGcmMultiplier.cs │ │ │ │ └── Tables8kGcmMultiplier.cs │ │ │ ├── IAeadBlockCipher.cs │ │ │ ├── OfbBlockCipher.cs │ │ │ ├── OpenPgpCfbBlockCipher.cs │ │ │ └── SicBlockCipher.cs │ │ ├── Paddings │ │ │ ├── BlockCipherPadding.cs │ │ │ ├── ISO10126d2Padding.cs │ │ │ ├── ISO7816d4Padding.cs │ │ │ ├── PaddedBufferedBlockCipher.cs │ │ │ ├── Pkcs7Padding.cs │ │ │ ├── TbcPadding.cs │ │ │ ├── X923Padding.cs │ │ │ └── ZeroBytePadding.cs │ │ ├── Parameters │ │ │ ├── AEADParameters.cs │ │ │ ├── CcmParameters.cs │ │ │ ├── DHKeyGenerationParameters.cs │ │ │ ├── DHKeyParameters.cs │ │ │ ├── DHParameters.cs │ │ │ ├── DHPrivateKeyParameters.cs │ │ │ ├── DHPublicKeyParameters.cs │ │ │ ├── DHValidationParameters.cs │ │ │ ├── DesEdeParameters.cs │ │ │ ├── DesParameters.cs │ │ │ ├── DsaKeyGenerationParameters.cs │ │ │ ├── DsaKeyParameters.cs │ │ │ ├── DsaParameters.cs │ │ │ ├── DsaPrivateKeyParameters.cs │ │ │ ├── DsaPublicKeyParameters.cs │ │ │ ├── DsaValidationParameters.cs │ │ │ ├── ECDomainParameters.cs │ │ │ ├── ECKeyGenerationParameters.cs │ │ │ ├── ECKeyParameters.cs │ │ │ ├── ECPrivateKeyParameters.cs │ │ │ ├── ECPublicKeyParameters.cs │ │ │ ├── ElGamalKeyGenerationParameters.cs │ │ │ ├── ElGamalKeyParameters.cs │ │ │ ├── ElGamalParameters.cs │ │ │ ├── ElGamalPrivateKeyParameters.cs │ │ │ ├── ElGamalPublicKeyParameters.cs │ │ │ ├── GOST3410KeyGenerationParameters.cs │ │ │ ├── GOST3410KeyParameters.cs │ │ │ ├── GOST3410Parameters.cs │ │ │ ├── GOST3410PrivateKeyParameters.cs │ │ │ ├── GOST3410PublicKeyParameters.cs │ │ │ ├── GOST3410ValidationParameters.cs │ │ │ ├── ISO18033KDFParameters.cs │ │ │ ├── IesParameters.cs │ │ │ ├── IesWithCipherParameters.cs │ │ │ ├── KdfParameters.cs │ │ │ ├── KeyParameter.cs │ │ │ ├── MgfParameters.cs │ │ │ ├── MqvPrivateParameters.cs │ │ │ ├── MqvPublicParameters.cs │ │ │ ├── NaccacheSternKeyGenerationParameters.cs │ │ │ ├── NaccacheSternKeyParameters.cs │ │ │ ├── NaccacheSternPrivateKeyParameters.cs │ │ │ ├── ParametersWithIV.cs │ │ │ ├── ParametersWithRandom.cs │ │ │ ├── ParametersWithSBox.cs │ │ │ ├── ParametersWithSalt.cs │ │ │ ├── RC2Parameters.cs │ │ │ ├── RC5Parameters.cs │ │ │ ├── RSABlindingParameters.cs │ │ │ ├── RsaKeyGenerationParameters.cs │ │ │ ├── RsaKeyParameters.cs │ │ │ └── RsaPrivateCrtKeyParameters.cs │ │ ├── PbeParametersGenerator.cs │ │ ├── Prng │ │ │ ├── CryptoApiRandomGenerator.cs │ │ │ ├── DigestRandomGenerator.cs │ │ │ ├── IRandomGenerator.cs │ │ │ ├── ReversedWindowGenerator.cs │ │ │ ├── ThreadedSeedGenerator.cs │ │ │ └── VMPCRandomGenerator.cs │ │ ├── Signers │ │ │ ├── DsaDigestSigner.cs │ │ │ ├── DsaSigner.cs │ │ │ ├── ECDsaSigner.cs │ │ │ ├── ECGOST3410Signer.cs │ │ │ ├── ECNRSigner.cs │ │ │ ├── GOST3410DigestSigner.cs │ │ │ ├── GOST3410Signer.cs │ │ │ ├── GenericSigner.cs │ │ │ ├── Iso9796d2PssSigner.cs │ │ │ ├── Iso9796d2Signer.cs │ │ │ ├── PssSigner.cs │ │ │ └── RsaDigestSigner.cs │ │ ├── StreamBlockCipher.cs │ │ ├── Tls │ │ │ ├── AlertDescription.cs │ │ │ ├── AlertLevel.cs │ │ │ ├── AlwaysValidVerifyer.cs │ │ │ ├── ByteQueue.cs │ │ │ ├── Certificate.cs │ │ │ ├── CertificateRequest.cs │ │ │ ├── CipherSuite.cs │ │ │ ├── ClientCertificateType.cs │ │ │ ├── CombinedHash.cs │ │ │ ├── CompressionMethod.cs │ │ │ ├── ContentType.cs │ │ │ ├── DefaultTlsAgreementCredentials.cs │ │ │ ├── DefaultTlsCipherFactory.cs │ │ │ ├── DefaultTlsClient.cs │ │ │ ├── DefaultTlsSignerCredentials.cs │ │ │ ├── DigestAlgorithm.cs │ │ │ ├── ECCurveType.cs │ │ │ ├── ECPointFormat.cs │ │ │ ├── EncryptionAlgorithm.cs │ │ │ ├── ExtensionType.cs │ │ │ ├── HandshakeType.cs │ │ │ ├── ICertificateVerifyer.cs │ │ │ ├── KeyExchangeAlgorithm.cs │ │ │ ├── LegacyTlsAuthentication.cs │ │ │ ├── LegacyTlsClient.cs │ │ │ ├── NamedCurve.cs │ │ │ ├── RecordStream.cs │ │ │ ├── SecurityParameters.cs │ │ │ ├── SrpTlsClient.cs │ │ │ ├── TlsAgreementCredentials.cs │ │ │ ├── TlsAuthentication.cs │ │ │ ├── TlsBlockCipher.cs │ │ │ ├── TlsCipher.cs │ │ │ ├── TlsCipherFactory.cs │ │ │ ├── TlsClient.cs │ │ │ ├── TlsClientContext.cs │ │ │ ├── TlsClientContextImpl.cs │ │ │ ├── TlsCompression.cs │ │ │ ├── TlsCredentials.cs │ │ │ ├── TlsDHKeyExchange.cs │ │ │ ├── TlsDeflateCompression.cs │ │ │ ├── TlsDheKeyExchange.cs │ │ │ ├── TlsDsaSigner.cs │ │ │ ├── TlsDssSigner.cs │ │ │ ├── TlsECDHKeyExchange.cs │ │ │ ├── TlsECDheKeyExchange.cs │ │ │ ├── TlsECDsaSigner.cs │ │ │ ├── TlsException.cs │ │ │ ├── TlsFatalAlert.cs │ │ │ ├── TlsKeyExchange.cs │ │ │ ├── TlsMac.cs │ │ │ ├── TlsNullCipher.cs │ │ │ ├── TlsNullCompression.cs │ │ │ ├── TlsProtocolHandler.cs │ │ │ ├── TlsRsaKeyExchange.cs │ │ │ ├── TlsRsaSigner.cs │ │ │ ├── TlsSigner.cs │ │ │ ├── TlsSignerCredentials.cs │ │ │ ├── TlsSrpKeyExchange.cs │ │ │ ├── TlsStream.cs │ │ │ └── TlsUtilities.cs │ │ └── Utilities │ │ │ └── Pack.cs │ ├── IO │ │ ├── Enums.cs │ │ ├── FileStream.cs │ │ ├── FileStreamBase.cs │ │ ├── IFileInfo.cs │ │ └── Net45FileInfo.cs │ ├── Math │ │ └── EC │ │ │ ├── Abc │ │ │ ├── SimpleBigDecimal.cs │ │ │ ├── Tnaf.cs │ │ │ └── ZTauElement.cs │ │ │ ├── ECAlgorithms.cs │ │ │ ├── ECCurve.cs │ │ │ ├── ECFieldElement.cs │ │ │ ├── ECPoint.cs │ │ │ ├── IntArray.cs │ │ │ └── Multiplier │ │ │ ├── ECMultiplier.cs │ │ │ ├── FpNafMultiplier.cs │ │ │ ├── PreCompInfo.cs │ │ │ ├── ReferenceMultiplier.cs │ │ │ ├── WNafMultiplier.cs │ │ │ ├── WNafPreCompInfo.cs │ │ │ ├── WTauNafMultiplier.cs │ │ │ └── WTauNafPreCompInfo.cs │ ├── Ocsp │ │ ├── BasicOCSPResp.cs │ │ ├── BasicOCSPRespGenerator.cs │ │ ├── CertificateID.cs │ │ ├── CertificateStatus.cs │ │ ├── OCSPException.cs │ │ ├── OCSPReq.cs │ │ ├── OCSPReqGenerator.cs │ │ ├── OCSPResp.cs │ │ ├── OCSPRespGenerator.cs │ │ ├── OCSPRespStatus.cs │ │ ├── OCSPUtil.cs │ │ ├── Req.cs │ │ ├── RespData.cs │ │ ├── RespID.cs │ │ ├── RevokedStatus.cs │ │ ├── SingleResp.cs │ │ └── UnknownStatus.cs │ ├── OpenSsl │ │ ├── EncryptionException.cs │ │ ├── IPasswordFinder.cs │ │ ├── MiscPemGenerator.cs │ │ ├── PEMException.cs │ │ ├── PEMReader.cs │ │ ├── PEMUtilities.cs │ │ ├── PEMWriter.cs │ │ ├── PasswordException.cs │ │ └── Pkcs8Generator.cs │ ├── Pkcs │ │ ├── AsymmetricKeyEntry.cs │ │ ├── EncryptedPrivateKeyInfoFactory.cs │ │ ├── PKCS12StoreBuilder.cs │ │ ├── Pkcs10CertificationRequest.cs │ │ ├── Pkcs10CertificationRequestDelaySigned.cs │ │ ├── Pkcs12Entry.cs │ │ ├── Pkcs12Store.cs │ │ ├── Pkcs12Utilities.cs │ │ ├── PrivateKeyInfoFactory.cs │ │ └── X509CertificateEntry.cs │ ├── Pkix │ │ ├── CertStatus.cs │ │ ├── PkixAttrCertChecker.cs │ │ ├── PkixAttrCertPathBuilder.cs │ │ ├── PkixAttrCertPathValidator.cs │ │ ├── PkixBuilderParameters.cs │ │ ├── PkixCertPath.cs │ │ ├── PkixCertPathBuilder.cs │ │ ├── PkixCertPathBuilderException.cs │ │ ├── PkixCertPathBuilderResult.cs │ │ ├── PkixCertPathChecker.cs │ │ ├── PkixCertPathValidator.cs │ │ ├── PkixCertPathValidatorException.cs │ │ ├── PkixCertPathValidatorResult.cs │ │ ├── PkixCertPathValidatorUtilities.cs │ │ ├── PkixCrlUtilities.cs │ │ ├── PkixNameConstraintValidator.cs │ │ ├── PkixNameConstraintValidatorException.cs │ │ ├── PkixParameters.cs │ │ ├── PkixPolicyNode.cs │ │ ├── ReasonsMask.cs │ │ ├── Rfc3280CertPathUtilities.cs │ │ ├── Rfc3281CertPathUtilities.cs │ │ └── TrustAnchor.cs │ ├── Security │ │ ├── AgreementUtilities.cs │ │ ├── Certificates │ │ │ ├── CertificateEncodingException.cs │ │ │ ├── CertificateException.cs │ │ │ ├── CertificateExpiredException.cs │ │ │ ├── CertificateNotYetValidException.cs │ │ │ ├── CertificateParsingException.cs │ │ │ └── CrlException.cs │ │ ├── CipherUtilities.cs │ │ ├── Cryptography │ │ │ ├── Net45RNGCryptoServiceProvider.cs │ │ │ └── RNGCryptoServiceProviderBase.cs │ │ ├── DigestUtilities.cs │ │ ├── DotNetUtilities.cs │ │ ├── GeneralSecurityException.cs │ │ ├── GeneratorUtilities.cs │ │ ├── InvalidKeyException.cs │ │ ├── InvalidParameterException.cs │ │ ├── KeyException.cs │ │ ├── MacUtilities.cs │ │ ├── NoSuchAlgorithmException.cs │ │ ├── ParameterUtilities.cs │ │ ├── PbeUtilities.cs │ │ ├── PrivateKeyFactory.cs │ │ ├── PublicKeyFactory.cs │ │ ├── SecureRandom.cs │ │ ├── SecurityUtilityException.cs │ │ ├── SignatureException.cs │ │ ├── SignerUtilities.cs │ │ └── WrapperUtilities.cs │ ├── Tsp │ │ ├── GenTimeAccuracy.cs │ │ ├── TSPAlgorithms.cs │ │ ├── TSPException.cs │ │ ├── TSPUtil.cs │ │ ├── TSPValidationException.cs │ │ ├── TimeStampRequest.cs │ │ ├── TimeStampRequestGenerator.cs │ │ ├── TimeStampResponse.cs │ │ ├── TimeStampResponseGenerator.cs │ │ ├── TimeStampToken.cs │ │ ├── TimeStampTokenGenerator.cs │ │ └── TimeStampTokenInfo.cs │ ├── Utilities │ │ ├── Arrays.cs │ │ ├── BigIntegers.cs │ │ ├── Collections │ │ │ ├── CollectionUtilities.cs │ │ │ ├── EmptyEnumerable.cs │ │ │ ├── EnumerableProxy.cs │ │ │ ├── HashSet.cs │ │ │ ├── ISet.cs │ │ │ ├── LinkedDictionary.cs │ │ │ ├── UnmodifiableDictionary.cs │ │ │ ├── UnmodifiableDictionaryProxy.cs │ │ │ ├── UnmodifiableList.cs │ │ │ ├── UnmodifiableListProxy.cs │ │ │ ├── UnmodifiableSet.cs │ │ │ └── UnmodifiableSetProxy.cs │ │ ├── Date │ │ │ ├── DateTimeObject.cs │ │ │ └── DateTimeUtilities.cs │ │ ├── Encoders │ │ │ ├── Base64.cs │ │ │ ├── Base64Encoder.cs │ │ │ ├── BufferedDecoder.cs │ │ │ ├── BufferedEncoder.cs │ │ │ ├── Hex.cs │ │ │ ├── HexEncoder.cs │ │ │ ├── HexTranslator.cs │ │ │ ├── IEncoder.cs │ │ │ ├── Translator.cs │ │ │ ├── UrlBase64.cs │ │ │ └── UrlBase64Encoder.cs │ │ ├── Enums.cs │ │ ├── IO │ │ │ ├── BaseInputStream.cs │ │ │ ├── BaseOutputStream.cs │ │ │ ├── Pem │ │ │ │ ├── PemGenerationException.cs │ │ │ │ ├── PemHeader.cs │ │ │ │ ├── PemObject.cs │ │ │ │ ├── PemObjectGenerator.cs │ │ │ │ ├── PemObjectParser.cs │ │ │ │ ├── PemReader.cs │ │ │ │ └── PemWriter.cs │ │ │ ├── PushbackStream.cs │ │ │ ├── StreamOverflowException.cs │ │ │ ├── Streams.cs │ │ │ ├── TeeInputStream.cs │ │ │ └── TeeOutputStream.cs │ │ ├── Net │ │ │ └── IPAddress.cs │ │ ├── Platform.cs │ │ ├── Strings.cs │ │ └── Zlib │ │ │ ├── Adler32.cs │ │ │ ├── Deflate.cs │ │ │ ├── InfBlocks.cs │ │ │ ├── InfCodes.cs │ │ │ ├── InfTree.cs │ │ │ ├── Inflate.cs │ │ │ ├── JZlib.cs │ │ │ ├── StaticTree.cs │ │ │ ├── Tree.cs │ │ │ ├── ZInputStream.cs │ │ │ ├── ZOutputStream.cs │ │ │ └── ZStream.cs │ └── X509 │ │ ├── AttributeCertificateHolder.cs │ │ ├── AttributeCertificateIssuer.cs │ │ ├── Extension │ │ ├── AuthorityKeyIdentifierStructure.cs │ │ ├── SubjectKeyIdentifierStructure.cs │ │ └── X509ExtensionUtil.cs │ │ ├── IX509AttributeCertificate.cs │ │ ├── IX509Extension.cs │ │ ├── PEMParser.cs │ │ ├── PrincipalUtil.cs │ │ ├── Store │ │ ├── IX509Selector.cs │ │ ├── IX509Store.cs │ │ ├── IX509StoreParameters.cs │ │ ├── NoSuchStoreException.cs │ │ ├── X509AttrCertStoreSelector.cs │ │ ├── X509CertPairStoreSelector.cs │ │ ├── X509CertStoreSelector.cs │ │ ├── X509CollectionStore.cs │ │ ├── X509CollectionStoreParameters.cs │ │ ├── X509CrlStoreSelector.cs │ │ ├── X509StoreException.cs │ │ └── X509StoreFactory.cs │ │ ├── SubjectPublicKeyInfoFactory.cs │ │ ├── X509AttrCertParser.cs │ │ ├── X509Attribute.cs │ │ ├── X509CertPairParser.cs │ │ ├── X509Certificate.cs │ │ ├── X509CertificatePair.cs │ │ ├── X509CertificateParser.cs │ │ ├── X509Crl.cs │ │ ├── X509CrlEntry.cs │ │ ├── X509CrlParser.cs │ │ ├── X509ExtensionBase.cs │ │ ├── X509KeyUsage.cs │ │ ├── X509SignatureUtil.cs │ │ ├── X509Utilities.cs │ │ ├── X509V1CertificateGenerator.cs │ │ ├── X509V2AttributeCertificate.cs │ │ ├── X509V2AttributeCertificateGenerator.cs │ │ ├── X509V2CRLGenerator.cs │ │ └── X509V3CertificateGenerator.cs ├── ResX │ ├── AppResources.Designer.cs │ ├── AppResources.ca.resx │ ├── AppResources.cs.resx │ ├── AppResources.da.resx │ ├── AppResources.de-CH.resx │ ├── AppResources.de.resx │ ├── AppResources.es.resx │ ├── AppResources.hu.resx │ ├── AppResources.id.resx │ ├── AppResources.in.resx │ ├── AppResources.it.resx │ ├── AppResources.lt.resx │ ├── AppResources.nl.resx │ ├── AppResources.no.resx │ ├── AppResources.pl.resx │ ├── AppResources.pt-BR.resx │ ├── AppResources.resx │ ├── AppResources.ru.resx │ ├── AppResources.sk.resx │ └── AppResources.tr.resx ├── SharpMTProto │ ├── Annotations.cs │ ├── Authentication │ │ ├── AuthInfo.cs │ │ ├── AuthKeyNegotiator.cs │ │ ├── KeyChain.cs │ │ └── PublicKey.cs │ ├── ConnectionConfig.cs │ ├── Defaults.cs │ ├── ErrorCode.cs │ ├── Exceptions.cs │ ├── IMTProtoClientConnection.cs │ ├── IRemoteProcedureCaller.cs │ ├── MTProtoClient.cs │ ├── MTProtoClientBuilder.cs │ ├── MTProtoClientConnection.cs │ ├── Messaging │ │ ├── Handlers │ │ │ ├── BadMsgNotificationHandler.cs │ │ │ ├── GenericRequestResponseHandler.cs │ │ │ ├── GzipPackedHandler.cs │ │ │ ├── IResponseHandler.cs │ │ │ ├── MessageContainerHandler.cs │ │ │ ├── PongHandler.cs │ │ │ ├── ResponseDispatcher.cs │ │ │ ├── ResponseHandler.cs │ │ │ ├── RpcResultHandler.cs │ │ │ ├── SessionHandler.cs │ │ │ └── UpdatesHandler.cs │ │ ├── MessageCodec.cs │ │ ├── MessageSendingFlags.cs │ │ ├── MessageSerializer.cs │ │ ├── Request.cs │ │ ├── RequestsManager.cs │ │ └── Sender.cs │ ├── Schema │ │ ├── SharpMTProto.Schema.Ex.cs │ │ ├── SharpMTProto.Schema.MethodsImpl.Ex.cs │ │ ├── SharpMTProto.Schema.MethodsImpl.cs │ │ └── SharpMTProto.Schema.cs │ ├── Services │ │ ├── EncryptionServices.PCL.cs │ │ ├── EncryptionServices.cs │ │ ├── HashServices.cs │ │ ├── IEncryptionServices.cs │ │ ├── IHashServices.cs │ │ ├── MessageIdGenerator.cs │ │ ├── NonceGenerator.cs │ │ └── RandomGenerator.cs │ ├── Transport │ │ ├── ClientTransportFactory.cs │ │ ├── IClientTransport.cs │ │ ├── IClientTransportConfig.cs │ │ ├── IClientTransportFactory.cs │ │ ├── TcpClientTransport.cs │ │ ├── TcpClientTransportConfig.cs │ │ └── TcpTransportPacket.cs │ └── Utils │ │ ├── SocketAwaitable.cs │ │ ├── SocketExtensions.cs │ │ └── UnixTimeUtils.cs ├── SharpTL │ ├── Exceptions.cs │ ├── GlobalSuppressions.cs │ ├── ITLSerializer.cs │ ├── ITLVectorSerializer.cs │ ├── Properties │ │ └── Annotations.cs │ ├── Serializers │ │ ├── BooleanSerializer.cs │ │ ├── BuiltIn.cs │ │ ├── DoubleSerializer.cs │ │ ├── Int128Serializer.cs │ │ ├── Int256Serializer.cs │ │ ├── IntSerializer.cs │ │ ├── LongSerializer.cs │ │ ├── StringSerializer.cs │ │ ├── TLBytesSerializer.cs │ │ ├── TLCustomObjectSerializer.cs │ │ ├── TLMultiConstructorObjectSerializer.cs │ │ ├── TLSerializer.cs │ │ ├── TLSerializerBase.cs │ │ ├── TLVectorSerializer.cs │ │ ├── UIntSerializer.cs │ │ └── ULongSerializer.cs │ ├── TLCrcStreamer.cs │ ├── TLObjectAttribute.cs │ ├── TLObjectWithCustomSerializerAttribute.cs │ ├── TLPropertyAttribute.cs │ ├── TLPropertyInfo.cs │ ├── TLRig.cs │ ├── TLSerializationContext.cs │ ├── TLSerializationMode.cs │ ├── TLSerializersBucket.cs │ ├── TLStreamer.cs │ ├── TLTypeAttribute.cs │ └── TLVectorAttribute.cs ├── SharpTelegram │ ├── Schema │ │ ├── SharpTelegram.Schema.MethodsImpl.Ex.cs │ │ ├── SharpTelegram.Schema.MethodsImpl.cs │ │ └── SharpTelegram.Schema.cs │ ├── TelegramAppInfo.cs │ └── TelegramClient.cs ├── SyncAgent.cs ├── SyncComparer.cs ├── Telegram.cs ├── TelegramMutableSettings.cs ├── TelegramSettings.cs ├── TelegramUtils.cs ├── TestCommands.cs ├── ThumbnailDownloader.cs └── UI │ ├── Bots.cs │ ├── Mentions.cs │ ├── NewChannel.cs │ ├── NewMessage.cs │ ├── PartyBlockedParticipants.cs │ ├── PartyOptions.cs │ ├── PartyOptionsSettings.cs │ └── UserInformation.cs ├── Disa.Framework.Telegram ├── Disa.Framework.Telegram.csproj ├── References │ ├── System.Reactive.Core.dll │ ├── System.Reactive.Interfaces.dll │ └── System.Reactive.Linq.dll └── packages.config ├── Disa.Framework ├── Disa.Framework.csproj ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── Disa.Terminal ├── Disa.Terminal.csproj ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── WindowsUnix.cs └── packages.config ├── DisaOpenSource.sln ├── Examples └── TheMostBasicPlugin │ └── WackyMessenger.cs ├── README.md ├── References ├── AndroidLib.dll └── TimSort.dll └── Tooling ├── .gitattributes ├── .gitignore └── Sharp.TL.Compiler ├── CommonAssemblyInfo.cs ├── SharpTL.Compiler.CLI.NET45 ├── App.config ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ └── DefaultBrowserUsageTemplate.html ├── SharpTL.Compiler.CLI.NET45.csproj └── packages.config ├── SharpTL.Compiler.NET45 ├── CompilationParams.cs ├── Properties │ ├── Annotations.cs │ └── AssemblyInfo.cs ├── SchemaMethodsImplTemplate.cs ├── SchemaMethodsImplTemplate.tt ├── SharpTL.Compiler.NET45.csproj ├── SharpTLDefaultTemplate.cs ├── SharpTLDefaultTemplate.tt ├── TLCombinator.cs ├── TLCombinatorParameter.cs ├── TLSchema.Json.cs ├── TLSchema.TL.cs ├── TLSchema.cs ├── TLSchemaSourceType.cs ├── TLType.cs ├── TLTypesBox.cs ├── TemplateVars.cs ├── TemplatesParts.cs ├── Utils │ └── StringUtils.cs ├── VoidTLType.cs └── packages.config ├── SharpTL.Compiler.Tests ├── Properties │ └── AssemblyInfo.cs ├── SharpTL.Compiler.Tests.csproj ├── StringUtilsFacts.cs ├── TL-schemas │ ├── Test.tl │ ├── TestTLSchema.json │ └── mtproto.json ├── TLShemaCompilerFacts.cs └── packages.config ├── SharpTL.Compiler.sln └── SharpTL.Compiler.sln.DotSettings /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /ConversationExport/ConversationExport.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Disa-im/DisaOpenSource/d0b2c6db5b2aa8c95377533dc6c4e54073460bb0/ConversationExport/ConversationExport.zip -------------------------------------------------------------------------------- /ConversationExport/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Disa-im/DisaOpenSource/d0b2c6db5b2aa8c95377533dc6c4e54073460bb0/ConversationExport/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /ConversationExport/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Disa-im/DisaOpenSource/d0b2c6db5b2aa8c95377533dc6c4e54073460bb0/ConversationExport/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /ConversationExport/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Disa-im/DisaOpenSource/d0b2c6db5b2aa8c95377533dc6c4e54073460bb0/ConversationExport/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /ConversationExport/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Disa-im/DisaOpenSource/d0b2c6db5b2aa8c95377533dc6c4e54073460bb0/ConversationExport/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /ConversationExport/img/ic_broken_image_black_48dp_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Disa-im/DisaOpenSource/d0b2c6db5b2aa8c95377533dc6c4e54073460bb0/ConversationExport/img/ic_broken_image_black_48dp_2x.png -------------------------------------------------------------------------------- /ConversationExport/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /ConversationExport/js/plugins.js: -------------------------------------------------------------------------------- 1 | // Avoid `console` errors in browsers that lack a console. 2 | (function() { 3 | var method; 4 | var noop = function () {}; 5 | var methods = [ 6 | 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 7 | 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 8 | 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 9 | 'timeline', 'timelineEnd', 'timeStamp', 'trace', 'warn' 10 | ]; 11 | var length = methods.length; 12 | var console = (window.console = window.console || {}); 13 | 14 | while (length--) { 15 | method = methods[length]; 16 | 17 | // Only stub undefined methods. 18 | if (!console[method]) { 19 | console[method] = noop; 20 | } 21 | } 22 | }()); 23 | 24 | // Place any jQuery/helper plugins in here. 25 | -------------------------------------------------------------------------------- /Disa.Framework.Mobile.Shared/EmailEntry.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms; 2 | 3 | namespace Disa.Framework.Mobile 4 | { 5 | public class EmailEntry : Entry {} 6 | } 7 | 8 | -------------------------------------------------------------------------------- /Disa.Framework.Mobile.Shared/IPluginDescription.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework.Mobile 4 | { 5 | public interface IPluginDescription where T : Service 6 | { 7 | string FetchDescription(T service); 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /Disa.Framework.Mobile.Shared/IPluginPage.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms; 2 | 3 | namespace Disa.Framework.Mobile 4 | { 5 | public interface IPluginPage 6 | { 7 | Page Fetch(Service service); 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /Disa.Framework.Mobile.Shared/IPluginPageControls.cs: -------------------------------------------------------------------------------- 1 | namespace Disa.Framework.Mobile 2 | { 3 | public interface IPluginPageControls 4 | { 5 | void Finish(); 6 | 7 | void LaunchWebBrowser(string url); 8 | 9 | bool BackPressEnabled { get; set; } 10 | 11 | void LaunchPrivacyList(); 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /Disa.Framework.Mobile.Shared/PhoneEntry.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms; 2 | 3 | namespace Disa.Framework.Mobile 4 | { 5 | public class PhoneEntry : Entry {} 6 | } 7 | 8 | -------------------------------------------------------------------------------- /Disa.Framework.Mobile/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/AxolotlImplementation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework 4 | { 5 | public class AxolotlImplementation 6 | { 7 | public Func InstantianteAxolotl { internal get; set; } 8 | public Axolotl.IAxolotlStatic AxolotlStatic { internal get; set; } 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bots/BotCommand.cs: -------------------------------------------------------------------------------- 1 | using ProtoBuf; 2 | using System; 3 | namespace Disa.Framework.Bots 4 | { 5 | [Serializable] 6 | [ProtoContract] 7 | public class BotCommand 8 | { 9 | [ProtoMember(1)] 10 | public string Command { get; set; } 11 | 12 | [ProtoMember(2)] 13 | public string Description { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bots/BotInfo.cs: -------------------------------------------------------------------------------- 1 | using ProtoBuf; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace Disa.Framework.Bots 6 | { 7 | [Serializable] 8 | [ProtoContract] 9 | public class BotInfo 10 | { 11 | [ProtoMember(1)] 12 | public string Address { get; set; } 13 | 14 | [ProtoMember(2)] 15 | public string Description { get; set; } 16 | 17 | [ProtoMember(3)] 18 | public List Commands { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bots/BotResults.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Disa.Framework.Bots 4 | { 5 | public class BotResults 6 | { 7 | public bool Gallery { get; set; } 8 | public int QueryId { get; set; } 9 | public string NextOffset { get; set; } 10 | public InlineBotSwitchPM SwitchPm { get; set; } 11 | public List Results { get; set; } 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bots/Document.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Disa.Framework.Bots 6 | { 7 | public abstract class DocumentBase 8 | { 9 | public UInt64 Id { get; set; } 10 | } 11 | 12 | public class DocumentEmpty : DocumentBase 13 | { 14 | } 15 | 16 | public class Document : DocumentBase 17 | { 18 | public UInt64 AccessHash { get; set; } 19 | 20 | public UInt32 Date { get; set; } 21 | 22 | public string MimeType { get; set; } 23 | 24 | public UInt32 Size { get; set; } 25 | 26 | public PhotoSize Thumb { get; set; } 27 | 28 | public byte[] AdditionalData { get; set; } 29 | 30 | public List Attributes { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bots/FileLocation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Disa.Framework.Bots 6 | { 7 | public class FileLocation 8 | { 9 | public bool IsUnavailable { get; set; } 10 | public byte[] AdditionalData { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bots/GeoPoint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Disa.Framework.Bots 6 | { 7 | /// 8 | /// This object represents a point on the map. 9 | /// 10 | public class GeoPoint 11 | { 12 | /// 13 | /// Is this an empty map point? 14 | /// 15 | public bool IsEmpty { get; set; } 16 | 17 | /// 18 | /// Longitude as defined by sender. 19 | /// 20 | public double Long { get; set; } 21 | 22 | /// 23 | /// Latitude as defined by sender. 24 | /// 25 | public double Lat { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bots/InputBotInlineMessageID.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Disa.Framework.Bots 6 | { 7 | public class InputBotInlineMessageID 8 | { 9 | public string Id { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bots/InputStickerSet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Disa.Framework.Bots 6 | { 7 | public abstract class InputStickerSetBase 8 | { 9 | } 10 | 11 | public class InputStickerSetEmpty : InputStickerSetBase 12 | { 13 | } 14 | 15 | public class InputStickerSetID : InputStickerSetBase 16 | { 17 | public UInt64 Id { get; set; } 18 | 19 | public UInt64 AccessHash { get; set; } 20 | } 21 | 22 | public class InputStickerSetShortName : InputStickerSetBase 23 | { 24 | public string ShortName { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bots/KeyboardButtonRow.cs: -------------------------------------------------------------------------------- 1 | using ProtoBuf; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace Disa.Framework.Bots 6 | { 7 | [Serializable] 8 | [ProtoContract] 9 | public class KeyboardButtonRow 10 | { 11 | [ProtoMember(1)] 12 | public List Buttons {get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bots/MessagesBotCallbackAnswer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Disa.Framework.Bots 6 | { 7 | public class MessagesBotCallbackAnswer 8 | { 9 | public bool Alert { get; set; } 10 | 11 | public string Message { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bots/Photo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Disa.Framework.Bots 6 | { 7 | public class Photo 8 | { 9 | public System.UInt64 Id { get; set; } 10 | 11 | public System.UInt64 AccessHash { get; set; } 12 | 13 | public System.UInt32 Date { get; set; } 14 | 15 | public List Sizes { get; set; } 16 | 17 | public byte[] AdditionalData { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bots/PhotoSize.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Disa.Framework.Bots 6 | { 7 | public class PhotoSize 8 | { 9 | public string Type { get; set; } 10 | 11 | public FileLocation Location { get; set; } 12 | 13 | public UInt32 W { get; set; } 14 | 15 | public UInt32 H { get; set; } 16 | 17 | public int Size { get; set; } 18 | } 19 | 20 | public class PhotoCachedSize : PhotoSize 21 | { 22 | public Byte[] Bytes { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/BubbleGroupCache.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using SQLite; 3 | using ProtoBuf; 4 | using System; 5 | 6 | namespace Disa.Framework 7 | { 8 | [Serializable] 9 | [ProtoContract] 10 | public class BubbleGroupCache 11 | { 12 | [ProtoMember(1)] 13 | public string Name { get; set; } 14 | [ProtoMember(2)] 15 | public DisaThumbnail Photo { get; set; } 16 | [ProtoMember(3)] 17 | public List Participants { get; set; } 18 | [ProtoMember(4)] 19 | public string Guid { get; set; } 20 | [ProtoMember(5)] 21 | public bool InputDisabled { get; set; } 22 | [ProtoMember(6)] 23 | public List Mentions { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/BubbleTransfer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Disa.Framework 5 | { 6 | public abstract class BubbleTransfer 7 | { 8 | public Action Progress; 9 | public abstract Task Start(); 10 | } 11 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bubbles/AbstractBubble.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ProtoBuf; 3 | 4 | namespace Disa.Framework.Bubbles 5 | { 6 | [Serializable] 7 | [ProtoContract] 8 | [ProtoInclude(200, typeof(PresenceBubble))] 9 | [ProtoInclude(201, typeof(DeliveredBubble))] 10 | [ProtoInclude(202, typeof(SubscribeBubble))] 11 | [ProtoInclude(203, typeof(TypingBubble))] 12 | [ProtoInclude(204, typeof(ReadBubble))] 13 | [ProtoInclude(205, typeof(DeliveredBubbleReceipt))] 14 | public abstract class AbstractBubble : Bubble 15 | { 16 | protected AbstractBubble(long time, BubbleDirection direction, Service service) : base(time, direction, service) 17 | { 18 | 19 | } 20 | 21 | protected AbstractBubble() 22 | { 23 | 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bubbles/ComposeBubble.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ProtoBuf; 3 | 4 | namespace Disa.Framework.Bubbles 5 | { 6 | [Serializable] 7 | [ProtoContract] 8 | public class ComposeBubble : AbstractBubble 9 | { 10 | [NonSerialized] 11 | public readonly VisualBubble BubbleToSend; 12 | [NonSerialized] 13 | public readonly Contact.ID[] Ids; 14 | 15 | public ComposeBubble(long time, BubbleDirection direction, Service service, 16 | VisualBubble bubbleToSend, Contact.ID[] ids) 17 | : base(time, direction, service) 18 | { 19 | Ids = ids; 20 | BubbleToSend = bubbleToSend; 21 | } 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bubbles/ContactBubble.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ProtoBuf; 3 | 4 | namespace Disa.Framework.Bubbles 5 | { 6 | [Serializable] 7 | [ProtoContract] 8 | public class ContactBubble : VisualBubble 9 | { 10 | [ProtoMember(1)] 11 | public string Name {get; set;} 12 | 13 | [ProtoMember(2)] 14 | public byte[] VCardData {get; set;} 15 | 16 | public ContactBubble(long time, BubbleDirection direction, string address, 17 | string participantAddress, bool party, Service service, string name, byte[] vCardData, string idService = null) : 18 | base(time, direction, address, participantAddress, party, service, null, idService) 19 | { 20 | Name = name; 21 | VCardData = vCardData; 22 | } 23 | 24 | public ContactBubble() 25 | { 26 | } 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bubbles/DeliveredBubble.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ProtoBuf; 3 | 4 | namespace Disa.Framework.Bubbles 5 | { 6 | //TODO: support for participants (parties) 7 | [Serializable] 8 | [ProtoContract] 9 | public class DeliveredBubble : AbstractBubble 10 | { 11 | [ProtoMember(1)] 12 | public string VisualBubbleID { get; set; } 13 | 14 | public DeliveredBubble(long time, BubbleDirection direction, Service service, string address, string visualBubbleID) 15 | : base(time, direction, service) 16 | { 17 | Address = address; 18 | VisualBubbleID = visualBubbleID; 19 | } 20 | 21 | public DeliveredBubble() 22 | { 23 | 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bubbles/DeliveredBubbleReceipt.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ProtoBuf; 3 | 4 | namespace Disa.Framework.Bubbles 5 | { 6 | [Serializable] 7 | [ProtoContract] 8 | public class DeliveredBubbleReceipt : AbstractBubble 9 | { 10 | [ProtoMember(1)] 11 | public VisualBubble BubbleUpdated { get; set; } 12 | 13 | public DeliveredBubbleReceipt(long time, BubbleDirection direction, Service service, VisualBubble bubbleUpdated) 14 | : base(time, direction, service) 15 | { 16 | BubbleUpdated = bubbleUpdated; 17 | } 18 | 19 | public DeliveredBubbleReceipt() 20 | { 21 | } 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bubbles/NewBubble.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ProtoBuf; 3 | 4 | namespace Disa.Framework.Bubbles 5 | { 6 | [Serializable] 7 | [ProtoContract] 8 | public class NewBubble : VisualBubble 9 | { 10 | public NewBubble(long time, BubbleDirection direction, string address, 11 | string participantAddress, bool party, Service service) : 12 | base(time, direction, address, participantAddress, party, service) 13 | { 14 | } 15 | 16 | public NewBubble() 17 | { 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bubbles/NewDayBubble.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ProtoBuf; 3 | 4 | namespace Disa.Framework.Bubbles 5 | { 6 | [Serializable] 7 | [ProtoContract] 8 | public class NewDayBubble : VisualBubble 9 | { 10 | [NonSerialized] public bool Used; 11 | 12 | public NewDayBubble(long time, BubbleDirection direction, string address, 13 | string participantAddress, bool party, Service service) : 14 | base(time, direction, address, participantAddress, party, service) 15 | { 16 | } 17 | 18 | public NewDayBubble() 19 | { 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bubbles/ReadBubble.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ProtoBuf; 3 | 4 | namespace Disa.Framework.Bubbles 5 | { 6 | [Serializable] 7 | [ProtoContract] 8 | public class ReadBubble : AbstractBubble 9 | { 10 | [ProtoMember(1)] 11 | public long ReadTime { get; set; } 12 | 13 | [ProtoMember(2)] 14 | public bool Updated { get; set; } 15 | 16 | public ReadBubble(long time, BubbleDirection direction, Service service, string address, 17 | string participantAddress, long readTime, bool party, bool updated) 18 | : base(time, direction, service) 19 | { 20 | Address = address; 21 | ReadTime = readTime; 22 | ParticipantAddress = participantAddress; 23 | Party = party; 24 | Updated = updated; 25 | } 26 | 27 | public ReadBubble() 28 | { 29 | 30 | } 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bubbles/SoloInformationBubble.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ProtoBuf; 3 | 4 | namespace Disa.Framework.Bubbles 5 | { 6 | [Serializable] 7 | [ProtoContract] 8 | public class SoloInformationBubble : VisualBubble 9 | { 10 | [ProtoMember(1)] 11 | public string Message { get; private set; } 12 | 13 | [ProtoMember(2)] 14 | public bool RaiseNotification { get; set; } 15 | 16 | public SoloInformationBubble() 17 | { 18 | } 19 | 20 | public SoloInformationBubble(long time, BubbleDirection direction, string address, 21 | string participantAddress, bool party, Service service, string message) : 22 | base(time, direction, address, participantAddress, party, service) 23 | { 24 | Message = message; 25 | } 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bubbles/SubscribeBubble.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ProtoBuf; 3 | 4 | namespace Disa.Framework.Bubbles 5 | { 6 | [Serializable] 7 | [ProtoContract] 8 | public class SubscribeBubble : AbstractBubble 9 | { 10 | [ProtoMember(1)] 11 | public bool Subscribe { get; private set; } 12 | 13 | public SubscribeBubble(long time, BubbleDirection direction, string address, 14 | bool party, Service service, bool subscribe) 15 | : base(time, direction, service) 16 | { 17 | Address = address; 18 | Party = party; 19 | Subscribe = subscribe; 20 | } 21 | 22 | public SubscribeBubble() 23 | { 24 | 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/Bubbles/TextBubble.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using ProtoBuf; 4 | 5 | namespace Disa.Framework.Bubbles 6 | { 7 | [Serializable] 8 | [ProtoContract] 9 | public class TextBubble : VisualBubble 10 | { 11 | [ProtoMember(1)] 12 | public string Message {get; set; } 13 | 14 | [ProtoMember(2)] 15 | public bool HasParsedMessageForUrls { get; set; } 16 | 17 | public TextBubble(long time, BubbleDirection direction, string address, 18 | string participantAddress, bool party, Service service, string message, string idService = null) : 19 | base(time, direction, address, participantAddress, party, service, null, idService) 20 | { 21 | Message = message; 22 | } 23 | 24 | public TextBubble() 25 | { 26 | } 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/ComposeBubbleGroup.cs: -------------------------------------------------------------------------------- 1 | using Disa.Framework.Bubbles; 2 | 3 | namespace Disa.Framework 4 | { 5 | public class ComposeBubbleGroup : BubbleGroup 6 | { 7 | public Contact.ID[] Ids { get; private set; } 8 | 9 | public ComposeBubbleGroup(NewBubble newBubble, Contact.ID[] ids, string title) 10 | : base(newBubble) 11 | { 12 | Title = string.IsNullOrWhiteSpace(title) ? null : title; 13 | Photo = null; 14 | Ids = ids; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/ContactCard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Disa.Framework 5 | { 6 | public class ContactCard 7 | { 8 | public class ContactCardPhone 9 | { 10 | public string Number { get; set;} 11 | public bool IsHome { get; set; } 12 | public bool IsWork { get; set; } 13 | } 14 | 15 | private List _phones; 16 | 17 | public string GivenName { get; set; } 18 | public string FamilyName { get; set; } 19 | public List Phones 20 | { 21 | get 22 | { 23 | if (_phones == null) 24 | { 25 | _phones = new List(); 26 | } 27 | return _phones; 28 | } 29 | } 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/DisaMutableSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework 4 | { 5 | [Serializable] 6 | public class DisaMutableSettings 7 | { 8 | public DisaMutableSettings() 9 | { 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/DisaParticipantNickname.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ProtoBuf; 3 | 4 | namespace Disa.Framework 5 | { 6 | [ProtoContract] 7 | internal class DisaParticipantNickname 8 | { 9 | [ProtoMember(1)] 10 | public string Address { get; set; } 11 | [ProtoMember(2)] 12 | public string Nickname { get; set; } 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/DisaQuotedTitle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ProtoBuf; 3 | 4 | namespace Disa.Framework 5 | { 6 | [ProtoContract] 7 | public class DisaQuotedTitle 8 | { 9 | [ProtoMember(1)] 10 | public string Address { get; set; } 11 | [ProtoMember(2)] 12 | public string Title { get; set; } 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/DisaReadTime.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ProtoBuf; 3 | 4 | namespace Disa.Framework 5 | { 6 | [ProtoContract] 7 | public class DisaReadTime 8 | { 9 | public static string SingletonPartyParticipantAddress 10 | { 11 | get 12 | { 13 | return "&^%$#@?!singletonpartyparticipantaddress!?@#$%^&"; 14 | } 15 | } 16 | 17 | [NonSerialized] 18 | public object Tag; 19 | [ProtoMember(1)] 20 | public string ParticipantAddress { get; set; } 21 | [ProtoMember(2)] 22 | public long Time { get; set; } 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/DisaSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework 4 | { 5 | [Serializable] 6 | public class DisaSettings 7 | { 8 | 9 | } 10 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/DisaUnifiedBubbleGroupEntry.cs: -------------------------------------------------------------------------------- 1 | using ProtoBuf; 2 | 3 | namespace Disa.Framework 4 | { 5 | 6 | [ProtoContract] 7 | public class DisaUnifiedBubbleGroupEntry 8 | { 9 | [ProtoMember(1)] 10 | public string[] GroupIds { get; set; } 11 | 12 | [ProtoMember(2)] 13 | public string PrimaryGroupId { get; set; } 14 | 15 | [ProtoMember(3)] 16 | public string SendingGroupId { get; set; } 17 | 18 | [ProtoMember(4)] 19 | public string Id { get; set; } 20 | 21 | public DisaUnifiedBubbleGroupEntry(string id, string[] groupIds, string primaryGroupId, string sendingGroupId) 22 | { 23 | Id = id; 24 | GroupIds = groupIds; 25 | PrimaryGroupId = primaryGroupId; 26 | SendingGroupId = sendingGroupId; 27 | } 28 | 29 | public DisaUnifiedBubbleGroupEntry() 30 | { 31 | 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/Hashtag.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Disa.Framework 4 | { 5 | public class Hashtag 6 | { 7 | public string Tag { get; set; } 8 | public int Date { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/IAnnouncement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework 4 | { 5 | [DisaFramework] 6 | public interface IAnnouncement 7 | { 8 | string GetAnnouncementMessage(); 9 | 10 | bool IsAnnouncementRecurring(); 11 | 12 | int GetAnnouncementRecurringInterval(); 13 | 14 | string GetAnnouncementName(); 15 | 16 | bool HasAnnouncementExternalLink(); 17 | 18 | string GetAnnouncementExternalLink(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/IMediaDownloader.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Disa.Framework.Bubbles; 3 | 4 | namespace Disa.Framework 5 | { 6 | [DisaFramework] 7 | public interface IMediaDownloader 8 | { 9 | Task TranslatePath(string path); 10 | 11 | string GetUserAgent(); 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/IMediaDownloaderCustom.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Disa.Framework.Bubbles; 4 | 5 | namespace Disa.Framework 6 | { 7 | [DisaFramework] 8 | public interface IMediaDownloaderCustom 9 | { 10 | Task Download(VisualBubble bubble, Action progress); 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/IMessageIntent.cs: -------------------------------------------------------------------------------- 1 | namespace Disa.Framework 2 | { 3 | [DisaFramework] 4 | public interface IMessageIntent 5 | { 6 | string PhoneNumberToServiceAddress(string number); 7 | } 8 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/INewMessageExtended.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Disa.Framework 5 | { 6 | [DisaFrameworkDeprecated] 7 | public interface INewMessageExtended 8 | { 9 | Task FetchBubbleGroupAddressFromLink(string link, Action> result); 10 | 11 | bool SupportsShareLinks 12 | { 13 | get; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/IPartyThumbnail.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Disa.Framework 5 | { 6 | [DisaFramework] 7 | public interface IPartyThumbnail 8 | { 9 | Task GetParticipantThumbnail(string address, Action result); 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/IPrivacyList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Disa.Framework 5 | { 6 | [DisaFramework] 7 | public interface IPrivacyList 8 | { 9 | Task GetPrivacyList(Action addresses); 10 | 11 | Task SetPrivacyList(string[] addresses); 12 | 13 | Task GetAddressPicture(string address, Action result); 14 | 15 | Task GetAddressTitle(string address, Action result); 16 | 17 | Task ConvertContactIdToParticipant(Contact contact, 18 | Contact.ID contactId, Action result); 19 | } 20 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/ITerminal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework 4 | { 5 | [DisaFramework] 6 | public interface ITerminal 7 | { 8 | void DoCommand(string[] args); 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/IThumbnailDownloader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Disa.Framework.Bubbles; 3 | 4 | namespace Disa.Framework 5 | { 6 | [DisaFramework] 7 | public interface IThumbnailDownloader 8 | { 9 | /// 10 | /// Fetch the thumbnail bytes. 11 | /// 12 | /// A tuple the bool indicating if the thumbnail should not be retried, and byte array containing the thumbnail bytes 13 | /// Bubble. 14 | Tuple FetchThumbnailBytes(VisualBubble bubble); 15 | 16 | /// 17 | /// Fetchs the quoted thumbnail bytes. 18 | /// 19 | /// A tuple the bool indicating if the thumbnail should not be retried, and byte array containing the thumbnail bytes 20 | /// Bubble. 21 | Tuple FetchQuotedThumbnailBytes(VisualBubble bubble); 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/ITimeFormatter.cs: -------------------------------------------------------------------------------- 1 | namespace Disa.Framework 2 | { 3 | [DisaFramework] 4 | public interface ITimeFormatter 5 | { 6 | string GetDayDisplayTime(long unixTime); 7 | string GetAbsoluteDisplayTime(long unixTime); 8 | string GetLastSeenDisplayTime(long unixTime); 9 | string GetBubbleDisplayTime(long unixTime, bool lowercase = false, bool absoluteTime = false); 10 | } 11 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/IUserInformationExtended.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Disa.Framework 5 | { 6 | [DisaFrameworkDeprecated] 7 | public interface IUserInformationExtended 8 | { 9 | Task IsUserBotStopped(string address, Action result); 10 | 11 | Task EnableUserBot(string address, bool enable, Action result); 12 | 13 | Task IsUserBot(string address, Action result); 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/IconType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework 4 | { 5 | public enum IconType 6 | { 7 | AddContact, 8 | People, 9 | Call 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/NotificationManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework 4 | { 5 | public static class NotificationManager 6 | { 7 | public static event EventHandler RemoveFromBubbleGroup; 8 | public static event EventHandler RemoveFromBubbleGroupImmediately; 9 | 10 | public static void Remove(Service service, string address) 11 | { 12 | if (RemoveFromBubbleGroup != null) 13 | { 14 | RemoveFromBubbleGroup(service, address); 15 | } 16 | } 17 | 18 | public static void RemoveImmediately(Service service, string address) 19 | { 20 | if (RemoveFromBubbleGroupImmediately != null) 21 | { 22 | RemoveFromBubbleGroupImmediately(service, address); 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/SendBubbleAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework 4 | { 5 | public class SendBubbleAction 6 | { 7 | public enum ActionType 8 | { 9 | Typing, 10 | Recording, 11 | Nothing 12 | } 13 | 14 | public string Address { get; internal set; } 15 | public ActionType Type { get; internal set; } 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/ServiceBubbleGroupAddressException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework 4 | { 5 | public class ServiceBubbleGroupAddressException : Exception 6 | { 7 | public string Address { get; private set; } 8 | 9 | public ServiceBubbleGroupAddressException(string address) 10 | { 11 | Address = address; 12 | } 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/ServiceBubbleSendFailedException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework 4 | { 5 | public class ServiceBubbleSendFailedException : Exception 6 | { 7 | public ServiceBubbleSendFailedException(string message) 8 | : base(message) 9 | { 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/ServiceExpiredException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework 4 | { 5 | public class ServiceExpiredException : Exception 6 | { 7 | public ServiceExpiredException(string message) 8 | : base(message) 9 | { 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/ServiceManagerException.cs: -------------------------------------------------------------------------------- 1 | namespace Disa.Framework 2 | { 3 | public class ServiceManagerException : System.Exception 4 | { 5 | public ServiceManagerException(string message) 6 | : base(message) 7 | { 8 | 9 | 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/ServiceQueueBubbleException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework 4 | { 5 | public class ServiceQueueBubbleException : Exception 6 | { 7 | public ServiceQueueBubbleException(string message) 8 | : base(message) 9 | { 10 | 11 | 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/ServiceRestartException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework 4 | { 5 | public class ServiceRestartException : Exception 6 | { 7 | public ServiceRestartException(string message) : base(message) 8 | { 9 | } 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/ServiceSchedulerException.cs: -------------------------------------------------------------------------------- 1 | namespace Disa.Framework 2 | { 3 | public class ServiceSchedulerException : System.Exception 4 | { 5 | public ServiceSchedulerException(string message) : base(message) 6 | { 7 | 8 | 9 | } 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/ServiceSpecialRestartException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework 4 | { 5 | public class ServiceSpecialRestartException : Exception 6 | { 7 | public ServiceSpecialRestartException(string message) 8 | : base(message) 9 | { 10 | 11 | 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/ServiceWarningException.cs: -------------------------------------------------------------------------------- 1 | namespace Disa.Framework 2 | { 3 | public class ServiceWarningException : System.Exception 4 | { 5 | public ServiceWarningException(string message) : base(message) 6 | { 7 | 8 | 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /Disa.Framework.Shared/ThumbnailTransfer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Disa.Framework 5 | { 6 | public abstract class ThumbnailTransfer 7 | { 8 | public abstract Task Start(); 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/UserInformation.cs: -------------------------------------------------------------------------------- 1 | namespace Disa.Framework 2 | { 3 | public class UserInformation 4 | { 5 | public enum TypeSubtitle { Other, PhoneNumber } 6 | 7 | public string Status { get; set; } 8 | public string Title { get; set; } 9 | public TypeSubtitle SubtitleType { get; set; } 10 | public string Subtitle { get; set; } 11 | public long LastSeen { get; set; } 12 | public bool Presence { get; set; } 13 | public string UserHandle { get; set; } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Disa.Framework.Shared/WakeLock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework 4 | { 5 | public abstract class WakeLock : IDisposable 6 | { 7 | public abstract void Dispose(); 8 | 9 | public abstract void TemporaryAcquire(); 10 | 11 | public abstract void TemporaryRelease(); 12 | 13 | public class TemporaryFree : IDisposable 14 | { 15 | private readonly WakeLock _wakeLock; 16 | 17 | public TemporaryFree(WakeLock wakeLock) 18 | { 19 | _wakeLock = wakeLock; 20 | _wakeLock.TemporaryRelease(); 21 | } 22 | 23 | public void Dispose() 24 | { 25 | _wakeLock.TemporaryAcquire(); 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Mobile.Shared/Description.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Disa.Framework.Mobile; 3 | 4 | namespace Disa.Framework.Telegram.Mobile 5 | { 6 | public class Description : IPluginDescription 7 | { 8 | public string FetchDescription(Telegram service) 9 | { 10 | return Localize.GetString("TelegramDescription"); 11 | } 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Mobile.Shared/PluginManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | Telegram 4 | 25 5 | 49 6 | true 7 | http://disa-im.github.io/DisaOpenSource/telegram/changelog.html 8 | Disa Technologies Inc. 9 | http://disa-im.github.io/DisaOpenSource/telegram/PluginExternalManifest.xml 10 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Mobile/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/CachedChat.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SQLite; 3 | 4 | 5 | namespace Disa.Framework.Telegram 6 | { 7 | public class CachedChat 8 | { 9 | [Indexed] 10 | public uint Id { get; set; } 11 | 12 | public bool IsChat { get; set; } 13 | 14 | public uint Pts { get; set; } 15 | 16 | public byte[] ProtoBufBytes { get; set; } 17 | 18 | public override string ToString() 19 | { 20 | return "Id " + Id + " bytes " + ProtoBufBytes; 21 | } 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/CachedThumbnail.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SQLite; 3 | 4 | namespace Disa.Framework.Telegram 5 | { 6 | public class CachedThumbnail 7 | { 8 | [Indexed] 9 | public string Id { get; set; } 10 | 11 | public byte[] ThumbnailBytes { get; set; } 12 | 13 | public override string ToString() 14 | { 15 | return "Id " + Id + " bytes " + ThumbnailBytes; 16 | } 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/CachedUser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SQLite; 3 | 4 | 5 | namespace Disa.Framework.Telegram 6 | { 7 | public class CachedUser 8 | { 9 | [Indexed] 10 | public uint Id { get; set; } 11 | 12 | public byte[] ProtoBufBytes { get; set; } 13 | 14 | public override string ToString() 15 | { 16 | return "Id " + Id + " bytes " + ProtoBufBytes; 17 | } 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Contact.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SharpTelegram.Schema; 3 | 4 | namespace Disa.Framework.Telegram 5 | { 6 | public class TelegramContact : Disa.Framework.Contact 7 | { 8 | public TelegramContact() 9 | { 10 | 11 | } 12 | 13 | public User User { get; set; } 14 | } 15 | 16 | public class TelegramPartyContact : Disa.Framework.PartyContact 17 | { 18 | public TelegramPartyContact() 19 | { 20 | 21 | } 22 | 23 | /// 24 | /// An AccessHash is used by Telegram when accessing public entities such as public channels. 25 | /// 26 | public ulong AccessHash { get; set; } 27 | } 28 | 29 | public class TelegramBotContact : Disa.Framework.BotContact 30 | { 31 | public TelegramBotContact() 32 | { 33 | 34 | } 35 | 36 | 37 | public User User { get; set; } 38 | } 39 | 40 | } 41 | 42 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/FileInformation.cs: -------------------------------------------------------------------------------- 1 | using ProtoBuf; 2 | using SharpTelegram.Schema; 3 | 4 | namespace Disa.Framework.Telegram 5 | { 6 | [ProtoContract] 7 | public class FileInformation 8 | { 9 | [ProtoMember(1)] 10 | public IFileLocation FileLocation { get; set; } 11 | [ProtoMember(2)] 12 | public uint Size { get; set; } 13 | [ProtoMember(3)] 14 | public string FileType { get; set; } 15 | [ProtoMember(4)] 16 | public IDocument Document { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Nito.AsyncEx/Base/ExceptionHelpers.cs: -------------------------------------------------------------------------------- 1 | using Nito.AsyncEx.Internal.PlatformEnlightenment; 2 | using System; 3 | 4 | namespace Nito.AsyncEx 5 | { 6 | /// 7 | /// Provides helper (non-extension) methods dealing with exceptions. 8 | /// 9 | public static class ExceptionHelpers 10 | { 11 | /// 12 | /// Attempts to prepare the exception for re-throwing by preserving the stack trace. The returned exception should be immediately thrown. 13 | /// 14 | /// The exception. May not be null. 15 | /// The that was passed into this method. 16 | public static Exception PrepareForRethrow(Exception exception) 17 | { 18 | return ExceptionEnlightenment.PrepareForRethrow(exception); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Nito.AsyncEx/Base/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Nito.AsyncEx/Enlightement/EnlightenmentVerification.cs: -------------------------------------------------------------------------------- 1 | using Nito.AsyncEx.Internal.PlatformEnlightenment; 2 | 3 | namespace Nito.AsyncEx 4 | { 5 | /// 6 | /// Verifies platform enlightenment. 7 | /// 8 | public static class EnlightenmentVerification 9 | { 10 | /// 11 | /// Returns a value indicating whether the correct platform enlightenment provider has been loaded. 12 | /// 13 | public static bool EnsureLoaded() 14 | { 15 | return true; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Nito.AsyncEx/Enlightement/Internal/PlatformEnlightenment/AsyncEnlightenment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Nito.AsyncEx.Internal.PlatformEnlightenment 5 | { 6 | public static class AsyncEnlightenment 7 | { 8 | public static TaskCreationOptions AddDenyChildAttach(TaskCreationOptions options) 9 | { 10 | return options | TaskCreationOptions.DenyChildAttach; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Nito.AsyncEx/Enlightement/Internal/PlatformEnlightenment/ExceptionEnlightenment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.ExceptionServices; 3 | 4 | namespace Nito.AsyncEx.Internal.PlatformEnlightenment 5 | { 6 | public static class ExceptionEnlightenment 7 | { 8 | public static Exception PrepareForRethrow(Exception exception) 9 | { 10 | ExceptionDispatchInfo.Capture(exception).Throw(); 11 | return exception; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Nito.AsyncEx/Enlightement/Internal/PlatformEnlightenment/Lazy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | using System.Threading; 4 | 5 | [assembly:TypeForwardedTo(typeof(LazyThreadSafetyMode))] 6 | [assembly:TypeForwardedTo(typeof(Lazy<>))] 7 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Nito.AsyncEx/Enlightement/Internal/PlatformEnlightenment/SynchronizationContextEnlightenment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | 7 | namespace Nito.AsyncEx.Internal.PlatformEnlightenment 8 | { 9 | public static class SynchronizationContextEnlightenment 10 | { 11 | public static void SetCurrentSynchronizationContext(SynchronizationContext context) 12 | { 13 | SynchronizationContext.SetSynchronizationContext(context); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/ASN1Generator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.IO; 3 | 4 | namespace Raksha.Asn1 5 | { 6 | public abstract class Asn1Generator 7 | { 8 | private Stream _out; 9 | 10 | protected Asn1Generator( 11 | Stream outStream) 12 | { 13 | _out = outStream; 14 | } 15 | 16 | protected Stream Out 17 | { 18 | get { return _out; } 19 | } 20 | 21 | public abstract void AddObject(Asn1Encodable obj); 22 | 23 | public abstract Stream GetRawOutputStream(); 24 | 25 | public abstract void Close(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/ASN1OctetStringParser.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Raksha.Asn1 4 | { 5 | public interface Asn1OctetStringParser 6 | : IAsn1Convertible 7 | { 8 | Stream GetOctetStream(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/ASN1SequenceParser.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1 2 | { 3 | public interface Asn1SequenceParser 4 | : IAsn1Convertible 5 | { 6 | IAsn1Convertible ReadObject(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/ASN1SetParser.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1 2 | { 3 | public interface Asn1SetParser 4 | : IAsn1Convertible 5 | { 6 | IAsn1Convertible ReadObject(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/ASN1TaggedObjectParser.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1 2 | { 3 | public interface Asn1TaggedObjectParser 4 | : IAsn1Convertible 5 | { 6 | int TagNo { get; } 7 | 8 | IAsn1Convertible GetObjectParser(int tag, bool isExplicit); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Asn1Exception.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Asn1 5 | { 6 | public class Asn1Exception 7 | : IOException 8 | { 9 | public Asn1Exception() 10 | : base() 11 | { 12 | } 13 | 14 | public Asn1Exception( 15 | string message) 16 | : base(message) 17 | { 18 | } 19 | 20 | public Asn1Exception( 21 | string message, 22 | Exception exception) 23 | : base(message, exception) 24 | { 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Asn1Null.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1 2 | { 3 | /** 4 | * A Null object. 5 | */ 6 | public abstract class Asn1Null 7 | : Asn1Object 8 | { 9 | internal Asn1Null() 10 | { 11 | } 12 | 13 | public override string ToString() 14 | { 15 | return "NULL"; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Asn1ParsingException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Asn1 4 | { 5 | public class Asn1ParsingException 6 | : InvalidOperationException 7 | { 8 | public Asn1ParsingException() 9 | : base() 10 | { 11 | } 12 | 13 | public Asn1ParsingException( 14 | string message) 15 | : base(message) 16 | { 17 | } 18 | 19 | public Asn1ParsingException( 20 | string message, 21 | Exception exception) 22 | : base(message, exception) 23 | { 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/BEROctetStringParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using Raksha.Utilities.IO; 4 | 5 | namespace Raksha.Asn1 6 | { 7 | public class BerOctetStringParser 8 | : Asn1OctetStringParser 9 | { 10 | private readonly Asn1StreamParser _parser; 11 | 12 | internal BerOctetStringParser( 13 | Asn1StreamParser parser) 14 | { 15 | _parser = parser; 16 | } 17 | 18 | public Stream GetOctetStream() 19 | { 20 | return new ConstructedOctetStream(_parser); 21 | } 22 | 23 | public Asn1Object ToAsn1Object() 24 | { 25 | try 26 | { 27 | return new BerOctetString(Streams.ReadAll(GetOctetStream())); 28 | } 29 | catch (IOException e) 30 | { 31 | throw new Asn1ParsingException("IOException converting stream to byte array: " + e.Message, e); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/BERSequenceGenerator.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Raksha.Asn1 4 | { 5 | public class BerSequenceGenerator 6 | : BerGenerator 7 | { 8 | public BerSequenceGenerator( 9 | Stream outStream) 10 | : base(outStream) 11 | { 12 | WriteBerHeader(Asn1Tags.Constructed | Asn1Tags.Sequence); 13 | } 14 | 15 | public BerSequenceGenerator( 16 | Stream outStream, 17 | int tagNo, 18 | bool isExplicit) 19 | : base(outStream, tagNo, isExplicit) 20 | { 21 | WriteBerHeader(Asn1Tags.Constructed | Asn1Tags.Sequence); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/BERSequenceParser.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1 2 | { 3 | public class BerSequenceParser 4 | : Asn1SequenceParser 5 | { 6 | private readonly Asn1StreamParser _parser; 7 | 8 | internal BerSequenceParser( 9 | Asn1StreamParser parser) 10 | { 11 | this._parser = parser; 12 | } 13 | 14 | public IAsn1Convertible ReadObject() 15 | { 16 | return _parser.ReadObject(); 17 | } 18 | 19 | public Asn1Object ToAsn1Object() 20 | { 21 | return new BerSequence(_parser.ReadVector()); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/BERSetGenerator.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Raksha.Asn1 4 | { 5 | public class BerSetGenerator 6 | : BerGenerator 7 | { 8 | public BerSetGenerator( 9 | Stream outStream) 10 | : base(outStream) 11 | { 12 | WriteBerHeader(Asn1Tags.Constructed | Asn1Tags.Set); 13 | } 14 | 15 | public BerSetGenerator( 16 | Stream outStream, 17 | int tagNo, 18 | bool isExplicit) 19 | : base(outStream, tagNo, isExplicit) 20 | { 21 | WriteBerHeader(Asn1Tags.Constructed | Asn1Tags.Set); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/BERSetParser.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1 2 | { 3 | public class BerSetParser 4 | : Asn1SetParser 5 | { 6 | private readonly Asn1StreamParser _parser; 7 | 8 | internal BerSetParser( 9 | Asn1StreamParser parser) 10 | { 11 | this._parser = parser; 12 | } 13 | 14 | public IAsn1Convertible ReadObject() 15 | { 16 | return _parser.ReadObject(); 17 | } 18 | 19 | public Asn1Object ToAsn1Object() 20 | { 21 | return new BerSet(_parser.ReadVector(), false); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/BerApplicationSpecific.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Asn1 4 | { 5 | public class BerApplicationSpecific 6 | : DerApplicationSpecific 7 | { 8 | public BerApplicationSpecific( 9 | int tagNo, 10 | Asn1EncodableVector vec) 11 | : base(tagNo, vec) 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/BerApplicationSpecificParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Asn1 4 | { 5 | public class BerApplicationSpecificParser 6 | : IAsn1ApplicationSpecificParser 7 | { 8 | private readonly int tag; 9 | private readonly Asn1StreamParser parser; 10 | 11 | internal BerApplicationSpecificParser( 12 | int tag, 13 | Asn1StreamParser parser) 14 | { 15 | this.tag = tag; 16 | this.parser = parser; 17 | } 18 | 19 | public IAsn1Convertible ReadObject() 20 | { 21 | return parser.ReadObject(); 22 | } 23 | 24 | public Asn1Object ToAsn1Object() 25 | { 26 | return new BerApplicationSpecific(tag, parser.ReadVector()); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/BerNull.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Asn1 4 | { 5 | /** 6 | * A BER Null object. 7 | */ 8 | public class BerNull 9 | : DerNull 10 | { 11 | public static new readonly BerNull Instance = new BerNull(0); 12 | 13 | [Obsolete("Use static Instance object")] 14 | public BerNull() 15 | { 16 | } 17 | 18 | private BerNull(int dummy) : base(dummy) 19 | { 20 | } 21 | 22 | internal override void Encode( 23 | DerOutputStream derOut) 24 | { 25 | if (derOut is Asn1OutputStream || derOut is BerOutputStream) 26 | { 27 | derOut.WriteByte(Asn1Tags.Null); 28 | } 29 | else 30 | { 31 | base.Encode(derOut); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Cmp/PKIConfirmContent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Asn1.Cmp 4 | { 5 | public class PkiConfirmContent 6 | : Asn1Encodable 7 | { 8 | public static PkiConfirmContent GetInstance(object obj) 9 | { 10 | if (obj is PkiConfirmContent) 11 | return (PkiConfirmContent)obj; 12 | 13 | if (obj is Asn1Null) 14 | return new PkiConfirmContent(); 15 | 16 | throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); 17 | } 18 | 19 | public PkiConfirmContent() 20 | { 21 | } 22 | 23 | /** 24 | *
25 | 		 * PkiConfirmContent ::= NULL
26 | 		 * 
27 | * @return a basic ASN.1 object representation. 28 | */ 29 | public override Asn1Object ToAsn1Object() 30 | { 31 | return DerNull.Instance; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Cms/Attributes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Asn1.Cms 4 | { 5 | public class Attributes 6 | : Asn1Encodable 7 | { 8 | private readonly Asn1Set attributes; 9 | 10 | private Attributes(Asn1Set attributes) 11 | { 12 | this.attributes = attributes; 13 | } 14 | 15 | public Attributes(Asn1EncodableVector v) 16 | { 17 | attributes = new BerSet(v); 18 | } 19 | 20 | public static Attributes GetInstance(object obj) 21 | { 22 | if (obj is Attributes) 23 | return (Attributes)obj; 24 | 25 | if (obj != null) 26 | return new Attributes(Asn1Set.GetInstance(obj)); 27 | 28 | return null; 29 | } 30 | 31 | /** 32 | *
33 | 		 * Attributes ::=
34 | 		 *   SET SIZE(1..MAX) OF Attribute -- according to RFC 5652
35 | 		 * 
36 | * @return 37 | */ 38 | public override Asn1Object ToAsn1Object() 39 | { 40 | return attributes; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Cms/CMSAttributes.cs: -------------------------------------------------------------------------------- 1 | using Raksha.Asn1; 2 | using Raksha.Asn1.Pkcs; 3 | 4 | namespace Raksha.Asn1.Cms 5 | { 6 | public abstract class CmsAttributes 7 | { 8 | public static readonly DerObjectIdentifier ContentType = PkcsObjectIdentifiers.Pkcs9AtContentType; 9 | public static readonly DerObjectIdentifier MessageDigest = PkcsObjectIdentifiers.Pkcs9AtMessageDigest; 10 | public static readonly DerObjectIdentifier SigningTime = PkcsObjectIdentifiers.Pkcs9AtSigningTime; 11 | public static readonly DerObjectIdentifier CounterSignature = PkcsObjectIdentifiers.Pkcs9AtCounterSignature; 12 | public static readonly DerObjectIdentifier ContentHint = PkcsObjectIdentifiers.IdAAContentHint; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Crmf/SubsequentMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Asn1.Crmf 4 | { 5 | public class SubsequentMessage 6 | : DerInteger 7 | { 8 | public static readonly SubsequentMessage encrCert = new SubsequentMessage(0); 9 | public static readonly SubsequentMessage challengeResp = new SubsequentMessage(1); 10 | 11 | private SubsequentMessage(int value) 12 | : base(value) 13 | { 14 | } 15 | 16 | public static SubsequentMessage ValueOf(int value) 17 | { 18 | if (value == 0) 19 | return encrCert; 20 | 21 | if (value == 1) 22 | return challengeResp; 23 | 24 | throw new ArgumentException("unknown value: " + value, "value"); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/DERExternalParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Asn1 5 | { 6 | public class DerExternalParser 7 | : Asn1Encodable 8 | { 9 | private readonly Asn1StreamParser _parser; 10 | 11 | public DerExternalParser(Asn1StreamParser parser) 12 | { 13 | this._parser = parser; 14 | } 15 | 16 | public IAsn1Convertible ReadObject() 17 | { 18 | return _parser.ReadObject(); 19 | } 20 | 21 | public override Asn1Object ToAsn1Object() 22 | { 23 | return new DerExternal(_parser.ReadVector()); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/DEROctetStringParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | using Raksha.Utilities.IO; 5 | 6 | namespace Raksha.Asn1 7 | { 8 | public class DerOctetStringParser 9 | : Asn1OctetStringParser 10 | { 11 | private readonly DefiniteLengthInputStream stream; 12 | 13 | internal DerOctetStringParser( 14 | DefiniteLengthInputStream stream) 15 | { 16 | this.stream = stream; 17 | } 18 | 19 | public Stream GetOctetStream() 20 | { 21 | return stream; 22 | } 23 | 24 | public Asn1Object ToAsn1Object() 25 | { 26 | try 27 | { 28 | return new DerOctetString(stream.ToArray()); 29 | } 30 | catch (IOException e) 31 | { 32 | throw new InvalidOperationException("IOException converting stream to byte array: " + e.Message, e); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/DERSequenceGenerator.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Raksha.Asn1 4 | { 5 | public class DerSequenceGenerator 6 | : DerGenerator 7 | { 8 | private readonly MemoryStream _bOut = new MemoryStream(); 9 | 10 | public DerSequenceGenerator( 11 | Stream outStream) 12 | : base(outStream) 13 | { 14 | } 15 | 16 | public DerSequenceGenerator( 17 | Stream outStream, 18 | int tagNo, 19 | bool isExplicit) 20 | : base(outStream, tagNo, isExplicit) 21 | { 22 | } 23 | 24 | public override void AddObject( 25 | Asn1Encodable obj) 26 | { 27 | new DerOutputStream(_bOut).WriteObject(obj); 28 | } 29 | 30 | public override Stream GetRawOutputStream() 31 | { 32 | return _bOut; 33 | } 34 | 35 | public override void Close() 36 | { 37 | WriteDerEncoded(Asn1Tags.Constructed | Asn1Tags.Sequence, _bOut.ToArray()); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/DERSequenceParser.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1 2 | { 3 | public class DerSequenceParser 4 | : Asn1SequenceParser 5 | { 6 | private readonly Asn1StreamParser _parser; 7 | 8 | internal DerSequenceParser( 9 | Asn1StreamParser parser) 10 | { 11 | this._parser = parser; 12 | } 13 | 14 | public IAsn1Convertible ReadObject() 15 | { 16 | return _parser.ReadObject(); 17 | } 18 | 19 | public Asn1Object ToAsn1Object() 20 | { 21 | return new DerSequence(_parser.ReadVector()); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/DERSetGenerator.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Raksha.Asn1 4 | { 5 | public class DerSetGenerator 6 | : DerGenerator 7 | { 8 | private readonly MemoryStream _bOut = new MemoryStream(); 9 | 10 | public DerSetGenerator( 11 | Stream outStream) 12 | : base(outStream) 13 | { 14 | } 15 | 16 | public DerSetGenerator( 17 | Stream outStream, 18 | int tagNo, 19 | bool isExplicit) 20 | : base(outStream, tagNo, isExplicit) 21 | { 22 | } 23 | 24 | public override void AddObject( 25 | Asn1Encodable obj) 26 | { 27 | new DerOutputStream(_bOut).WriteObject(obj); 28 | } 29 | 30 | public override Stream GetRawOutputStream() 31 | { 32 | return _bOut; 33 | } 34 | 35 | public override void Close() 36 | { 37 | WriteDerEncoded(Asn1Tags.Constructed | Asn1Tags.Set, _bOut.ToArray()); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/DERSetParser.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1 2 | { 3 | public class DerSetParser 4 | : Asn1SetParser 5 | { 6 | private readonly Asn1StreamParser _parser; 7 | 8 | internal DerSetParser( 9 | Asn1StreamParser parser) 10 | { 11 | this._parser = parser; 12 | } 13 | 14 | public IAsn1Convertible ReadObject() 15 | { 16 | return _parser.ReadObject(); 17 | } 18 | 19 | public Asn1Object ToAsn1Object() 20 | { 21 | return new DerSet(_parser.ReadVector(), false); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/DerNull.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Asn1 4 | { 5 | /** 6 | * A Null object. 7 | */ 8 | public class DerNull 9 | : Asn1Null 10 | { 11 | public static readonly DerNull Instance = new DerNull(0); 12 | 13 | byte[] zeroBytes = new byte[0]; 14 | 15 | [Obsolete("Use static Instance object")] 16 | public DerNull() 17 | { 18 | } 19 | 20 | protected internal DerNull(int dummy) 21 | { 22 | } 23 | 24 | internal override void Encode( 25 | DerOutputStream derOut) 26 | { 27 | derOut.WriteEncoded(Asn1Tags.Null, zeroBytes); 28 | } 29 | 30 | protected override bool Asn1Equals( 31 | Asn1Object asn1Object) 32 | { 33 | return asn1Object is DerNull; 34 | } 35 | 36 | protected override int Asn1GetHashCode() 37 | { 38 | return -1; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/DerOctetString.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1 2 | { 3 | public class DerOctetString 4 | : Asn1OctetString 5 | { 6 | /// The octets making up the octet string. 7 | public DerOctetString( 8 | byte[] str) 9 | : base(str) 10 | { 11 | } 12 | 13 | public DerOctetString( 14 | Asn1Encodable obj) 15 | : base(obj) 16 | { 17 | } 18 | 19 | internal override void Encode( 20 | DerOutputStream derOut) 21 | { 22 | derOut.WriteEncoded(Asn1Tags.OctetString, str); 23 | } 24 | 25 | internal static void Encode( 26 | DerOutputStream derOut, 27 | byte[] bytes, 28 | int offset, 29 | int length) 30 | { 31 | derOut.WriteEncoded(Asn1Tags.OctetString, bytes, offset, length); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/DerStringBase.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1 2 | { 3 | public abstract class DerStringBase 4 | : Asn1Object, IAsn1String 5 | { 6 | protected DerStringBase() 7 | { 8 | } 9 | 10 | public abstract string GetString(); 11 | 12 | public override string ToString() 13 | { 14 | return GetString(); 15 | } 16 | 17 | protected override int Asn1GetHashCode() 18 | { 19 | return GetString().GetHashCode(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Esf/CommitmentTypeIdentifier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Raksha.Asn1; 4 | using Raksha.Asn1.Pkcs; 5 | 6 | namespace Raksha.Asn1.Esf 7 | { 8 | public abstract class CommitmentTypeIdentifier 9 | { 10 | public static readonly DerObjectIdentifier ProofOfOrigin = PkcsObjectIdentifiers.IdCtiEtsProofOfOrigin; 11 | public static readonly DerObjectIdentifier ProofOfReceipt = PkcsObjectIdentifiers.IdCtiEtsProofOfReceipt; 12 | public static readonly DerObjectIdentifier ProofOfDelivery = PkcsObjectIdentifiers.IdCtiEtsProofOfDelivery; 13 | public static readonly DerObjectIdentifier ProofOfSender = PkcsObjectIdentifiers.IdCtiEtsProofOfSender; 14 | public static readonly DerObjectIdentifier ProofOfApproval = PkcsObjectIdentifiers.IdCtiEtsProofOfApproval; 15 | public static readonly DerObjectIdentifier ProofOfCreation = PkcsObjectIdentifiers.IdCtiEtsProofOfCreation; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/IAsn1ApplicationSpecificParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Asn1 4 | { 5 | public interface IAsn1ApplicationSpecificParser 6 | : IAsn1Convertible 7 | { 8 | IAsn1Convertible ReadObject(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/IAsn1Choice.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Raksha.Asn1 3 | { 4 | /** 5 | * Marker interface for CHOICE objects - if you implement this in a roll-your-own 6 | * object, any attempt to tag the object implicitly will convert the tag to an 7 | * explicit one as the encoding rules require. 8 | *

9 | * If you use this interface your class should also implement the getInstance 10 | * pattern which takes a tag object and the tagging mode used. 11 | *

12 | */ 13 | public interface IAsn1Choice 14 | { 15 | // marker interface 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/IAsn1Convertible.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1 2 | { 3 | public interface IAsn1Convertible 4 | { 5 | Asn1Object ToAsn1Object(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/IAsn1String.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1 2 | { 3 | /** 4 | * basic interface for Der string objects. 5 | */ 6 | public interface IAsn1String 7 | { 8 | string GetString(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Iana/IANAObjectIdentifiers.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1.Iana 2 | { 3 | public abstract class IanaObjectIdentifiers 4 | { 5 | // id-SHA1 OBJECT IDENTIFIER ::= 6 | // {iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) ipsec(8) isakmpOakley(1)} 7 | // 8 | 9 | public static readonly DerObjectIdentifier IsakmpOakley = new DerObjectIdentifier("1.3.6.1.5.5.8.1"); 10 | 11 | public static readonly DerObjectIdentifier HmacMD5 = new DerObjectIdentifier(IsakmpOakley + ".1"); 12 | public static readonly DerObjectIdentifier HmacSha1 = new DerObjectIdentifier(IsakmpOakley + ".2"); 13 | 14 | public static readonly DerObjectIdentifier HmacTiger = new DerObjectIdentifier(IsakmpOakley + ".3"); 15 | 16 | public static readonly DerObjectIdentifier HmacRipeMD160 = new DerObjectIdentifier(IsakmpOakley + ".4"); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Kisa/KISAObjectIdentifiers.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1.Kisa 2 | { 3 | public abstract class KisaObjectIdentifiers 4 | { 5 | public static readonly DerObjectIdentifier IdSeedCbc = new DerObjectIdentifier("1.2.410.200004.1.4"); 6 | public static readonly DerObjectIdentifier IdNpkiAppCmsSeedWrap = new DerObjectIdentifier("1.2.410.200004.7.1.1.1"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/LazyASN1InputStream.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Asn1 5 | { 6 | public class LazyAsn1InputStream 7 | : Asn1InputStream 8 | { 9 | public LazyAsn1InputStream( 10 | byte[] input) 11 | : base(input) 12 | { 13 | } 14 | 15 | public LazyAsn1InputStream( 16 | Stream inputStream) 17 | : base(inputStream) 18 | { 19 | } 20 | 21 | internal override DerSequence CreateDerSequence( 22 | DefiniteLengthInputStream dIn) 23 | { 24 | return new LazyDerSequence(dIn.ToArray()); 25 | } 26 | 27 | internal override DerSet CreateDerSet( 28 | DefiniteLengthInputStream dIn) 29 | { 30 | return new LazyDerSet(dIn.ToArray()); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/LimitedInputStream.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using Raksha.Utilities.IO; 3 | 4 | namespace Raksha.Asn1 5 | { 6 | internal abstract class LimitedInputStream 7 | : BaseInputStream 8 | { 9 | protected readonly Stream _in; 10 | private int _limit; 11 | 12 | internal LimitedInputStream( 13 | Stream inStream, 14 | int limit) 15 | { 16 | this._in = inStream; 17 | this._limit = limit; 18 | } 19 | 20 | internal virtual int GetRemaining() 21 | { 22 | // TODO: maybe one day this can become more accurate 23 | return _limit; 24 | } 25 | 26 | protected virtual void SetParentEofDetect(bool on) 27 | { 28 | if (_in is IndefiniteLengthInputStream) 29 | { 30 | ((IndefiniteLengthInputStream)_in).SetEofOn00(on); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Misc/NetscapeRevocationURL.cs: -------------------------------------------------------------------------------- 1 | using Raksha.Asn1; 2 | 3 | namespace Raksha.Asn1.Misc 4 | { 5 | public class NetscapeRevocationUrl 6 | : DerIA5String 7 | { 8 | public NetscapeRevocationUrl(DerIA5String str) 9 | : base(str.GetString()) 10 | { 11 | } 12 | 13 | public override string ToString() 14 | { 15 | return "NetscapeRevocationUrl: " + this.GetString(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Misc/VerisignCzagExtension.cs: -------------------------------------------------------------------------------- 1 | using Raksha.Asn1; 2 | 3 | namespace Raksha.Asn1.Misc 4 | { 5 | public class VerisignCzagExtension 6 | : DerIA5String 7 | { 8 | public VerisignCzagExtension(DerIA5String str) 9 | : base(str.GetString()) 10 | { 11 | } 12 | 13 | public override string ToString() 14 | { 15 | return "VerisignCzagExtension: " + this.GetString(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Ntt/NTTObjectIdentifiers.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1.Ntt 2 | { 3 | /// From RFC 3657 4 | public abstract class NttObjectIdentifiers 5 | { 6 | public static readonly DerObjectIdentifier IdCamellia128Cbc = new DerObjectIdentifier("1.2.392.200011.61.1.1.1.2"); 7 | public static readonly DerObjectIdentifier IdCamellia192Cbc = new DerObjectIdentifier("1.2.392.200011.61.1.1.1.3"); 8 | public static readonly DerObjectIdentifier IdCamellia256Cbc = new DerObjectIdentifier("1.2.392.200011.61.1.1.1.4"); 9 | 10 | public static readonly DerObjectIdentifier IdCamellia128Wrap = new DerObjectIdentifier("1.2.392.200011.61.1.1.3.2"); 11 | public static readonly DerObjectIdentifier IdCamellia192Wrap = new DerObjectIdentifier("1.2.392.200011.61.1.1.3.3"); 12 | public static readonly DerObjectIdentifier IdCamellia256Wrap = new DerObjectIdentifier("1.2.392.200011.61.1.1.3.4"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Pkcs/AuthenticatedSafe.cs: -------------------------------------------------------------------------------- 1 | using Raksha.Asn1; 2 | 3 | namespace Raksha.Asn1.Pkcs 4 | { 5 | public class AuthenticatedSafe 6 | : Asn1Encodable 7 | { 8 | private readonly ContentInfo[] info; 9 | 10 | public AuthenticatedSafe( 11 | Asn1Sequence seq) 12 | { 13 | info = new ContentInfo[seq.Count]; 14 | 15 | for (int i = 0; i != info.Length; i++) 16 | { 17 | info[i] = ContentInfo.GetInstance(seq[i]); 18 | } 19 | } 20 | 21 | public AuthenticatedSafe( 22 | ContentInfo[] info) 23 | { 24 | this.info = (ContentInfo[]) info.Clone(); 25 | } 26 | 27 | public ContentInfo[] GetContentInfo() 28 | { 29 | return (ContentInfo[]) info.Clone(); 30 | } 31 | 32 | public override Asn1Object ToAsn1Object() 33 | { 34 | return new BerSequence(info); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Pkcs/KeyDerivationFunc.cs: -------------------------------------------------------------------------------- 1 | using Raksha.Asn1; 2 | using Raksha.Asn1.X509; 3 | 4 | namespace Raksha.Asn1.Pkcs 5 | { 6 | public class KeyDerivationFunc 7 | : AlgorithmIdentifier 8 | { 9 | internal KeyDerivationFunc(Asn1Sequence seq) 10 | : base(seq) 11 | { 12 | } 13 | 14 | public KeyDerivationFunc( 15 | DerObjectIdentifier id, 16 | Asn1Encodable parameters) 17 | : base(id, parameters) 18 | { 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Smime/SMIMEAttributes.cs: -------------------------------------------------------------------------------- 1 | using Raksha.Asn1; 2 | using Raksha.Asn1.Pkcs; 3 | 4 | namespace Raksha.Asn1.Smime 5 | { 6 | public abstract class SmimeAttributes 7 | { 8 | public static readonly DerObjectIdentifier SmimeCapabilities = PkcsObjectIdentifiers.Pkcs9AtSmimeCapabilities; 9 | public static readonly DerObjectIdentifier EncrypKeyPref = PkcsObjectIdentifiers.IdAAEncrypKeyPref; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/Smime/SMIMECapabilitiesAttribute.cs: -------------------------------------------------------------------------------- 1 | using Raksha.Asn1; 2 | using Raksha.Asn1.X509; 3 | 4 | namespace Raksha.Asn1.Smime 5 | { 6 | public class SmimeCapabilitiesAttribute 7 | : AttributeX509 8 | { 9 | public SmimeCapabilitiesAttribute( 10 | SmimeCapabilityVector capabilities) 11 | : base(SmimeAttributes.SmimeCapabilities, 12 | new DerSet(new DerSequence(capabilities.ToAsn1EncodableVector()))) 13 | { 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/X509/CRLNumber.cs: -------------------------------------------------------------------------------- 1 | using BigMath; 2 | using Raksha.Math; 3 | 4 | namespace Raksha.Asn1.X509 5 | { 6 | /** 7 | * The CRLNumber object. 8 | *
 9 |      * CRLNumber::= Integer(0..MAX)
10 |      * 
11 | */ 12 | public class CrlNumber 13 | : DerInteger 14 | { 15 | public CrlNumber( 16 | BigInteger number) 17 | : base(number) 18 | { 19 | } 20 | 21 | public BigInteger Number 22 | { 23 | get { return PositiveValue; } 24 | } 25 | 26 | public override string ToString() 27 | { 28 | return "CRLNumber: " + Number; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/X509/CertPolicyId.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1.X509 2 | { 3 | /** 4 | * CertPolicyId, used in the CertificatePolicies and PolicyMappings 5 | * X509V3 Extensions. 6 | * 7 | *
 8 |      *     CertPolicyId ::= OBJECT IDENTIFIER
 9 |      * 
10 | */ 11 | public class CertPolicyID 12 | : DerObjectIdentifier 13 | { 14 | public CertPolicyID( 15 | string id) 16 | : base(id) 17 | { 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/X509/PolicyQualifierId.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1.X509 2 | { 3 | /** 4 | * PolicyQualifierId, used in the CertificatePolicies 5 | * X509V3 extension. 6 | * 7 | *
 8 | 	 *    id-qt          OBJECT IDENTIFIER ::=  { id-pkix 2 }
 9 | 	 *    id-qt-cps      OBJECT IDENTIFIER ::=  { id-qt 1 }
10 | 	 *    id-qt-unotice  OBJECT IDENTIFIER ::=  { id-qt 2 }
11 | 	 *  PolicyQualifierId ::=
12 | 	 *       OBJECT IDENTIFIER ( id-qt-cps | id-qt-unotice )
13 | 	 * 
14 | */ 15 | public sealed class PolicyQualifierID : DerObjectIdentifier 16 | { 17 | private const string IdQt = "1.3.6.1.5.5.7.2"; 18 | 19 | private PolicyQualifierID( 20 | string id) 21 | : base(id) 22 | { 23 | } 24 | 25 | public static readonly PolicyQualifierID IdQtCps = new PolicyQualifierID(IdQt + ".1"); 26 | public static readonly PolicyQualifierID IdQtUnotice = new PolicyQualifierID(IdQt + ".2"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/X509/Qualified/ETSIQCObjectIdentifiers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Raksha.Asn1; 4 | 5 | namespace Raksha.Asn1.X509.Qualified 6 | { 7 | public abstract class EtsiQCObjectIdentifiers 8 | { 9 | // 10 | // base id 11 | // 12 | public static readonly DerObjectIdentifier IdEtsiQcs = new DerObjectIdentifier("0.4.0.1862.1"); 13 | 14 | public static readonly DerObjectIdentifier IdEtsiQcsQcCompliance = new DerObjectIdentifier(IdEtsiQcs+".1"); 15 | public static readonly DerObjectIdentifier IdEtsiQcsLimitValue = new DerObjectIdentifier(IdEtsiQcs+".2"); 16 | public static readonly DerObjectIdentifier IdEtsiQcsRetentionPeriod = new DerObjectIdentifier(IdEtsiQcs+".3"); 17 | public static readonly DerObjectIdentifier IdEtsiQcsQcSscd = new DerObjectIdentifier(IdEtsiQcs+".4"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/X509/Qualified/RFC3739QCObjectIdentifiers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Raksha.Asn1; 4 | 5 | namespace Raksha.Asn1.X509.Qualified 6 | { 7 | public sealed class Rfc3739QCObjectIdentifiers 8 | { 9 | private Rfc3739QCObjectIdentifiers() 10 | { 11 | } 12 | 13 | // 14 | // base id 15 | // 16 | public static readonly DerObjectIdentifier IdQcs = new DerObjectIdentifier("1.3.6.1.5.5.7.11"); 17 | 18 | public static readonly DerObjectIdentifier IdQcsPkixQCSyntaxV1 = new DerObjectIdentifier(IdQcs+".1"); 19 | public static readonly DerObjectIdentifier IdQcsPkixQCSyntaxV2 = new DerObjectIdentifier(IdQcs+".2"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/X509/X509Attributes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Asn1.X509 4 | { 5 | public class X509Attributes 6 | { 7 | public static readonly DerObjectIdentifier RoleSyntax = new DerObjectIdentifier("2.5.4.72"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Asn1/X9/X9ECParametersHolder.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Asn1.X9 2 | { 3 | public abstract class X9ECParametersHolder 4 | { 5 | private X9ECParameters parameters; 6 | 7 | public X9ECParameters Parameters 8 | { 9 | get 10 | { 11 | if (parameters == null) 12 | { 13 | parameters = CreateParameters(); 14 | } 15 | 16 | return parameters; 17 | } 18 | } 19 | 20 | protected abstract X9ECParameters CreateParameters(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/BcpgObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Bcpg 5 | { 6 | /// Base class for a PGP object. 7 | public abstract class BcpgObject 8 | { 9 | public virtual byte[] GetEncoded() 10 | { 11 | MemoryStream bOut = new MemoryStream(); 12 | BcpgOutputStream pOut = new BcpgOutputStream(bOut); 13 | 14 | pOut.WriteObject(this); 15 | 16 | return bOut.ToArray(); 17 | } 18 | 19 | public abstract void Encode(BcpgOutputStream bcpgOut); 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/CompressedDataPacket.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Raksha.Bcpg 4 | { 5 | /// Generic compressed data object. 6 | public class CompressedDataPacket 7 | : InputStreamPacket 8 | { 9 | private readonly CompressionAlgorithmTag algorithm; 10 | 11 | internal CompressedDataPacket( 12 | BcpgInputStream bcpgIn) 13 | : base(bcpgIn) 14 | { 15 | this.algorithm = (CompressionAlgorithmTag) bcpgIn.ReadByte(); 16 | } 17 | 18 | /// The algorithm tag value. 19 | public CompressionAlgorithmTag Algorithm 20 | { 21 | get { return algorithm; } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/CompressionAlgorithmTags.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Bcpg 2 | { 3 | /// Basic tags for compression algorithms. 4 | public enum CompressionAlgorithmTag 5 | { 6 | Uncompressed = 0, // Uncompressed 7 | Zip = 1, // ZIP (RFC 1951) 8 | ZLib = 2, // ZLIB (RFC 1950) 9 | BZip2 = 3, // BZ2 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/ContainedPacket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Bcpg 5 | { 6 | /// Basic type for a PGP packet. 7 | public abstract class ContainedPacket 8 | : Packet 9 | { 10 | public byte[] GetEncoded() 11 | { 12 | MemoryStream bOut = new MemoryStream(); 13 | BcpgOutputStream pOut = new BcpgOutputStream(bOut); 14 | 15 | pOut.WritePacket(this); 16 | 17 | return bOut.ToArray(); 18 | } 19 | 20 | public abstract void Encode(BcpgOutputStream bcpgOut); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/ExperimentalPacket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Bcpg 5 | { 6 | /// Basic packet for an experimental packet. 7 | public class ExperimentalPacket 8 | : ContainedPacket //, PublicKeyAlgorithmTag 9 | { 10 | private readonly PacketTag tag; 11 | private readonly byte[] contents; 12 | 13 | internal ExperimentalPacket( 14 | PacketTag tag, 15 | BcpgInputStream bcpgIn) 16 | { 17 | this.tag = tag; 18 | 19 | this.contents = bcpgIn.ReadAll(); 20 | } 21 | 22 | public PacketTag Tag 23 | { 24 | get { return tag; } 25 | } 26 | 27 | public byte[] GetContents() 28 | { 29 | return (byte[]) contents.Clone(); 30 | } 31 | 32 | public override void Encode( 33 | BcpgOutputStream bcpgOut) 34 | { 35 | bcpgOut.WritePacket(tag, contents, true); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/HashAlgorithmTags.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Bcpg 2 | { 3 | /// Basic tags for hash algorithms. 4 | public enum HashAlgorithmTag 5 | { 6 | MD5 = 1, // MD5 7 | Sha1 = 2, // SHA-1 8 | RipeMD160 = 3, // RIPE-MD/160 9 | DoubleSha = 4, // Reserved for double-width SHA (experimental) 10 | MD2 = 5, // MD2 11 | Tiger192 = 6, // Reserved for TIGER/192 12 | Haval5pass160 = 7, // Reserved for HAVAL (5 pass, 160-bit) 13 | 14 | Sha256 = 8, // SHA-256 15 | Sha384 = 9, // SHA-384 16 | Sha512 = 10, // SHA-512 17 | Sha224 = 11, // SHA-224 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/IBcpgKey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Bcpg 4 | { 5 | /// Base interface for a PGP key. 6 | public interface IBcpgKey 7 | { 8 | /// 9 | /// The base format for this key - in the case of the symmetric keys it will generally 10 | /// be raw indicating that the key is just a straight byte representation, for an asymmetric 11 | /// key the format will be PGP, indicating the key is a string of MPIs encoded in PGP format. 12 | /// 13 | /// "RAW" or "PGP". 14 | string Format { get; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/InputStreamPacket.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Bcpg 2 | { 3 | public class InputStreamPacket 4 | : Packet 5 | { 6 | private readonly BcpgInputStream bcpgIn; 7 | 8 | public InputStreamPacket( 9 | BcpgInputStream bcpgIn) 10 | { 11 | this.bcpgIn = bcpgIn; 12 | } 13 | 14 | /// Note: you can only read from this once... 15 | public BcpgInputStream GetInputStream() 16 | { 17 | return bcpgIn; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/MarkerPacket.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Raksha.Bcpg 4 | { 5 | /// Basic type for a marker packet. 6 | public class MarkerPacket 7 | : ContainedPacket 8 | { 9 | // "PGP" 10 | byte[] marker = { (byte)0x50, (byte)0x47, (byte)0x50 }; 11 | 12 | public MarkerPacket( 13 | BcpgInputStream bcpgIn) 14 | { 15 | bcpgIn.ReadFully(marker); 16 | } 17 | 18 | public override void Encode( 19 | BcpgOutputStream bcpgOut) 20 | { 21 | bcpgOut.WritePacket(PacketTag.Marker, marker, true); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/OpenPgp/IStreamGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Bcpg.OpenPgp 4 | { 5 | public interface IStreamGenerator : IDisposable 6 | { 7 | void Close(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/OpenPgp/PGPObject.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Bcpg.OpenPgp 2 | { 3 | public abstract class PgpObject 4 | { 5 | internal PgpObject() 6 | { 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/OpenPgp/PgpDataValidationException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Bcpg.OpenPgp 4 | { 5 | /// 6 | /// Thrown if the IV at the start of a data stream indicates the wrong key is being used. 7 | /// 8 | public class PgpDataValidationException 9 | : PgpException 10 | { 11 | public PgpDataValidationException() : base() {} 12 | public PgpDataValidationException(string message) : base(message) {} 13 | public PgpDataValidationException(string message, Exception exception) : base(message, exception) {} 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/OpenPgp/PgpException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Bcpg.OpenPgp 4 | { 5 | /// Generic exception class for PGP encoding/decoding problems. 6 | public class PgpException 7 | : Exception 8 | { 9 | public PgpException() : base() {} 10 | public PgpException(string message) : base(message) {} 11 | public PgpException(string message, Exception exception) : base(message, exception) {} 12 | 13 | [Obsolete("Use InnerException property")] 14 | public Exception UnderlyingException 15 | { 16 | get { return InnerException; } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/OpenPgp/PgpExperimental.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Bcpg.OpenPgp 4 | { 5 | public class PgpExperimental 6 | : PgpObject 7 | { 8 | private readonly ExperimentalPacket p; 9 | 10 | public PgpExperimental( 11 | BcpgInputStream bcpgIn) 12 | { 13 | p = (ExperimentalPacket) bcpgIn.ReadPacket(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/OpenPgp/PgpKeyFlags.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Bcpg.OpenPgp 2 | { 3 | /// Key flag values for the KeyFlags subpacket. 4 | public abstract class PgpKeyFlags 5 | { 6 | public const int CanCertify = 0x01; // This key may be used to certify other keys. 7 | public const int CanSign = 0x02; // This key may be used to sign data. 8 | public const int CanEncryptCommunications = 0x04; // This key may be used to encrypt communications. 9 | public const int CanEncryptStorage = 0x08; // This key may be used to encrypt storage. 10 | public const int MaybeSplit = 0x10; // The private component of this key may have been split by a secret-sharing mechanism. 11 | public const int MaybeShared = 0x80; // The private component of this key may be in the possession of more than one person. 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/OpenPgp/PgpKeyValidationException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Bcpg.OpenPgp 4 | { 5 | /// 6 | /// Thrown if the key checksum is invalid. 7 | /// 8 | public class PgpKeyValidationException 9 | : PgpException 10 | { 11 | public PgpKeyValidationException() : base() {} 12 | public PgpKeyValidationException(string message) : base(message) {} 13 | public PgpKeyValidationException(string message, Exception exception) : base(message, exception) {} 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/OpenPgp/PgpMarker.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Bcpg.OpenPgp 2 | { 3 | /// 4 | /// A PGP marker packet - in general these should be ignored other than where 5 | /// the idea is to preserve the original input stream. 6 | /// 7 | public class PgpMarker 8 | : PgpObject 9 | { 10 | private readonly MarkerPacket p; 11 | 12 | public PgpMarker( 13 | BcpgInputStream bcpgIn) 14 | { 15 | p = (MarkerPacket) bcpgIn.ReadPacket(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/OutputStreamPacket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Bcpg 5 | { 6 | public abstract class OutputStreamPacket 7 | { 8 | private readonly BcpgOutputStream bcpgOut; 9 | 10 | internal OutputStreamPacket( 11 | BcpgOutputStream bcpgOut) 12 | { 13 | if (bcpgOut == null) 14 | throw new ArgumentNullException("bcpgOut"); 15 | 16 | this.bcpgOut = bcpgOut; 17 | } 18 | 19 | public abstract BcpgOutputStream Open(); 20 | 21 | public abstract void Close(); 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/Packet.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Bcpg 2 | { 3 | public class Packet 4 | //: PacketTag 5 | { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/PublicSubkeyPacket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | namespace Raksha.Bcpg 4 | { 5 | /// Basic packet for a PGP public subkey 6 | public class PublicSubkeyPacket 7 | : PublicKeyPacket 8 | { 9 | internal PublicSubkeyPacket( 10 | BcpgInputStream bcpgIn) 11 | : base(bcpgIn) 12 | { 13 | } 14 | 15 | /// Construct a version 4 public subkey packet. 16 | public PublicSubkeyPacket( 17 | PublicKeyAlgorithmTag algorithm, 18 | DateTime time, 19 | IBcpgKey key) 20 | : base(algorithm, time, key) 21 | { 22 | } 23 | 24 | public override void Encode( 25 | BcpgOutputStream bcpgOut) 26 | { 27 | bcpgOut.WritePacket(PacketTag.PublicSubkey, GetEncodedContents(), true); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/Sig/EmbeddedSignature.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Bcpg.Sig 4 | { 5 | /** 6 | * Packet embedded signature 7 | */ 8 | public class EmbeddedSignature 9 | : SignatureSubpacket 10 | { 11 | public EmbeddedSignature( 12 | bool critical, 13 | byte[] data) 14 | : base(SignatureSubpacketTag.EmbeddedSignature, critical, data) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/SymmetricEncDataPacket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Bcpg 4 | { 5 | /// Basic type for a symmetric key encrypted packet. 6 | public class SymmetricEncDataPacket 7 | : InputStreamPacket 8 | { 9 | public SymmetricEncDataPacket( 10 | BcpgInputStream bcpgIn) 11 | : base(bcpgIn) 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/SymmetricEncIntegrityPacket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Bcpg 5 | { 6 | public class SymmetricEncIntegrityPacket 7 | : InputStreamPacket 8 | { 9 | internal readonly int version; 10 | 11 | internal SymmetricEncIntegrityPacket( 12 | BcpgInputStream bcpgIn) 13 | : base(bcpgIn) 14 | { 15 | version = bcpgIn.ReadByte(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/SymmetricKeyAlgorithmTags.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Bcpg 2 | { 3 | /** 4 | * Basic tags for symmetric key algorithms 5 | */ 6 | public enum SymmetricKeyAlgorithmTag 7 | { 8 | Null = 0, // Plaintext or unencrypted data 9 | Idea = 1, // IDEA [IDEA] 10 | TripleDes = 2, // Triple-DES (DES-EDE, as per spec -168 bit key derived from 192) 11 | Cast5 = 3, // Cast5 (128 bit key, as per RFC 2144) 12 | Blowfish = 4, // Blowfish (128 bit key, 16 rounds) [Blowfish] 13 | Safer = 5, // Safer-SK128 (13 rounds) [Safer] 14 | Des = 6, // Reserved for DES/SK 15 | Aes128 = 7, // Reserved for AES with 128-bit key 16 | Aes192 = 8, // Reserved for AES with 192-bit key 17 | Aes256 = 9, // Reserved for AES with 256-bit key 18 | Twofish = 10 // Reserved for Twofish 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/UserAttributeSubpacketTags.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Bcpg 2 | { 3 | /** 4 | * Basic PGP user attribute sub-packet tag types. 5 | */ 6 | public enum UserAttributeSubpacketTag 7 | { 8 | ImageAttribute = 1 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Bcpg/UserIdPacket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | 4 | namespace Raksha.Bcpg 5 | { 6 | /** 7 | * Basic type for a user ID packet. 8 | */ 9 | public class UserIdPacket 10 | : ContainedPacket 11 | { 12 | private readonly byte[] idData; 13 | 14 | public UserIdPacket( 15 | BcpgInputStream bcpgIn) 16 | { 17 | this.idData = bcpgIn.ReadAll(); 18 | } 19 | 20 | public UserIdPacket( 21 | string id) 22 | { 23 | this.idData = Encoding.UTF8.GetBytes(id); 24 | } 25 | 26 | public string GetId() 27 | { 28 | return Encoding.UTF8.GetString(idData, 0, idData.Length); 29 | } 30 | 31 | public override void Encode( 32 | BcpgOutputStream bcpgOut) 33 | { 34 | bcpgOut.WritePacket(PacketTag.UserId, idData, true); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/BaseDigestCalculator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Utilities; 3 | 4 | namespace Raksha.Cms 5 | { 6 | internal class BaseDigestCalculator 7 | : IDigestCalculator 8 | { 9 | private readonly byte[] digest; 10 | 11 | internal BaseDigestCalculator( 12 | byte[] digest) 13 | { 14 | this.digest = digest; 15 | } 16 | 17 | public byte[] GetDigest() 18 | { 19 | return Arrays.Clone(digest); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/CMSAttributeTableGenerationException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Cms 4 | { 5 | public class CmsAttributeTableGenerationException 6 | : CmsException 7 | { 8 | public CmsAttributeTableGenerationException() 9 | { 10 | } 11 | 12 | public CmsAttributeTableGenerationException( 13 | string name) 14 | : base(name) 15 | { 16 | } 17 | 18 | public CmsAttributeTableGenerationException( 19 | string name, 20 | Exception e) 21 | : base(name, e) 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/CMSAttributeTableGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using Raksha.Asn1.Cms; 4 | 5 | namespace Raksha.Cms 6 | { 7 | /// 8 | /// The 'Signature' parameter is only available when generating unsigned attributes. 9 | /// 10 | public enum CmsAttributeTableParameter 11 | { 12 | // const string ContentType = "contentType"; 13 | // const string Digest = "digest"; 14 | // const string Signature = "encryptedDigest"; 15 | // const string DigestAlgorithmIdentifier = "digestAlgID"; 16 | 17 | ContentType, Digest, Signature, DigestAlgorithmIdentifier 18 | } 19 | 20 | public interface CmsAttributeTableGenerator 21 | { 22 | AttributeTable GetAttributes(IDictionary parameters); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/CMSAuthEnvelopedGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Asn1.Nist; 3 | 4 | namespace Raksha.Cms 5 | { 6 | internal class CmsAuthEnvelopedGenerator 7 | { 8 | public static readonly string Aes128Ccm = NistObjectIdentifiers.IdAes128Ccm.Id; 9 | public static readonly string Aes192Ccm = NistObjectIdentifiers.IdAes192Ccm.Id; 10 | public static readonly string Aes256Ccm = NistObjectIdentifiers.IdAes256Ccm.Id; 11 | public static readonly string Aes128Gcm = NistObjectIdentifiers.IdAes128Gcm.Id; 12 | public static readonly string Aes192Gcm = NistObjectIdentifiers.IdAes192Gcm.Id; 13 | public static readonly string Aes256Gcm = NistObjectIdentifiers.IdAes256Gcm.Id; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/CMSAuthenticatedGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | using Raksha.Asn1; 5 | using Raksha.Asn1.X509; 6 | using Raksha.Crypto; 7 | using Raksha.Crypto.Parameters; 8 | using Raksha.Utilities.Date; 9 | using Raksha.Utilities.IO; 10 | using Raksha.Security; 11 | 12 | namespace Raksha.Cms 13 | { 14 | public class CmsAuthenticatedGenerator 15 | : CmsEnvelopedGenerator 16 | { 17 | /** 18 | * base constructor 19 | */ 20 | public CmsAuthenticatedGenerator() 21 | { 22 | } 23 | 24 | /** 25 | * constructor allowing specific source of randomness 26 | * 27 | * @param rand instance of SecureRandom to use 28 | */ 29 | public CmsAuthenticatedGenerator( 30 | SecureRandom rand) 31 | : base(rand) 32 | { 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/CMSException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Cms 4 | { 5 | public class CmsException 6 | : Exception 7 | { 8 | public CmsException() 9 | { 10 | } 11 | 12 | public CmsException( 13 | string msg) 14 | : base(msg) 15 | { 16 | } 17 | 18 | public CmsException( 19 | string msg, 20 | Exception e) 21 | : base(msg, e) 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/CMSProcessable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Cms 5 | { 6 | public interface CmsProcessable 7 | { 8 | /// 9 | /// Generic routine to copy out the data we want processed. 10 | /// 11 | /// 12 | /// This routine may be called multiple times. 13 | /// 14 | void Write(Stream outStream); 15 | 16 | object GetContent(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/CMSProcessableByteArray.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Cms 5 | { 6 | /** 7 | * a holding class for a byte array of data to be processed. 8 | */ 9 | public class CmsProcessableByteArray 10 | : CmsProcessable, ICmsReadable 11 | { 12 | private readonly byte[] bytes; 13 | 14 | public CmsProcessableByteArray( 15 | byte[] bytes) 16 | { 17 | this.bytes = bytes; 18 | } 19 | 20 | public Stream GetInputStream() 21 | { 22 | return new MemoryStream(bytes, false); 23 | } 24 | 25 | public virtual void Write(Stream zOut) 26 | { 27 | zOut.Write(bytes, 0, bytes.Length); 28 | } 29 | 30 | /// A clone of the byte array 31 | public virtual object GetContent() 32 | { 33 | return bytes.Clone(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/CMSReadable.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014 Alexander Logger. 4 | // Copyright (c) 2000 - 2013 The Legion of the Bouncy Castle Inc. (http://www.bouncycastle.org). 5 | // 6 | // -------------------------------------------------------------------------------------------------------------------- 7 | 8 | using System.IO; 9 | 10 | namespace Raksha.Cms 11 | { 12 | internal interface ICmsReadable 13 | { 14 | Stream GetInputStream(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/CMSSecureReadable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Asn1.X509; 3 | using Raksha.Crypto.Parameters; 4 | 5 | namespace Raksha.Cms 6 | { 7 | internal interface CmsSecureReadable 8 | { 9 | AlgorithmIdentifier Algorithm { get; } 10 | object CryptoObject { get; } 11 | ICmsReadable GetReadable(KeyParameter key); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/CMSStreamException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Cms 5 | { 6 | public class CmsStreamException 7 | : IOException 8 | { 9 | public CmsStreamException() 10 | { 11 | } 12 | 13 | public CmsStreamException( 14 | string name) 15 | : base(name) 16 | { 17 | } 18 | 19 | public CmsStreamException( 20 | string name, 21 | Exception e) 22 | : base(name, e) 23 | { 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/CounterSignatureDigestCalculator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Crypto; 3 | using Raksha.Security; 4 | 5 | namespace Raksha.Cms 6 | { 7 | internal class CounterSignatureDigestCalculator 8 | : IDigestCalculator 9 | { 10 | private readonly string alg; 11 | private readonly byte[] data; 12 | 13 | internal CounterSignatureDigestCalculator( 14 | string alg, 15 | byte[] data) 16 | { 17 | this.alg = alg; 18 | this.data = data; 19 | } 20 | 21 | public byte[] GetDigest() 22 | { 23 | IDigest digest = CmsSignedHelper.Instance.GetDigestInstance(alg); 24 | return DigestUtilities.DoFinal(digest, data); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/DigOutputStream.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Crypto; 3 | using Raksha.Utilities.IO; 4 | 5 | namespace Raksha.Cms 6 | { 7 | internal class DigOutputStream 8 | : BaseOutputStream 9 | { 10 | private readonly IDigest dig; 11 | 12 | internal DigOutputStream(IDigest dig) 13 | { 14 | this.dig = dig; 15 | } 16 | 17 | public override void WriteByte(byte b) 18 | { 19 | dig.Update(b); 20 | } 21 | 22 | public override void Write(byte[] b, int off, int len) 23 | { 24 | dig.BlockUpdate(b, off, len); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/IDigestCalculator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Cms 4 | { 5 | internal interface IDigestCalculator 6 | { 7 | byte[] GetDigest(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/MacOutputStream.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Crypto; 3 | using Raksha.Utilities.IO; 4 | 5 | namespace Raksha.Cms 6 | { 7 | internal class MacOutputStream 8 | : BaseOutputStream 9 | { 10 | private readonly IMac mac; 11 | 12 | internal MacOutputStream(IMac mac) 13 | { 14 | this.mac = mac; 15 | } 16 | 17 | public override void Write(byte[] b, int off, int len) 18 | { 19 | mac.BlockUpdate(b, off, len); 20 | } 21 | 22 | public override void WriteByte(byte b) 23 | { 24 | mac.Update(b); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/NullOutputStream.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Utilities.IO; 3 | 4 | namespace Raksha.Cms 5 | { 6 | internal class NullOutputStream 7 | : BaseOutputStream 8 | { 9 | public override void WriteByte(byte b) 10 | { 11 | // do nothing 12 | } 13 | 14 | public override void Write(byte[] buffer, int offset, int count) 15 | { 16 | // do nothing 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/RecipientInfoGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Asn1.Cms; 3 | using Raksha.Crypto.Parameters; 4 | using Raksha.Security; 5 | 6 | namespace Raksha.Cms 7 | { 8 | interface RecipientInfoGenerator 9 | { 10 | /// 11 | /// Generate a RecipientInfo object for the given key. 12 | /// 13 | /// 14 | /// A 15 | /// 16 | /// 17 | /// A 18 | /// 19 | /// 20 | /// A 21 | /// 22 | /// 23 | RecipientInfo Generate(KeyParameter contentEncryptionKey, SecureRandom random); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/SigOutputStream.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Crypto; 3 | using Raksha.Security; 4 | using Raksha.Utilities.IO; 5 | 6 | namespace Raksha.Cms 7 | { 8 | internal class SigOutputStream 9 | : BaseOutputStream 10 | { 11 | private readonly ISigner sig; 12 | 13 | internal SigOutputStream(ISigner sig) 14 | { 15 | this.sig = sig; 16 | } 17 | 18 | public override void WriteByte(byte b) 19 | { 20 | try 21 | { 22 | sig.Update(b); 23 | } 24 | catch (SignatureException e) 25 | { 26 | throw new CmsStreamException("signature problem: " + e); 27 | } 28 | } 29 | 30 | public override void Write(byte[] b, int off, int len) 31 | { 32 | try 33 | { 34 | sig.BlockUpdate(b, off, len); 35 | } 36 | catch (SignatureException e) 37 | { 38 | throw new CmsStreamException("signature problem: " + e); 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/SignerInfoGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Asn1; 3 | using Raksha.Asn1.Cms; 4 | using Raksha.Asn1.X509; 5 | 6 | namespace Raksha.Cms 7 | { 8 | internal interface SignerInfoGenerator 9 | { 10 | SignerInfo Generate(DerObjectIdentifier contentType, AlgorithmIdentifier digestAlgorithm, 11 | byte[] calculatedDigest); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Cms/SimpleAttributeTableGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using Raksha.Asn1.Cms; 4 | 5 | namespace Raksha.Cms 6 | { 7 | /** 8 | * Basic generator that just returns a preconstructed attribute table 9 | */ 10 | public class SimpleAttributeTableGenerator 11 | : CmsAttributeTableGenerator 12 | { 13 | private readonly AttributeTable attributes; 14 | 15 | public SimpleAttributeTableGenerator( 16 | AttributeTable attributes) 17 | { 18 | this.attributes = attributes; 19 | } 20 | 21 | public virtual AttributeTable GetAttributes( 22 | IDictionary parameters) 23 | { 24 | return attributes; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/CryptoException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto 4 | { 5 | public class CryptoException 6 | : Exception 7 | { 8 | public CryptoException() 9 | { 10 | } 11 | 12 | public CryptoException( 13 | string message) 14 | : base(message) 15 | { 16 | } 17 | 18 | public CryptoException( 19 | string message, 20 | Exception exception) 21 | : base(message, exception) 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Engines/AesWrapEngine.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Crypto.Engines 2 | { 3 | /// 4 | /// An implementation of the AES Key Wrapper from the NIST Key Wrap Specification. 5 | ///

6 | /// For further details see: http://csrc.nist.gov/encryption/kms/key-wrap.pdf. 7 | /// 8 | public class AesWrapEngine 9 | : Rfc3394WrapEngine 10 | { 11 | public AesWrapEngine() 12 | : base(new AesEngine()) 13 | { 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Engines/CamelliaWrapEngine.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Crypto.Engines 2 | { 3 | /// 4 | /// An implementation of the Camellia key wrapper based on RFC 3657/RFC 3394. 5 | ///

6 | /// For further details see: http://www.ietf.org/rfc/rfc3657.txt. 7 | /// 8 | public class CamelliaWrapEngine 9 | : Rfc3394WrapEngine 10 | { 11 | public CamelliaWrapEngine() 12 | : base(new CamelliaEngine()) 13 | { 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Engines/SEEDWrapEngine.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Crypto.Engines 2 | { 3 | /// 4 | /// An implementation of the SEED key wrapper based on RFC 4010/RFC 3394. 5 | ///

6 | /// For further details see: http://www.ietf.org/rfc/rfc4010.txt. 7 | /// 8 | public class SeedWrapEngine 9 | : Rfc3394WrapEngine 10 | { 11 | public SeedWrapEngine() 12 | : base(new SeedEngine()) 13 | { 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Generators/Kdf1BytesGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Raksha.Crypto; 4 | using Raksha.Crypto.Parameters; 5 | 6 | namespace Raksha.Crypto.Generators 7 | { 8 | /** 9 | * KFD2 generator for derived keys and ivs as defined by IEEE P1363a/ISO 18033 10 | *
11 | * This implementation is based on IEEE P1363/ISO 18033. 12 | */ 13 | public class Kdf1BytesGenerator 14 | : BaseKdfBytesGenerator 15 | { 16 | /** 17 | * Construct a KDF1 byte generator. 18 | * 19 | * @param digest the digest to be used as the source of derived keys. 20 | */ 21 | public Kdf1BytesGenerator( 22 | IDigest digest) 23 | : base(0, digest) 24 | { 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Generators/Kdf2BytesGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Raksha.Crypto; 4 | using Raksha.Crypto.Parameters; 5 | 6 | namespace Raksha.Crypto.Generators 7 | { 8 | /** 9 | * KFD2 generator for derived keys and ivs as defined by IEEE P1363a/ISO 18033 10 | *
11 | * This implementation is based on IEEE P1363/ISO 18033. 12 | */ 13 | public class Kdf2BytesGenerator 14 | : BaseKdfBytesGenerator 15 | { 16 | /** 17 | * Construct a KDF2 bytes generator. Generates key material 18 | * according to IEEE P1363 or ISO 18033 depending on the initialisation. 19 | * 20 | * @param digest the digest to be used as the source of derived keys. 21 | */ 22 | public Kdf2BytesGenerator( 23 | IDigest digest) 24 | : base(1, digest) 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/IAsymmetricCipherKeyPairGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto 4 | { 5 | /** 6 | * interface that a public/private key pair generator should conform to. 7 | */ 8 | public interface IAsymmetricCipherKeyPairGenerator 9 | { 10 | /** 11 | * intialise the key pair generator. 12 | * 13 | * @param the parameters the key pair is to be initialised with. 14 | */ 15 | void Init(KeyGenerationParameters parameters); 16 | 17 | /** 18 | * return an AsymmetricCipherKeyPair containing the Generated keys. 19 | * 20 | * @return an AsymmetricCipherKeyPair containing the Generated keys. 21 | */ 22 | AsymmetricCipherKeyPair GenerateKeyPair(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/IBasicAgreement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using BigMath; 3 | using Raksha.Math; 4 | 5 | namespace Raksha.Crypto 6 | { 7 | /** 8 | * The basic interface that basic Diffie-Hellman implementations 9 | * conforms to. 10 | */ 11 | public interface IBasicAgreement 12 | { 13 | /** 14 | * initialise the agreement engine. 15 | */ 16 | void Init(ICipherParameters parameters); 17 | 18 | /** 19 | * given a public key from a given party calculate the next 20 | * message in the agreement sequence. 21 | */ 22 | BigInteger CalculateAgreement(ICipherParameters pubKey); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/ICipherParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto 4 | { 5 | /** 6 | * all parameter classes implement this. 7 | */ 8 | public interface ICipherParameters 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/IDerivationFunction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto 4 | { 5 | /** 6 | * base interface for general purpose byte derivation functions. 7 | */ 8 | public interface IDerivationFunction 9 | { 10 | void Init(IDerivationParameters parameters); 11 | 12 | /** 13 | * return the message digest used as the basis for the function 14 | */ 15 | IDigest Digest 16 | { 17 | get; 18 | } 19 | 20 | int GenerateBytes(byte[] output, int outOff, int length); 21 | //throws DataLengthException, ArgumentException; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/IDerivationParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto 4 | { 5 | /** 6 | * Parameters for key/byte stream derivation classes 7 | */ 8 | public interface IDerivationParameters 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/IWrapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Raksha.Security; 4 | 5 | namespace Raksha.Crypto 6 | { 7 | public interface IWrapper 8 | { 9 | ///

The name of the algorithm this cipher implements. 10 | string AlgorithmName { get; } 11 | 12 | void Init(bool forWrapping, ICipherParameters parameters); 13 | 14 | byte[] Wrap(byte[] input, int inOff, int length); 15 | 16 | byte[] Unwrap(byte[] input, int inOff, int length); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/InvalidCipherTextException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto 4 | { 5 | /** 6 | * this exception is thrown whenever we find something we don't expect in a 7 | * message. 8 | */ 9 | public class InvalidCipherTextException 10 | : CryptoException 11 | { 12 | /** 13 | * base constructor. 14 | */ 15 | public InvalidCipherTextException() 16 | { 17 | } 18 | 19 | /** 20 | * create a InvalidCipherTextException with the given message. 21 | * 22 | * @param message the message to be carried with the exception. 23 | */ 24 | public InvalidCipherTextException( 25 | string message) 26 | : base(message) 27 | { 28 | } 29 | 30 | public InvalidCipherTextException( 31 | string message, 32 | Exception exception) 33 | : base(message, exception) 34 | { 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/MaxBytesExceededException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto 4 | { 5 | /// 6 | /// This exception is thrown whenever a cipher requires a change of key, iv 7 | /// or similar after x amount of bytes enciphered 8 | /// 9 | public class MaxBytesExceededException 10 | : CryptoException 11 | { 12 | public MaxBytesExceededException() 13 | { 14 | } 15 | 16 | public MaxBytesExceededException( 17 | string message) 18 | : base(message) 19 | { 20 | } 21 | 22 | public MaxBytesExceededException( 23 | string message, 24 | Exception e) 25 | : base(message, e) 26 | { 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Modes/Gcm/BasicGcmExponentiator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Utilities; 3 | 4 | namespace Raksha.Crypto.Modes.Gcm 5 | { 6 | public class BasicGcmExponentiator 7 | : IGcmExponentiator 8 | { 9 | private byte[] x; 10 | 11 | public void Init(byte[] x) 12 | { 13 | this.x = Arrays.Clone(x); 14 | } 15 | 16 | public void ExponentiateX(long pow, byte[] output) 17 | { 18 | // Initial value is little-endian 1 19 | byte[] y = GcmUtilities.OneAsBytes(); 20 | 21 | if (pow > 0) 22 | { 23 | byte[] powX = Arrays.Clone(x); 24 | do 25 | { 26 | if ((pow & 1L) != 0) 27 | { 28 | GcmUtilities.Multiply(y, powX); 29 | } 30 | GcmUtilities.Multiply(powX, powX); 31 | pow >>= 1; 32 | } 33 | while (pow > 0); 34 | } 35 | 36 | Array.Copy(y, 0, output, 0, 16); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Modes/Gcm/BasicGcmMultiplier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto.Modes.Gcm 4 | { 5 | public class BasicGcmMultiplier 6 | : IGcmMultiplier 7 | { 8 | private byte[] H; 9 | 10 | public void Init(byte[] H) 11 | { 12 | this.H = (byte[])H.Clone(); 13 | } 14 | 15 | public void MultiplyH(byte[] x) 16 | { 17 | GcmUtilities.Multiply(x, H); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Modes/Gcm/IGcmExponentiator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto.Modes.Gcm 4 | { 5 | public interface IGcmExponentiator 6 | { 7 | void Init(byte[] x); 8 | void ExponentiateX(long pow, byte[] output); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Modes/Gcm/IGcmMultiplier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto.Modes.Gcm 4 | { 5 | public interface IGcmMultiplier 6 | { 7 | void Init(byte[] H); 8 | void MultiplyH(byte[] x); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Parameters/CcmParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto.Parameters 4 | { 5 | public class CcmParameters 6 | : AeadParameters 7 | { 8 | /** 9 | * Base constructor. 10 | * 11 | * @param key key to be used by underlying cipher 12 | * @param macSize macSize in bits 13 | * @param nonce nonce to be used 14 | * @param associatedText associated text, if any 15 | */ 16 | public CcmParameters( 17 | KeyParameter key, 18 | int macSize, 19 | byte[] nonce, 20 | byte[] associatedText) 21 | : base(key, macSize, nonce, associatedText) 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Parameters/DHKeyGenerationParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Security; 3 | 4 | namespace Raksha.Crypto.Parameters 5 | { 6 | public class DHKeyGenerationParameters 7 | : KeyGenerationParameters 8 | { 9 | private readonly DHParameters parameters; 10 | 11 | public DHKeyGenerationParameters( 12 | SecureRandom random, 13 | DHParameters parameters) 14 | : base(random, GetStrength(parameters)) 15 | { 16 | this.parameters = parameters; 17 | } 18 | 19 | public DHParameters Parameters 20 | { 21 | get { return parameters; } 22 | } 23 | 24 | internal static int GetStrength( 25 | DHParameters parameters) 26 | { 27 | return parameters.L != 0 ? parameters.L : parameters.P.BitLength; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Parameters/DsaKeyGenerationParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Security; 3 | 4 | namespace Raksha.Crypto.Parameters 5 | { 6 | public class DsaKeyGenerationParameters 7 | : KeyGenerationParameters 8 | { 9 | private readonly DsaParameters parameters; 10 | 11 | public DsaKeyGenerationParameters( 12 | SecureRandom random, 13 | DsaParameters parameters) 14 | : base(random, parameters.P.BitLength - 1) 15 | { 16 | this.parameters = parameters; 17 | } 18 | 19 | public DsaParameters Parameters 20 | { 21 | get { return parameters; } 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Parameters/ElGamalKeyGenerationParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Security; 3 | 4 | namespace Raksha.Crypto.Parameters 5 | { 6 | public class ElGamalKeyGenerationParameters 7 | : KeyGenerationParameters 8 | { 9 | private readonly ElGamalParameters parameters; 10 | 11 | public ElGamalKeyGenerationParameters( 12 | SecureRandom random, 13 | ElGamalParameters parameters) 14 | : base(random, GetStrength(parameters)) 15 | { 16 | this.parameters = parameters; 17 | } 18 | 19 | public ElGamalParameters Parameters 20 | { 21 | get { return parameters; } 22 | } 23 | 24 | internal static int GetStrength( 25 | ElGamalParameters parameters) 26 | { 27 | return parameters.L != 0 ? parameters.L : parameters.P.BitLength; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Parameters/ISO18033KDFParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Crypto; 3 | 4 | namespace Raksha.Crypto.Parameters 5 | { 6 | /** 7 | * parameters for Key derivation functions for ISO-18033 8 | */ 9 | public class Iso18033KdfParameters 10 | : IDerivationParameters 11 | { 12 | byte[] seed; 13 | 14 | public Iso18033KdfParameters( 15 | byte[] seed) 16 | { 17 | this.seed = seed; 18 | } 19 | 20 | public byte[] GetSeed() 21 | { 22 | return seed; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Parameters/KdfParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Crypto; 3 | 4 | namespace Raksha.Crypto.Parameters 5 | { 6 | /** 7 | * parameters for Key derivation functions for IEEE P1363a 8 | */ 9 | public class KdfParameters : IDerivationParameters 10 | { 11 | byte[] iv; 12 | byte[] shared; 13 | 14 | public KdfParameters( 15 | byte[] shared, 16 | byte[] iv) 17 | { 18 | this.shared = shared; 19 | this.iv = iv; 20 | } 21 | 22 | public byte[] GetSharedSecret() 23 | { 24 | return shared; 25 | } 26 | 27 | public byte[] GetIV() 28 | { 29 | return iv; 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Parameters/MgfParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto.Parameters 4 | { 5 | /// Parameters for mask derivation functions. 6 | public class MgfParameters 7 | : IDerivationParameters 8 | { 9 | private readonly byte[] seed; 10 | 11 | public MgfParameters( 12 | byte[] seed) 13 | : this(seed, 0, seed.Length) 14 | { 15 | } 16 | 17 | public MgfParameters( 18 | byte[] seed, 19 | int off, 20 | int len) 21 | { 22 | this.seed = new byte[len]; 23 | Array.Copy(seed, off, this.seed, 0, len); 24 | } 25 | 26 | public byte[] GetSeed() 27 | { 28 | return (byte[]) seed.Clone(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Parameters/MqvPublicParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto.Parameters 4 | { 5 | public class MqvPublicParameters 6 | : ICipherParameters 7 | { 8 | private readonly ECPublicKeyParameters staticPublicKey; 9 | private readonly ECPublicKeyParameters ephemeralPublicKey; 10 | 11 | public MqvPublicParameters( 12 | ECPublicKeyParameters staticPublicKey, 13 | ECPublicKeyParameters ephemeralPublicKey) 14 | { 15 | this.staticPublicKey = staticPublicKey; 16 | this.ephemeralPublicKey = ephemeralPublicKey; 17 | } 18 | 19 | public ECPublicKeyParameters StaticPublicKey 20 | { 21 | get { return staticPublicKey; } 22 | } 23 | 24 | public ECPublicKeyParameters EphemeralPublicKey 25 | { 26 | get { return ephemeralPublicKey; } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Parameters/ParametersWithSBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Raksha.Crypto; 4 | 5 | namespace Raksha.Crypto.Parameters 6 | { 7 | public class ParametersWithSBox : ICipherParameters 8 | { 9 | private ICipherParameters parameters; 10 | private byte[] sBox; 11 | 12 | public ParametersWithSBox( 13 | ICipherParameters parameters, 14 | byte[] sBox) 15 | { 16 | this.parameters = parameters; 17 | this.sBox = sBox; 18 | } 19 | 20 | public byte[] GetSBox() { return sBox; } 21 | 22 | public ICipherParameters Parameters { get { return parameters; } } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Parameters/RC2Parameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto.Parameters 4 | { 5 | public class RC2Parameters 6 | : KeyParameter 7 | { 8 | private readonly int bits; 9 | 10 | public RC2Parameters( 11 | byte[] key) 12 | : this(key, (key.Length > 128) ? 1024 : (key.Length * 8)) 13 | { 14 | } 15 | 16 | public RC2Parameters( 17 | byte[] key, 18 | int keyOff, 19 | int keyLen) 20 | : this(key, keyOff, keyLen, (keyLen > 128) ? 1024 : (keyLen * 8)) 21 | { 22 | } 23 | 24 | public RC2Parameters( 25 | byte[] key, 26 | int bits) 27 | : base(key) 28 | { 29 | this.bits = bits; 30 | } 31 | 32 | public RC2Parameters( 33 | byte[] key, 34 | int keyOff, 35 | int keyLen, 36 | int bits) 37 | : base(key, keyOff, keyLen) 38 | { 39 | this.bits = bits; 40 | } 41 | 42 | public int EffectiveKeyBits 43 | { 44 | get { return bits; } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Parameters/RC5Parameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Crypto; 3 | 4 | namespace Raksha.Crypto.Parameters 5 | { 6 | public class RC5Parameters 7 | : KeyParameter 8 | { 9 | private readonly int rounds; 10 | 11 | public RC5Parameters( 12 | byte[] key, 13 | int rounds) 14 | : base(key) 15 | { 16 | if (key.Length > 255) 17 | throw new ArgumentException("RC5 key length can be no greater than 255"); 18 | 19 | this.rounds = rounds; 20 | } 21 | 22 | public int Rounds 23 | { 24 | get { return rounds; } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Parameters/RSABlindingParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using BigMath; 3 | using Raksha.Math; 4 | 5 | namespace Raksha.Crypto.Parameters 6 | { 7 | public class RsaBlindingParameters 8 | : ICipherParameters 9 | { 10 | private readonly RsaKeyParameters publicKey; 11 | private readonly BigInteger blindingFactor; 12 | 13 | public RsaBlindingParameters( 14 | RsaKeyParameters publicKey, 15 | BigInteger blindingFactor) 16 | { 17 | if (publicKey.IsPrivate) 18 | throw new ArgumentException("RSA parameters should be for a public key"); 19 | 20 | this.publicKey = publicKey; 21 | this.blindingFactor = blindingFactor; 22 | } 23 | 24 | public RsaKeyParameters PublicKey 25 | { 26 | get { return publicKey; } 27 | } 28 | 29 | public BigInteger BlindingFactor 30 | { 31 | get { return blindingFactor; } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/AlertLevel.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Crypto.Tls 2 | { 3 | /// 4 | /// RFC 2246 7.2 5 | /// 6 | public enum AlertLevel : byte 7 | { 8 | warning = 1, 9 | fatal = 2, 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/AlwaysValidVerifyer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Asn1.X509; 3 | 4 | namespace Raksha.Crypto.Tls 5 | { 6 | /// 7 | /// A certificate verifyer, that will always return true. 8 | ///
 9 | 	/// DO NOT USE THIS FILE UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING.
10 | 	/// 
11 | ///
12 | [Obsolete("Perform certificate verification in TlsAuthentication implementation")] 13 | public class AlwaysValidVerifyer 14 | : ICertificateVerifyer 15 | { 16 | /// Return true. 17 | public bool IsValid( 18 | X509CertificateStructure[] certs) 19 | { 20 | return true; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/CertificateRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | 4 | namespace Raksha.Crypto.Tls 5 | { 6 | public class CertificateRequest 7 | { 8 | private ClientCertificateType[] certificateTypes; 9 | private IList certificateAuthorities; 10 | 11 | public CertificateRequest(ClientCertificateType[] certificateTypes, IList certificateAuthorities) 12 | { 13 | this.certificateTypes = certificateTypes; 14 | this.certificateAuthorities = certificateAuthorities; 15 | } 16 | 17 | public ClientCertificateType[] CertificateTypes 18 | { 19 | get { return certificateTypes; } 20 | } 21 | 22 | /// A of X509Name 23 | public IList CertificateAuthorities 24 | { 25 | get { return certificateAuthorities; } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/ClientCertificateType.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Crypto.Tls 2 | { 3 | /// 4 | /// RFC 2246 7.4.4 5 | /// 6 | public enum ClientCertificateType : byte 7 | { 8 | rsa_sign = 1, 9 | dss_sign = 2, 10 | rsa_fixed_dh = 3, 11 | dss_fixed_dh = 4, 12 | 13 | /* 14 | * RFC 4492 5.5 15 | */ 16 | ecdsa_sign = 64, 17 | rsa_fixed_ecdh = 65, 18 | ecdsa_fixed_ecdh = 66, 19 | } 20 | } -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/CompressionMethod.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Crypto.Tls 2 | { 3 | /// 4 | /// RFC 2246 6.1 5 | /// 6 | public enum CompressionMethod : byte 7 | { 8 | NULL = 0, 9 | 10 | /* 11 | * RFC 3749 2 12 | */ 13 | DEFLATE = 1 14 | 15 | /* 16 | * Values from 224 decimal (0xE0) through 255 decimal (0xFF) 17 | * inclusive are reserved for private use. 18 | */ 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/ContentType.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Crypto.Tls 2 | { 3 | /// 4 | /// RFC 2246 6.2.1 5 | /// 6 | public enum ContentType : byte 7 | { 8 | change_cipher_spec = 20, 9 | alert = 21, 10 | handshake = 22, 11 | application_data = 23, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/DigestAlgorithm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto.Tls 4 | { 5 | public enum DigestAlgorithm 6 | { 7 | /* 8 | * Note that the values here are implementation-specific and arbitrary. 9 | * It is recommended not to depend on the particular values (e.g. serialization). 10 | */ 11 | NULL, 12 | MD5, 13 | SHA, 14 | 15 | /* 16 | * RFC 5289 17 | */ 18 | SHA256, 19 | SHA384, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/ECCurveType.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Crypto.Tls 2 | { 3 | /// 4 | /// RFC 4492 5.4 5 | /// 6 | public enum ECCurveType : byte 7 | { 8 | /** 9 | * Indicates the elliptic curve domain parameters are conveyed verbosely, and the 10 | * underlying finite field is a prime field. 11 | */ 12 | explicit_prime = 1, 13 | 14 | /** 15 | * Indicates the elliptic curve domain parameters are conveyed verbosely, and the 16 | * underlying finite field is a characteristic-2 field. 17 | */ 18 | explicit_char2 = 2, 19 | 20 | /** 21 | * Indicates that a named curve is used. This option SHOULD be used when applicable. 22 | */ 23 | named_curve = 3, 24 | 25 | /* 26 | * Values 248 through 255 are reserved for private use. 27 | */ 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/ECPointFormat.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Crypto.Tls 2 | { 3 | /// 4 | /// RFC 4492 5.1.2 5 | /// 6 | public enum ECPointFormat : byte 7 | { 8 | uncompressed = 0, 9 | ansiX962_compressed_prime = 1, 10 | ansiX962_compressed_char2 = 2, 11 | 12 | /* 13 | * reserved (248..255) 14 | */ 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/EncryptionAlgorithm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto.Tls 4 | { 5 | public enum EncryptionAlgorithm 6 | { 7 | /* 8 | * Note that the values here are implementation-specific and arbitrary. 9 | * It is recommended not to depend on the particular values (e.g. serialization). 10 | */ 11 | NULL, 12 | RC4_40, 13 | RC4_128, 14 | RC2_CBC_40, 15 | IDEA_CBC, 16 | DES40_CBC, 17 | DES_CBC, 18 | cls_3DES_EDE_CBC, 19 | 20 | /* 21 | * RFC 3268 22 | */ 23 | AES_128_CBC, 24 | AES_256_CBC, 25 | 26 | /* 27 | * RFC 5289 28 | */ 29 | AES_128_GCM, 30 | AES_256_GCM, 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/ExtensionType.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Crypto.Tls 2 | { 3 | /// 4 | /// RFC 4366 2.3 5 | /// 6 | public enum ExtensionType : int 7 | { 8 | server_name = 0, 9 | max_fragment_length = 1, 10 | client_certificate_url = 2, 11 | trusted_ca_keys = 3, 12 | truncated_hmac = 4, 13 | status_request = 5, 14 | 15 | /* 16 | * RFC 4492 17 | */ 18 | elliptic_curves = 10, 19 | ec_point_formats = 11, 20 | 21 | /* 22 | * RFC 5054 2.8.1 23 | */ 24 | srp = 12, 25 | 26 | /* 27 | * RFC 5746 6 28 | */ 29 | renegotiation_info = 0xff01, 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/HandshakeType.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Crypto.Tls 2 | { 3 | /// 4 | /// RFC 2246 7.4 5 | /// 6 | public enum HandshakeType : byte 7 | { 8 | hello_request = 0, 9 | client_hello = 1, 10 | server_hello = 2, 11 | certificate = 11, 12 | server_key_exchange = 12, 13 | certificate_request = 13, 14 | server_hello_done = 14, 15 | certificate_verify = 15, 16 | client_key_exchange = 16, 17 | finished = 20, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/ICertificateVerifyer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Asn1.X509; 3 | 4 | namespace Raksha.Crypto.Tls 5 | { 6 | /// 7 | /// This should be implemented by any class which can find out, if a given 8 | /// certificate chain is being accepted by an client. 9 | /// 10 | [Obsolete("Perform certificate verification in TlsAuthentication implementation")] 11 | public interface ICertificateVerifyer 12 | { 13 | /// The certs, which are part of the chain. 14 | /// True, if the chain is accepted, false otherwise 15 | bool IsValid(X509CertificateStructure[] certs); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/KeyExchangeAlgorithm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto.Tls 4 | { 5 | public enum KeyExchangeAlgorithm 6 | { 7 | /* 8 | * Note that the values here are implementation-specific and arbitrary. 9 | * It is recommended not to depend on the particular values (e.g. serialization). 10 | */ 11 | NULL, 12 | RSA, 13 | RSA_EXPORT, 14 | DHE_DSS, 15 | DHE_DSS_EXPORT, 16 | DHE_RSA, 17 | DHE_RSA_EXPORT, 18 | DH_DSS, 19 | DH_DSS_EXPORT, 20 | DH_RSA, 21 | DH_RSA_EXPORT, 22 | DH_anon, 23 | DH_anon_export, 24 | PSK, 25 | DHE_PSK, 26 | RSA_PSK, 27 | ECDH_ECDSA, 28 | ECDHE_ECDSA, 29 | ECDH_RSA, 30 | ECDHE_RSA, 31 | ECDH_anon, 32 | SRP, 33 | SRP_DSS, 34 | SRP_RSA, 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/LegacyTlsAuthentication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto.Tls 4 | { 5 | /// 6 | /// A temporary class to wrap old CertificateVerifyer stuff for new TlsAuthentication. 7 | /// 8 | [Obsolete] 9 | public class LegacyTlsAuthentication 10 | : TlsAuthentication 11 | { 12 | protected ICertificateVerifyer verifyer; 13 | 14 | public LegacyTlsAuthentication(ICertificateVerifyer verifyer) 15 | { 16 | this.verifyer = verifyer; 17 | } 18 | 19 | public virtual void NotifyServerCertificate(Certificate serverCertificate) 20 | { 21 | if (!this.verifyer.IsValid(serverCertificate.GetCerts())) 22 | throw new TlsFatalAlert(AlertDescription.user_canceled); 23 | } 24 | 25 | public virtual TlsCredentials GetClientCredentials(CertificateRequest certificateRequest) 26 | { 27 | return null; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/LegacyTlsClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto.Tls 4 | { 5 | /// 6 | /// A temporary class to use LegacyTlsAuthentication 7 | /// 8 | [Obsolete] 9 | public class LegacyTlsClient 10 | : DefaultTlsClient 11 | { 12 | [Obsolete] 13 | protected ICertificateVerifyer verifyer; 14 | 15 | [Obsolete] 16 | public LegacyTlsClient(ICertificateVerifyer verifyer) 17 | { 18 | this.verifyer = verifyer; 19 | } 20 | 21 | public override TlsAuthentication GetAuthentication() 22 | { 23 | return new LegacyTlsAuthentication(verifyer); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/SecurityParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto.Tls 4 | { 5 | public class SecurityParameters 6 | { 7 | internal byte[] clientRandom = null; 8 | internal byte[] serverRandom = null; 9 | internal byte[] masterSecret = null; 10 | 11 | public byte[] ClientRandom 12 | { 13 | get { return clientRandom; } 14 | } 15 | 16 | public byte[] ServerRandom 17 | { 18 | get { return serverRandom; } 19 | } 20 | 21 | public byte[] MasterSecret 22 | { 23 | get { return masterSecret; } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/TlsAgreementCredentials.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Crypto.Tls 5 | { 6 | public interface TlsAgreementCredentials : TlsCredentials 7 | { 8 | /// 9 | byte[] GenerateAgreement(AsymmetricKeyParameter serverPublicKey); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/TlsCipher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Crypto.Tls 5 | { 6 | public interface TlsCipher 7 | { 8 | /// 9 | byte[] EncodePlaintext(ContentType type, byte[] plaintext, int offset, int len); 10 | 11 | /// 12 | byte[] DecodeCiphertext(ContentType type, byte[] ciphertext, int offset, int len); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/TlsCipherFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Crypto.Tls 5 | { 6 | public interface TlsCipherFactory 7 | { 8 | /// 9 | TlsCipher CreateCipher(TlsClientContext context, EncryptionAlgorithm encryptionAlgorithm, 10 | DigestAlgorithm digestAlgorithm); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/TlsClientContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Security; 3 | 4 | namespace Raksha.Crypto.Tls 5 | { 6 | public interface TlsClientContext 7 | { 8 | SecureRandom SecureRandom { get; } 9 | 10 | SecurityParameters SecurityParameters { get; } 11 | 12 | object UserObject { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/TlsClientContextImpl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Security; 3 | 4 | namespace Raksha.Crypto.Tls 5 | { 6 | internal class TlsClientContextImpl 7 | : TlsClientContext 8 | { 9 | private readonly SecureRandom secureRandom; 10 | private readonly SecurityParameters securityParameters; 11 | 12 | private object userObject = null; 13 | 14 | internal TlsClientContextImpl(SecureRandom secureRandom, SecurityParameters securityParameters) 15 | { 16 | this.secureRandom = secureRandom; 17 | this.securityParameters = securityParameters; 18 | } 19 | 20 | public virtual SecureRandom SecureRandom 21 | { 22 | get { return secureRandom; } 23 | } 24 | 25 | public virtual SecurityParameters SecurityParameters 26 | { 27 | get { return securityParameters; } 28 | } 29 | 30 | public virtual object UserObject 31 | { 32 | get { return userObject; } 33 | set { this.userObject = value; } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/TlsCompression.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014 Alexander Logger. 4 | // Copyright (c) 2000 - 2013 The Legion of the Bouncy Castle Inc. (http://www.bouncycastle.org). 5 | // 6 | // -------------------------------------------------------------------------------------------------------------------- 7 | 8 | using System.IO; 9 | 10 | namespace Raksha.Crypto.Tls 11 | { 12 | public interface ITlsCompression 13 | { 14 | Stream Compress(Stream output); 15 | 16 | Stream Decompress(Stream output); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/TlsCredentials.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto.Tls 4 | { 5 | public interface TlsCredentials 6 | { 7 | Certificate Certificate { get; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/TlsDssSigner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Crypto.Parameters; 3 | using Raksha.Crypto.Signers; 4 | 5 | namespace Raksha.Crypto.Tls 6 | { 7 | internal class TlsDssSigner 8 | : TlsDsaSigner 9 | { 10 | public override bool IsValidPublicKey(AsymmetricKeyParameter publicKey) 11 | { 12 | return publicKey is DsaPublicKeyParameters; 13 | } 14 | 15 | protected override IDsa CreateDsaImpl() 16 | { 17 | return new DsaSigner(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/TlsECDsaSigner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Crypto.Parameters; 3 | using Raksha.Crypto.Signers; 4 | 5 | namespace Raksha.Crypto.Tls 6 | { 7 | internal class TlsECDsaSigner 8 | : TlsDsaSigner 9 | { 10 | public override bool IsValidPublicKey(AsymmetricKeyParameter publicKey) 11 | { 12 | return publicKey is ECPublicKeyParameters; 13 | } 14 | 15 | protected override IDsa CreateDsaImpl() 16 | { 17 | return new ECDsaSigner(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/TlsException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto.Tls 4 | { 5 | public class TlsException : Exception 6 | { 7 | public TlsException() : base() { } 8 | public TlsException(string message) : base(message) { } 9 | public TlsException(string message, Exception exception) : base(message, exception) { } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/TlsFatalAlert.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Crypto.Tls 5 | { 6 | public class TlsFatalAlert 7 | : IOException 8 | { 9 | private readonly AlertDescription alertDescription; 10 | 11 | public TlsFatalAlert(AlertDescription alertDescription) 12 | { 13 | this.alertDescription = alertDescription; 14 | } 15 | 16 | public AlertDescription AlertDescription 17 | { 18 | get { return alertDescription; } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/TlsNullCipher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Crypto.Tls 4 | { 5 | /// 6 | /// A NULL cipher suite, for use during handshake. 7 | /// 8 | public class TlsNullCipher 9 | : TlsCipher 10 | { 11 | public virtual byte[] EncodePlaintext(ContentType type, byte[] plaintext, int offset, int len) 12 | { 13 | return CopyData(plaintext, offset, len); 14 | } 15 | 16 | public virtual byte[] DecodeCiphertext(ContentType type, byte[] ciphertext, int offset, int len) 17 | { 18 | return CopyData(ciphertext, offset, len); 19 | } 20 | 21 | protected virtual byte[] CopyData(byte[] text, int offset, int len) 22 | { 23 | byte[] result = new byte[len]; 24 | Array.Copy(text, offset, result, 0, len); 25 | return result; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/TlsNullCompression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Crypto.Tls 5 | { 6 | public class TlsNullCompression 7 | : ITlsCompression 8 | { 9 | public virtual Stream Compress(Stream output) 10 | { 11 | return output; 12 | } 13 | 14 | public virtual Stream Decompress(Stream output) 15 | { 16 | return output; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/TlsSigner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Security; 3 | 4 | namespace Raksha.Crypto.Tls 5 | { 6 | public interface TlsSigner 7 | { 8 | byte[] CalculateRawSignature(SecureRandom random, AsymmetricKeyParameter privateKey, 9 | byte[] md5andsha1); 10 | bool VerifyRawSignature(byte[] sigBytes, AsymmetricKeyParameter publicKey, byte[] md5andsha1); 11 | 12 | ISigner CreateSigner(SecureRandom random, AsymmetricKeyParameter privateKey); 13 | ISigner CreateVerifyer(AsymmetricKeyParameter publicKey); 14 | 15 | bool IsValidPublicKey(AsymmetricKeyParameter publicKey); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Crypto/Tls/TlsSignerCredentials.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Crypto.Tls 5 | { 6 | public interface TlsSignerCredentials : TlsCredentials 7 | { 8 | /// 9 | byte[] GenerateCertificateSignature(byte[] md5andsha1); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Math/EC/Multiplier/ECMultiplier.cs: -------------------------------------------------------------------------------- 1 | using BigMath; 2 | 3 | namespace Raksha.Math.EC.Multiplier 4 | { 5 | /** 6 | * Interface for classes encapsulating a point multiplication algorithm 7 | * for ECPoints. 8 | */ 9 | internal interface ECMultiplier 10 | { 11 | /** 12 | * Multiplies the ECPoint p by k, i.e. 13 | * p is added k times to itself. 14 | * @param p The ECPoint to be multiplied. 15 | * @param k The factor by which p i multiplied. 16 | * @return p multiplied by k. 17 | */ 18 | ECPoint Multiply(ECPoint p, BigInteger k, PreCompInfo preCompInfo); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Math/EC/Multiplier/PreCompInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Math.EC.Multiplier 2 | { 3 | /** 4 | * Interface for classes storing precomputation data for multiplication 5 | * algorithms. Used as a Memento (see GOF patterns) for 6 | * WNafMultiplier. 7 | */ 8 | internal interface PreCompInfo 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Math/EC/Multiplier/ReferenceMultiplier.cs: -------------------------------------------------------------------------------- 1 | using BigMath; 2 | 3 | namespace Raksha.Math.EC.Multiplier 4 | { 5 | internal class ReferenceMultiplier 6 | : ECMultiplier 7 | { 8 | /** 9 | * Simple shift-and-add multiplication. Serves as reference implementation 10 | * to verify (possibly faster) implementations in 11 | * {@link org.bouncycastle.math.ec.ECPoint ECPoint}. 12 | * 13 | * @param p The point to multiply. 14 | * @param k The factor by which to multiply. 15 | * @return The result of the point multiplication k * p. 16 | */ 17 | public ECPoint Multiply(ECPoint p, BigInteger k, PreCompInfo preCompInfo) 18 | { 19 | ECPoint q = p.Curve.Infinity; 20 | int t = k.BitLength; 21 | for (int i = 0; i < t; i++) 22 | { 23 | if (k.TestBit(i)) 24 | { 25 | q = q.Add(p); 26 | } 27 | p = p.Twice(); 28 | } 29 | return q; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Ocsp/CertificateStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Ocsp 4 | { 5 | public abstract class CertificateStatus 6 | { 7 | public static readonly CertificateStatus Good = null; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Ocsp/OCSPException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Ocsp 4 | { 5 | public class OcspException 6 | : Exception 7 | { 8 | public OcspException() 9 | { 10 | } 11 | 12 | public OcspException( 13 | string message) 14 | : base(message) 15 | { 16 | } 17 | 18 | public OcspException( 19 | string message, 20 | Exception e) 21 | : base(message, e) 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Ocsp/OCSPRespStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Ocsp 4 | { 5 | [Obsolete("Use version with correct spelling 'OcspRespStatus'")] 6 | public abstract class OcscpRespStatus : OcspRespStatus 7 | { 8 | } 9 | 10 | public abstract class OcspRespStatus 11 | { 12 | /** 13 | * note 4 is not used. 14 | */ 15 | public const int Successful = 0; // --Response has valid confirmations 16 | public const int MalformedRequest = 1; // --Illegal confirmation request 17 | public const int InternalError = 2; // --Internal error in issuer 18 | public const int TryLater = 3; // --Try again later 19 | public const int SigRequired = 5; // --Must sign the request 20 | public const int Unauthorized = 6; // --Request unauthorized 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Ocsp/Req.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.IO; 4 | 5 | using Raksha.Asn1; 6 | using Raksha.Asn1.Ocsp; 7 | using Raksha.Asn1.X509; 8 | using Raksha.X509; 9 | 10 | namespace Raksha.Ocsp 11 | { 12 | public class Req 13 | : X509ExtensionBase 14 | { 15 | private Request req; 16 | 17 | public Req( 18 | Request req) 19 | { 20 | this.req = req; 21 | } 22 | 23 | public CertificateID GetCertID() 24 | { 25 | return new CertificateID(req.ReqCert); 26 | } 27 | 28 | public X509Extensions SingleRequestExtensions 29 | { 30 | get { return req.SingleRequestExtensions; } 31 | } 32 | 33 | protected override X509Extensions GetX509Extensions() 34 | { 35 | return SingleRequestExtensions; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Ocsp/UnknownStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Ocsp 4 | { 5 | /** 6 | * wrapper for the UnknownInfo object 7 | */ 8 | public class UnknownStatus 9 | : CertificateStatus 10 | { 11 | public UnknownStatus() 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/OpenSsl/EncryptionException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Security 5 | { 6 | public class EncryptionException 7 | : IOException 8 | { 9 | public EncryptionException( 10 | string message) 11 | : base(message) 12 | { 13 | } 14 | 15 | public EncryptionException( 16 | string message, 17 | Exception exception) 18 | : base(message, exception) 19 | { 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/OpenSsl/IPasswordFinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.OpenSsl 4 | { 5 | public interface IPasswordFinder 6 | { 7 | char[] GetPassword(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/OpenSsl/PEMException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.OpenSsl 5 | { 6 | public class PemException 7 | : IOException 8 | { 9 | public PemException( 10 | string message) 11 | : base(message) 12 | { 13 | } 14 | 15 | public PemException( 16 | string message, 17 | Exception exception) 18 | : base(message, exception) 19 | { 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/OpenSsl/PasswordException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Security 5 | { 6 | public class PasswordException 7 | : IOException 8 | { 9 | public PasswordException( 10 | string message) 11 | : base(message) 12 | { 13 | } 14 | 15 | public PasswordException( 16 | string message, 17 | Exception exception) 18 | : base(message, exception) 19 | { 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Pkix/CertStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Utilities.Date; 3 | 4 | namespace Raksha.Pkix 5 | { 6 | public class CertStatus 7 | { 8 | public const int Unrevoked = 11; 9 | 10 | public const int Undetermined = 12; 11 | 12 | private int status = Unrevoked; 13 | 14 | DateTimeObject revocationDate = null; 15 | 16 | /// 17 | /// Returns the revocationDate. 18 | /// 19 | public DateTimeObject RevocationDate 20 | { 21 | get { return revocationDate; } 22 | set { this.revocationDate = value; } 23 | } 24 | 25 | /// 26 | /// Returns the certStatus. 27 | /// 28 | public int Status 29 | { 30 | get { return status; } 31 | set { this.status = value; } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Pkix/PkixCertPathBuilderException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Security; 3 | 4 | namespace Raksha.Pkix 5 | { 6 | /// 7 | /// Summary description for PkixCertPathBuilderException. 8 | /// 9 | public class PkixCertPathBuilderException : GeneralSecurityException 10 | { 11 | public PkixCertPathBuilderException() : base() { } 12 | 13 | public PkixCertPathBuilderException(string message) : base(message) { } 14 | 15 | public PkixCertPathBuilderException(string message, Exception exception) : base(message, exception) { } 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Pkix/PkixNameConstraintValidatorException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Pkix 4 | { 5 | public class PkixNameConstraintValidatorException : Exception 6 | { 7 | public PkixNameConstraintValidatorException(String msg) 8 | : base(msg) 9 | { 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Security/Certificates/CertificateEncodingException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Security.Certificates 4 | { 5 | public class CertificateEncodingException : CertificateException 6 | { 7 | public CertificateEncodingException() : base() { } 8 | public CertificateEncodingException(string msg) : base(msg) { } 9 | public CertificateEncodingException(string msg, Exception e) : base(msg, e) { } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Security/Certificates/CertificateException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Security.Certificates 4 | { 5 | public class CertificateException : GeneralSecurityException 6 | { 7 | public CertificateException() : base() { } 8 | public CertificateException(string message) : base(message) { } 9 | public CertificateException(string message, Exception exception) : base(message, exception) { } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Security/Certificates/CertificateExpiredException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Security.Certificates 4 | { 5 | public class CertificateExpiredException : CertificateException 6 | { 7 | public CertificateExpiredException() : base() { } 8 | public CertificateExpiredException(string message) : base(message) { } 9 | public CertificateExpiredException(string message, Exception exception) : base(message, exception) { } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Security/Certificates/CertificateNotYetValidException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Security.Certificates 4 | { 5 | public class CertificateNotYetValidException : CertificateException 6 | { 7 | public CertificateNotYetValidException() : base() { } 8 | public CertificateNotYetValidException(string message) : base(message) { } 9 | public CertificateNotYetValidException(string message, Exception exception) : base(message, exception) { } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Security/Certificates/CertificateParsingException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Security.Certificates 4 | { 5 | public class CertificateParsingException : CertificateException 6 | { 7 | public CertificateParsingException() : base() { } 8 | public CertificateParsingException(string message) : base(message) { } 9 | public CertificateParsingException(string message, Exception exception) : base(message, exception) { } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Security/Certificates/CrlException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Security.Certificates 4 | { 5 | public class CrlException : GeneralSecurityException 6 | { 7 | public CrlException() : base() { } 8 | public CrlException(string msg) : base(msg) {} 9 | public CrlException(string msg, Exception e) : base(msg, e) {} 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Security/GeneralSecurityException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Security 4 | { 5 | public class GeneralSecurityException 6 | : Exception 7 | { 8 | public GeneralSecurityException() 9 | : base() 10 | { 11 | } 12 | 13 | public GeneralSecurityException( 14 | string message) 15 | : base(message) 16 | { 17 | } 18 | 19 | public GeneralSecurityException( 20 | string message, 21 | Exception exception) 22 | : base(message, exception) 23 | { 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Security/InvalidKeyException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Security 4 | { 5 | public class InvalidKeyException : KeyException 6 | { 7 | public InvalidKeyException() : base() { } 8 | public InvalidKeyException(string message) : base(message) { } 9 | public InvalidKeyException(string message, Exception exception) : base(message, exception) { } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Security/InvalidParameterException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Security 4 | { 5 | public class InvalidParameterException : KeyException 6 | { 7 | public InvalidParameterException() : base() { } 8 | public InvalidParameterException(string message) : base(message) { } 9 | public InvalidParameterException(string message, Exception exception) : base(message, exception) { } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Security/KeyException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Security 4 | { 5 | public class KeyException : GeneralSecurityException 6 | { 7 | public KeyException() : base() { } 8 | public KeyException(string message) : base(message) { } 9 | public KeyException(string message, Exception exception) : base(message, exception) { } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Security/NoSuchAlgorithmException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Security 4 | { 5 | [Obsolete("Never thrown")] 6 | public class NoSuchAlgorithmException : GeneralSecurityException 7 | { 8 | public NoSuchAlgorithmException() : base() {} 9 | public NoSuchAlgorithmException(string message) : base(message) {} 10 | public NoSuchAlgorithmException(string message, Exception exception) : base(message, exception) {} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Security/SecurityUtilityException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Security 4 | { 5 | public class SecurityUtilityException 6 | : Exception 7 | { 8 | /** 9 | * base constructor. 10 | */ 11 | public SecurityUtilityException() 12 | { 13 | } 14 | 15 | /** 16 | * create a SecurityUtilityException with the given message. 17 | * 18 | * @param message the message to be carried with the exception. 19 | */ 20 | public SecurityUtilityException( 21 | string message) 22 | : base(message) 23 | { 24 | } 25 | 26 | public SecurityUtilityException( 27 | string message, 28 | Exception exception) 29 | : base(message, exception) 30 | { 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Security/SignatureException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Security 4 | { 5 | public class SignatureException : GeneralSecurityException 6 | { 7 | public SignatureException() : base() { } 8 | public SignatureException(string message) : base(message) { } 9 | public SignatureException(string message, Exception exception) : base(message, exception) { } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Tsp/GenTimeAccuracy.cs: -------------------------------------------------------------------------------- 1 | using Raksha.Asn1; 2 | using Raksha.Asn1.Tsp; 3 | 4 | namespace Raksha.Tsp 5 | { 6 | public class GenTimeAccuracy 7 | { 8 | private Accuracy accuracy; 9 | 10 | public GenTimeAccuracy( 11 | Accuracy accuracy) 12 | { 13 | this.accuracy = accuracy; 14 | } 15 | 16 | public int Seconds { get { return GetTimeComponent(accuracy.Seconds); } } 17 | 18 | public int Millis { get { return GetTimeComponent(accuracy.Millis); } } 19 | 20 | public int Micros { get { return GetTimeComponent(accuracy.Micros); } } 21 | 22 | private int GetTimeComponent( 23 | DerInteger time) 24 | { 25 | return time == null ? 0 : time.Value.IntValue; 26 | } 27 | 28 | public override string ToString() 29 | { 30 | return Seconds + "." + Millis.ToString("000") + Micros.ToString("000"); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Tsp/TSPException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Tsp 4 | { 5 | public class TspException 6 | : Exception 7 | { 8 | public TspException() 9 | { 10 | } 11 | 12 | public TspException( 13 | string message) 14 | : base(message) 15 | { 16 | } 17 | 18 | public TspException( 19 | string message, 20 | Exception e) 21 | : base(message, e) 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Tsp/TSPValidationException.cs: -------------------------------------------------------------------------------- 1 | namespace Raksha.Tsp 2 | { 3 | /** 4 | * Exception thrown if a TSP request or response fails to validate. 5 | *

6 | * If a failure code is assciated with the exception it can be retrieved using 7 | * the getFailureCode() method.

8 | */ 9 | public class TspValidationException 10 | : TspException 11 | { 12 | private int failureCode; 13 | 14 | public TspValidationException( 15 | string message) 16 | : base(message) 17 | { 18 | this.failureCode = -1; 19 | } 20 | 21 | public TspValidationException( 22 | string message, 23 | int failureCode) 24 | : base(message) 25 | { 26 | this.failureCode = failureCode; 27 | } 28 | 29 | /** 30 | * Return the failure code associated with this exception - if one is set. 31 | * 32 | * @return the failure code if set, -1 otherwise. 33 | */ 34 | public int FailureCode 35 | { 36 | get { return failureCode; } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Utilities/Collections/EmptyEnumerable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | 4 | namespace Raksha.Utilities.Collections 5 | { 6 | public sealed class EmptyEnumerable 7 | : IEnumerable 8 | { 9 | public static readonly IEnumerable Instance = new EmptyEnumerable(); 10 | 11 | private EmptyEnumerable() 12 | { 13 | } 14 | 15 | public IEnumerator GetEnumerator() 16 | { 17 | return EmptyEnumerator.Instance; 18 | } 19 | } 20 | 21 | public sealed class EmptyEnumerator 22 | : IEnumerator 23 | { 24 | public static readonly IEnumerator Instance = new EmptyEnumerator(); 25 | 26 | private EmptyEnumerator() 27 | { 28 | } 29 | 30 | public bool MoveNext() 31 | { 32 | return false; 33 | } 34 | 35 | public void Reset() 36 | { 37 | } 38 | 39 | public object Current 40 | { 41 | get { throw new InvalidOperationException("No elements"); } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Utilities/Collections/EnumerableProxy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | 4 | namespace Raksha.Utilities.Collections 5 | { 6 | public sealed class EnumerableProxy 7 | : IEnumerable 8 | { 9 | private readonly IEnumerable inner; 10 | 11 | public EnumerableProxy( 12 | IEnumerable inner) 13 | { 14 | if (inner == null) 15 | throw new ArgumentNullException("inner"); 16 | 17 | this.inner = inner; 18 | } 19 | 20 | public IEnumerator GetEnumerator() 21 | { 22 | return inner.GetEnumerator(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Utilities/Collections/ISet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | 4 | namespace Raksha.Utilities.Collections 5 | { 6 | public interface ISet 7 | : ICollection 8 | { 9 | void Add(object o); 10 | void AddAll(IEnumerable e); 11 | void Clear(); 12 | bool Contains(object o); 13 | bool IsEmpty { get; } 14 | bool IsFixedSize { get; } 15 | bool IsReadOnly { get; } 16 | void Remove(object o); 17 | void RemoveAll(IEnumerable e); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Utilities/Date/DateTimeObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Utilities.Date 4 | { 5 | public sealed class DateTimeObject 6 | { 7 | private readonly DateTime dt; 8 | 9 | public DateTimeObject( 10 | DateTime dt) 11 | { 12 | this.dt = dt; 13 | } 14 | 15 | public DateTime Value 16 | { 17 | get { return dt; } 18 | } 19 | 20 | public override string ToString() 21 | { 22 | return dt.ToString(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Utilities/Encoders/IEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Utilities.Encoders 5 | { 6 | /** 7 | * Encode and decode byte arrays (typically from binary to 7-bit ASCII 8 | * encodings). 9 | */ 10 | public interface IEncoder 11 | { 12 | int Encode(byte[] data, int off, int length, Stream outStream); 13 | 14 | int Decode(byte[] data, int off, int length, Stream outStream); 15 | 16 | int DecodeString(string data, Stream outStream); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Utilities/Encoders/Translator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Utilities.Encoders 4 | { 5 | /// 6 | /// Translator interface. 7 | /// 8 | public interface ITranslator 9 | { 10 | int GetEncodedBlockSize(); 11 | 12 | int Encode(byte[] input, int inOff, int length, byte[] outBytes, int outOff); 13 | 14 | int GetDecodedBlockSize(); 15 | 16 | int Decode(byte[] input, int inOff, int length, byte[] outBytes, int outOff); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Utilities/IO/Pem/PemGenerationException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Utilities.IO.Pem 4 | { 5 | public class PemGenerationException 6 | : Exception 7 | { 8 | public PemGenerationException() 9 | : base() 10 | { 11 | } 12 | 13 | public PemGenerationException( 14 | string message) 15 | : base(message) 16 | { 17 | } 18 | 19 | public PemGenerationException( 20 | string message, 21 | Exception exception) 22 | : base(message, exception) 23 | { 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Utilities/IO/Pem/PemObjectGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.Utilities.IO.Pem 4 | { 5 | public interface PemObjectGenerator 6 | { 7 | /// 8 | /// A 9 | /// 10 | /// 11 | PemObject Generate(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Utilities/IO/Pem/PemObjectParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Utilities.IO.Pem 5 | { 6 | public interface PemObjectParser 7 | { 8 | /// 9 | /// A 10 | /// 11 | /// 12 | /// A 13 | /// 14 | /// 15 | object ParseObject(PemObject obj); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/Utilities/IO/StreamOverflowException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Raksha.Utilities.IO 5 | { 6 | public class StreamOverflowException 7 | : IOException 8 | { 9 | public StreamOverflowException() 10 | : base() 11 | { 12 | } 13 | 14 | public StreamOverflowException( 15 | string message) 16 | : base(message) 17 | { 18 | } 19 | 20 | public StreamOverflowException( 21 | string message, 22 | Exception exception) 23 | : base(message, exception) 24 | { 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/X509/IX509Extension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Raksha.Asn1; 3 | using Raksha.Utilities.Collections; 4 | 5 | namespace Raksha.X509 6 | { 7 | public interface IX509Extension 8 | { 9 | /// 10 | /// Get all critical extension values, by oid 11 | /// 12 | /// IDictionary with string (OID) keys and Asn1OctetString values 13 | ISet GetCriticalExtensionOids(); 14 | 15 | /// 16 | /// Get all non-critical extension values, by oid 17 | /// 18 | /// IDictionary with string (OID) keys and Asn1OctetString values 19 | ISet GetNonCriticalExtensionOids(); 20 | 21 | [Obsolete("Use version taking a DerObjectIdentifier instead")] 22 | Asn1OctetString GetExtensionValue(string oid); 23 | 24 | Asn1OctetString GetExtensionValue(DerObjectIdentifier oid); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/X509/Store/IX509Selector.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014 Alexander Logger. 4 | // Copyright (c) 2000 - 2013 The Legion of the Bouncy Castle Inc. (http://www.bouncycastle.org). 5 | // 6 | // -------------------------------------------------------------------------------------------------------------------- 7 | 8 | namespace Raksha.X509.Store 9 | { 10 | public interface IX509Selector 11 | { 12 | object Clone(); 13 | bool Match(object obj); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/X509/Store/IX509Store.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | 4 | namespace Raksha.X509.Store 5 | { 6 | public interface IX509Store 7 | { 8 | // void Init(IX509StoreParameters parameters); 9 | ICollection GetMatches(IX509Selector selector); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/X509/Store/IX509StoreParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.X509.Store 4 | { 5 | public interface IX509StoreParameters 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/X509/Store/NoSuchStoreException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.X509.Store 4 | { 5 | public class NoSuchStoreException 6 | : X509StoreException 7 | { 8 | public NoSuchStoreException() 9 | { 10 | } 11 | 12 | public NoSuchStoreException( 13 | string message) 14 | : base(message) 15 | { 16 | } 17 | 18 | public NoSuchStoreException( 19 | string message, 20 | Exception e) 21 | : base(message, e) 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/Raksha/X509/Store/X509StoreException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Raksha.X509.Store 4 | { 5 | public class X509StoreException 6 | : Exception 7 | { 8 | public X509StoreException() 9 | { 10 | } 11 | 12 | public X509StoreException( 13 | string message) 14 | : base(message) 15 | { 16 | } 17 | 18 | public X509StoreException( 19 | string message, 20 | Exception e) 21 | : base(message, e) 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/SharpMTProto/Defaults.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | using System; 8 | 9 | namespace SharpMTProto 10 | { 11 | public static class Defaults 12 | { 13 | public static readonly TimeSpan RpcTimeout = TimeSpan.FromSeconds(10); 14 | public static readonly TimeSpan ConnectTimeout = TimeSpan.FromSeconds(10); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/SharpMTProto/ErrorCode.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Disa-im/DisaOpenSource/d0b2c6db5b2aa8c95377533dc6c4e54073460bb0/Disa.Framework.Telegram.Shared/SharpMTProto/ErrorCode.cs -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/SharpMTProto/Messaging/Handlers/SessionHandler.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2013-2014 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | using System.Threading.Tasks; 8 | using Nito.AsyncEx; 9 | using SharpMTProto.Schema; 10 | 11 | namespace SharpMTProto.Messaging.Handlers 12 | { 13 | public class SessionHandler : ResponseHandler 14 | { 15 | protected override Task HandleInternalAsync(IMessage responseMessage) 16 | { 17 | // TODO: implement. 18 | return TaskConstants.Completed; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/SharpMTProto/Messaging/MessageSendingFlags.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2013-2014 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | using System; 8 | 9 | namespace SharpMTProto.Messaging 10 | { 11 | [Flags] 12 | public enum MessageSendingFlags 13 | { 14 | None = 0, 15 | Encrypted = 1, 16 | ContentRelated = 1 << 1, 17 | EncryptedAndContentRelated = Encrypted | ContentRelated, 18 | RPC = 2 << 1, 19 | EncryptedAndContentRelatedRPC = EncryptedAndContentRelated | RPC 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/SharpMTProto/Messaging/Sender.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2013-2014 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | namespace SharpMTProto.Messaging 8 | { 9 | /// 10 | /// Type of a message sender. 11 | /// 12 | public enum Sender 13 | { 14 | Client, 15 | Server 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/SharpMTProto/Services/IHashServices.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | using System; 8 | using System.IO; 9 | 10 | namespace SharpMTProto.Services 11 | { 12 | public interface IHashServices 13 | { 14 | byte[] ComputeSHA1(byte[] data); 15 | byte[] ComputeSHA1(byte[] data, int offset, int count); 16 | byte[] ComputeSHA1(ArraySegment data); 17 | byte[] ComputeSHA1(Stream stream); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/SharpMTProto/Transport/IClientTransportConfig.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | namespace SharpMTProto.Transport 8 | { 9 | public interface IClientTransportConfig 10 | { 11 | string TransportName { get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/SharpTL/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. 3 | // Project-level suppressions either have no target or are given 4 | // a specific target and scoped to a namespace, type, member, etc. 5 | // 6 | // To add a suppression to this file, right-click the message in the 7 | // Code Analysis results, point to "Suppress Message", and click 8 | // "In Suppression File". 9 | // You do not need to add suppressions to this file manually. 10 | 11 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Scope = "member", Target = "SharpTL.TLSerializersBucket.#Item[System.Type]")] 12 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Scope = "member", Target = "SharpTL.TLSerializersBucket.#Item[System.UInt32]")] 13 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/SharpTL/TLSerializationMode.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2013 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | namespace SharpTL 8 | { 9 | /// 10 | /// Mode of TL serialization. 11 | /// 12 | public enum TLSerializationMode 13 | { 14 | Boxed, 15 | Bare 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/SharpTelegram/Schema/SharpTelegram.Schema.MethodsImpl.Ex.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2013-2014 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | using SharpMTProto; 8 | 9 | namespace SharpTelegram.Schema 10 | { 11 | public partial class TelegramAsyncMethods 12 | { 13 | partial void SetupRemoteProcedureCaller(IRemoteProcedureCaller remoteProcedureCaller) 14 | { 15 | remoteProcedureCaller.PrepareSerializersForAllTLObjectsInAssembly( 16 | typeof (ITelegramAsyncMethods).Assembly); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/SharpTelegram/TelegramAppInfo.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2013-2014 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | using System; 8 | 9 | namespace SharpTelegram 10 | { 11 | public class TelegramAppInfo 12 | { 13 | public UInt32 ApiId { get; set; } 14 | 15 | public String DeviceModel { get; set; } 16 | 17 | public String SystemVersion { get; set; } 18 | 19 | public String AppVersion { get; set; } 20 | 21 | public String LangCode { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/SyncComparer.cs: -------------------------------------------------------------------------------- 1 | using Disa.Framework.Bubbles; 2 | 3 | namespace Disa.Framework.Telegram 4 | { 5 | public partial class Telegram : BubbleGroupSync.Comparer 6 | { 7 | public bool LoadBubblesComparer(VisualBubble localBubble, VisualBubble agentBubble) 8 | { 9 | if (localBubble.IdService == agentBubble.IdService) 10 | { 11 | return true; 12 | } 13 | return false; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/TelegramMutableSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework.Telegram 4 | { 5 | public class TelegramMutableSettings : DisaMutableSettings 6 | { 7 | public uint Date { get; set; } 8 | public uint Pts { get; set; } 9 | public uint Qts { get; set; } 10 | public uint Seq { get; set; } //TODO: needed? Remove from all of Telegram code (including State object, SaveState method, etc.) 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram.Shared/TelegramSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Disa.Framework.Telegram 4 | { 5 | public class TelegramSettings : DisaSettings 6 | { 7 | public byte[] AuthKey { get; set; } 8 | public ulong Salt { get; set; } 9 | public uint NearestDcId { get; set; } 10 | public string NearestDcIp { get; set; } 11 | public int NearestDcPort { get; set; } 12 | public uint AccountId { get; set; } 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /Disa.Framework.Telegram/References/System.Reactive.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Disa-im/DisaOpenSource/d0b2c6db5b2aa8c95377533dc6c4e54073460bb0/Disa.Framework.Telegram/References/System.Reactive.Core.dll -------------------------------------------------------------------------------- /Disa.Framework.Telegram/References/System.Reactive.Interfaces.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Disa-im/DisaOpenSource/d0b2c6db5b2aa8c95377533dc6c4e54073460bb0/Disa.Framework.Telegram/References/System.Reactive.Interfaces.dll -------------------------------------------------------------------------------- /Disa.Framework.Telegram/References/System.Reactive.Linq.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Disa-im/DisaOpenSource/d0b2c6db5b2aa8c95377533dc6c4e54073460bb0/Disa.Framework.Telegram/References/System.Reactive.Linq.dll -------------------------------------------------------------------------------- /References/AndroidLib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Disa-im/DisaOpenSource/d0b2c6db5b2aa8c95377533dc6c4e54073460bb0/References/AndroidLib.dll -------------------------------------------------------------------------------- /References/TimSort.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Disa-im/DisaOpenSource/d0b2c6db5b2aa8c95377533dc6c4e54073460bb0/References/TimSort.dll -------------------------------------------------------------------------------- /Tooling/.gitattributes: -------------------------------------------------------------------------------- 1 | *.doc diff=astextplain 2 | *.DOC diff=astextplain 3 | *.docx diff=astextplain 4 | *.DOCX diff=astextplain 5 | *.dot diff=astextplain 6 | *.DOT diff=astextplain 7 | *.pdf diff=astextplain 8 | *.PDF diff=astextplain 9 | *.rtf diff=astextplain 10 | *.RTF diff=astextplain 11 | 12 | *.jpg binary 13 | *.png binary 14 | *.gif binary 15 | 16 | *.cs text diff=csharp 17 | *.vb text 18 | *.c text 19 | *.cpp text 20 | *.cxx text 21 | *.h text 22 | *.hxx text 23 | *.py text 24 | *.rb text 25 | *.java text 26 | *.html text 27 | *.htm text 28 | *.css text 29 | *.scss text 30 | *.sass text 31 | *.less text 32 | *.js text 33 | *.lisp text 34 | *.clj text 35 | *.sql text 36 | *.php text 37 | *.lua text 38 | *.m text 39 | *.asm text 40 | *.erl text 41 | *.fs text 42 | *.fsx text 43 | *.hs text 44 | *.fbp7 text 45 | 46 | *.csproj text merge=union 47 | *.vbproj text merge=union 48 | *.fsproj text merge=union 49 | *.dbproj text merge=union 50 | *.sln text eol=crlf merge=union -------------------------------------------------------------------------------- /Tooling/Sharp.TL.Compiler/CommonAssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2013 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | using System.Reflection; 8 | using System.Resources; 9 | 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("SharpTL.Compiler")] 12 | [assembly: AssemblyCopyright("Copyright © 2013-2014 Alexander Logger.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | [assembly: NeutralResourcesLanguage("en")] 16 | [assembly: AssemblyVersion("0.1.0")] 17 | -------------------------------------------------------------------------------- /Tooling/Sharp.TL.Compiler/SharpTL.Compiler.CLI.NET45/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Tooling/Sharp.TL.Compiler/SharpTL.Compiler.CLI.NET45/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2013 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | using System.Reflection; 8 | 9 | [assembly: AssemblyTitle("SharpTL.Compiler.CLI")] 10 | [assembly: AssemblyDescription("SharpTL compiler command-line interface.")] 11 | -------------------------------------------------------------------------------- /Tooling/Sharp.TL.Compiler/SharpTL.Compiler.CLI.NET45/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Tooling/Sharp.TL.Compiler/SharpTL.Compiler.NET45/CompilationParams.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2013-2014 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | namespace SharpTL.Compiler 8 | { 9 | public class CompilationParams 10 | { 11 | public CompilationParams(string ns, string methodsInterfaceName = null) 12 | { 13 | Namespace = ns; 14 | MethodsInterfaceName = methodsInterfaceName ?? ns.Replace(".", string.Empty); 15 | } 16 | 17 | public string Namespace { get; set; } 18 | public string MethodsInterfaceName { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Tooling/Sharp.TL.Compiler/SharpTL.Compiler.NET45/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2013 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | using System.Reflection; 8 | 9 | [assembly: AssemblyTitle("SharpTL.Compiler")] 10 | [assembly: AssemblyDescription("SharpTL compiler core library.")] 11 | -------------------------------------------------------------------------------- /Tooling/Sharp.TL.Compiler/SharpTL.Compiler.NET45/TLSchemaSourceType.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2013-2014 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | namespace SharpTL.Compiler 8 | { 9 | public enum TLSchemaSourceType 10 | { 11 | TL, 12 | JSON 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Tooling/Sharp.TL.Compiler/SharpTL.Compiler.NET45/TemplateVars.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2013 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | namespace SharpTL.Compiler 8 | { 9 | public class TemplateVars 10 | { 11 | public TLSchema Schema { get; set; } 12 | public string Namespace { get; set; } 13 | public string MethodsInterfaceName { get; set; } 14 | public uint tag = 99; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Tooling/Sharp.TL.Compiler/SharpTL.Compiler.NET45/TemplatesParts.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2013 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | namespace SharpTL.Compiler 8 | { 9 | public partial class SharpTLDefaultTemplate 10 | { 11 | public SharpTLDefaultTemplate(TemplateVars templateVars) 12 | { 13 | _templateVars = templateVars; 14 | } 15 | } 16 | 17 | public partial class SchemaMethodsImplTemplate 18 | { 19 | public SchemaMethodsImplTemplate(TemplateVars templateVars) 20 | { 21 | _templateVars = templateVars; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Tooling/Sharp.TL.Compiler/SharpTL.Compiler.NET45/VoidTLType.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2013 Alexander Logger. All rights reserved. 4 | // 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | namespace SharpTL.Compiler 8 | { 9 | public class VoidTLType : TLType 10 | { 11 | public VoidTLType() : base("void", false) 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Tooling/Sharp.TL.Compiler/SharpTL.Compiler.NET45/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Tooling/Sharp.TL.Compiler/SharpTL.Compiler.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Tooling/Sharp.TL.Compiler/SharpTL.Compiler.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | TL --------------------------------------------------------------------------------