ldap-client-0.2.0: Pure Haskell LDAP Client Library

Safe HaskellNone
LanguageHaskell2010

Ldap.Asn1.ToAsn1

Description

This module contains convertions from LDAP types to ASN.1.

Various hacks are employed because "asn1-encoding" only encodes to DER, but LDAP demands BER-encoding. So, when a definition looks suspiciously different from the spec in the comment, that's why. I hope all that will be fixed eventually.

Synopsis

Documentation

class ToAsn1 a where Source #

Convert a LDAP type to ASN.1.

When it's relevant, instances include the part of RFC describing the encoding.

Minimal complete definition

toAsn1

Methods

toAsn1 :: a -> Endo [ASN1] Source #

Instances

ToAsn1 LdapOid Source #
LDAPOID ::= OCTET STRING -- Constrained to <numericoid>

Methods

toAsn1 :: LdapOid -> Endo [ASN1] Source #

ToAsn1 LdapString Source #
LDAPString ::= OCTET STRING -- UTF-8 encoded
ToAsn1 RelativeLdapDn Source #
RelativeLDAPDN ::= LDAPString -- Constrained to <name-component>
ToAsn1 LdapDn Source #
LDAPDN ::= LDAPString -- Constrained to <distinguishedName>

Methods

toAsn1 :: LdapDn -> Endo [ASN1] Source #

ToAsn1 PartialAttribute Source #
PartialAttribute ::= SEQUENCE {
     type       AttributeDescription,
     vals       SET OF value AttributeValue }
ToAsn1 Attribute Source #
Attribute ::= PartialAttribute(WITH COMPONENTS {
     ...,
     vals (SIZE(1..MAX))})

Methods

toAsn1 :: Attribute -> Endo [ASN1] Source #

ToAsn1 AssertionValue Source #
AssertionValue ::= OCTET STRING
ToAsn1 AttributeValueAssertion Source #
AttributeValueAssertion ::= SEQUENCE {
     attributeDesc   AttributeDescription,
     assertionValue  AssertionValue }
ToAsn1 AttributeValue Source #
AttributeValue ::= OCTET STRING
ToAsn1 AttributeDescription Source #
AttributeDescription ::= LDAPString
ToAsn1 Control Source #
Control ::= SEQUENCE {
     controlType             LDAPOID,
     criticality             BOOLEAN DEFAULT FALSE,
     controlValue            OCTET STRING OPTIONAL }

Methods

toAsn1 :: Control -> Endo [ASN1] Source #

ToAsn1 Controls Source #
Controls ::= SEQUENCE OF control Control

Methods

toAsn1 :: Controls -> Endo [ASN1] Source #

ToAsn1 AttributeList Source #
AttributeList ::= SEQUENCE OF attribute Attribute
ToAsn1 AttributeSelection Source #
AttributeSelection ::= SEQUENCE OF selector LDAPString
ToAsn1 MatchingRuleId Source #
MatchingRuleId ::= LDAPString
ToAsn1 MatchingRuleAssertion Source #
MatchingRuleAssertion ::= SEQUENCE {
     matchingRule    [1] MatchingRuleId OPTIONAL,
     type            [2] AttributeDescription OPTIONAL,
     matchValue      [3] AssertionValue,
     dnAttributes    [4] BOOLEAN DEFAULT FALSE }
ToAsn1 SubstringFilter Source #
SubstringFilter ::= SEQUENCE {
     type           AttributeDescription,
     substrings     SEQUENCE SIZE (1..MAX) OF substring CHOICE {
          initial [0] AssertionValue,  -- can occur at most once
          any     [1] AssertionValue,
          final   [2] AssertionValue } -- can occur at most once
     }
ToAsn1 Filter Source #
Filter ::= CHOICE {
     and             [0] SET SIZE (1..MAX) OF filter Filter,
     or              [1] SET SIZE (1..MAX) OF filter Filter,
     not             [2] Filter,
     equalityMatch   [3] AttributeValueAssertion,
     substrings      [4] SubstringFilter,
     greaterOrEqual  [5] AttributeValueAssertion,
     lessOrEqual     [6] AttributeValueAssertion,
     present         [7] AttributeDescription,
     approxMatch     [8] AttributeValueAssertion,
     extensibleMatch [9] MatchingRuleAssertion,
     ...  }

Methods

toAsn1 :: Filter -> Endo [ASN1] Source #

ToAsn1 AuthenticationChoice Source #
AuthenticationChoice ::= CHOICE {
     simple                  [0] OCTET STRING,
     sasl                    [3] SaslCredentials,
     ...  }


SaslCredentials ::= SEQUENCE {
     mechanism               LDAPString,
     credentials             OCTET STRING OPTIONAL }
ToAsn1 ProtocolClientOp Source #
BindRequest ::= [APPLICATION 0] SEQUENCE {
     version                 INTEGER (1 ..  127),
     name                    LDAPDN,
     authentication          AuthenticationChoice }
UnbindRequest ::= [APPLICATION 2] NULL
SearchRequest ::= [APPLICATION 3] SEQUENCE {
     baseObject      LDAPDN,
     scope           ENUMERATED {
          baseObject              (0),
          singleLevel             (1),
          wholeSubtree            (2),
          ...  },
     derefAliases    ENUMERATED {
          neverDerefAliases       (0),
          derefInSearching        (1),
          derefFindingBaseObj     (2),
          derefAlways             (3) },
     sizeLimit       INTEGER (0 ..  maxInt),
     timeLimit       INTEGER (0 ..  maxInt),
     typesOnly       BOOLEAN,
     filter          Filter,
     attributes      AttributeSelection }
ModifyRequest ::= [APPLICATION 6] SEQUENCE {
     object          LDAPDN,
     changes         SEQUENCE OF change SEQUENCE {
          operation       ENUMERATED {
               add     (0),
               delete  (1),
               replace (2),
               ...  },
          modification    PartialAttribute } }
AddRequest ::= [APPLICATION 8] SEQUENCE {
     entry           LDAPDN,
     attributes      AttributeList }
DelRequest ::= [APPLICATION 10] LDAPDN
ModifyDNRequest ::= [APPLICATION 12] SEQUENCE {
     entry           LDAPDN,
     newrdn          RelativeLDAPDN,
     deleteoldrdn    BOOLEAN,
     newSuperior     [0] LDAPDN OPTIONAL }
CompareRequest ::= [APPLICATION 14] SEQUENCE {
     entry           LDAPDN,
     ava             AttributeValueAssertion }
ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
     requestName      [0] LDAPOID,
     requestValue     [1] OCTET STRING OPTIONAL }
ToAsn1 Id Source #
MessageID ::= INTEGER (0 ..  maxInt)

Methods

toAsn1 :: Id -> Endo [ASN1] Source #

ToAsn1 a => ToAsn1 [a] Source # 

Methods

toAsn1 :: [a] -> Endo [ASN1] Source #

ToAsn1 a => ToAsn1 (NonEmpty a) Source # 

Methods

toAsn1 :: NonEmpty a -> Endo [ASN1] Source #

ToAsn1 op => ToAsn1 (LdapMessage op) Source #
LDAPMessage ::= SEQUENCE {
     messageID       MessageID,
     protocolOp      CHOICE {
          bindRequest           BindRequest,
          bindResponse          BindResponse,
          unbindRequest         UnbindRequest,
          searchRequest         SearchRequest,
          searchResEntry        SearchResultEntry,
          searchResDone         SearchResultDone,
          searchResRef          SearchResultReference,
          addRequest            AddRequest,
          addResponse           AddResponse,
          ... },
     controls       [0] Controls OPTIONAL }

Methods

toAsn1 :: LdapMessage op -> Endo [ASN1] Source #