-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
alsmost done basic profile except tensors
- Loading branch information
Showing
144 changed files
with
181 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import SwiftASN1 | ||
import Foundation | ||
|
||
public struct ASN1VisibleString: DERImplicitlyTaggable { | ||
|
||
@inlinable | ||
public static var defaultIdentifier: ASN1Identifier { | ||
.visibleString | ||
} | ||
|
||
public var bytes: ArraySlice<UInt8> | ||
|
||
@inlinable | ||
public init(contentBytes: ArraySlice<UInt8>) { | ||
self.bytes = contentBytes | ||
} | ||
|
||
@inlinable | ||
public init(derEncoded node: ASN1Node, withIdentifier identifier: ASN1Identifier) throws { | ||
guard node.identifier == identifier else { | ||
throw ASN1Error.unexpectedFieldType(node.identifier) | ||
} | ||
|
||
guard case .primitive(let content) = node.content else { | ||
preconditionFailure("ASN.1 parser generated primitive node with constructed content") | ||
} | ||
|
||
self.bytes = content | ||
} | ||
|
||
@inlinable | ||
public func serialize(into coder: inout DER.Serializer, withIdentifier identifier: ASN1Identifier) throws { | ||
let octet = ASN1OctetString(contentBytes: self.bytes) | ||
try octet.serialize(into: &coder, withIdentifier: identifier) | ||
} | ||
|
||
} | ||
|
||
extension ASN1Identifier { | ||
public static let sequenceOf = ASN1Identifier(tagWithNumber: 0x10, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let setOf = ASN1Identifier(tagWithNumber: 0x11, tagClass: ASN1Identifier.TagClass.universal) | ||
/* | ||
public static let boolean = ASN1Identifier(tagWithNumber: 0x01, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let integer = ASN1Identifier(tagWithNumber: 0x02, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let bitString = ASN1Identifier(tagWithNumber: 0x03, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let octetString = ASN1Identifier(tagWithNumber: 0x04, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let null = ASN1Identifier(tagWithNumber: 0x05, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let objectIdentifier = ASN1Identifier(tagWithNumber: 0x06, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let objectDescriptor = ASN1Identifier(tagWithNumber: 0x07, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let external = ASN1Identifier(tagWithNumber: 0x08, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let real = ASN1Identifier(tagWithNumber: 0x09, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let enumerated = ASN1Identifier(tagWithNumber: 0x0a, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let embedded = ASN1Identifier(tagWithNumber: 0x0b, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let utf8String = ASN1Identifier(tagWithNumber: 0x0c, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let relativeIdentifier = ASN1Identifier(tagWithNumber: 0x0d, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let time = ASN1Identifier(tagWithNumber: 0x0e, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let numericString = ASN1Identifier(tagWithNumber: 0x12, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let printableString = ASN1Identifier(tagWithNumber: 0x13, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let teletexString = ASN1Identifier(tagWithNumber: 0x14, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let videotexString = ASN1Identifier(tagWithNumber: 0x15, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let ia5String = ASN1Identifier(tagWithNumber: 0x16, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let utcTime = ASN1Identifier(tagWithNumber: 0x17, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let generalizedTime = ASN1Identifier(tagWithNumber: 0x18, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let graphicString = ASN1Identifier(tagWithNumber: 0x19, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let visibleString = ASN1Identifier(tagWithNumber: 0x1a, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let generalString = ASN1Identifier(tagWithNumber: 0x1b, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let universalString = ASN1Identifier(tagWithNumber: 0x1c, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let bmpString = ASN1Identifier(tagWithNumber: 0x1e, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let sequence = ASN1Identifier(tagWithNumber: 0x30, tagClass: ASN1Identifier.TagClass.universal) | ||
public static let set = ASN1Identifier(tagWithNumber: 0x31, tagClass: ASN1Identifier.TagClass.universal) | ||
*/ | ||
} | ||
|
||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Generated by ASN1.ERP.UNO Compiler, Copyright Β© 2023 Namdak Tonpa. | ||
import SwiftASN1 | ||
import Foundation | ||
|
||
// 'NameRDN':encode('Name',{'rdnSequence',[[{'AttributeTypeAndValue',{2,5,4,6},<<19,2,85,65>>}]]}). | ||
// {ok,<<48,13,49,11,48,9,6,3,85,4,6,19,2,85,65>>} | ||
// DER.name [48,13,49,11,48,9,6,3,85,4,6,19,2,85,65] | ||
|
||
@usableFromInline indirect enum Name: DERParseable, DERSerializable, Hashable, Sendable { | ||
case rdnSequence([[AttributeTypeAndValue]]) | ||
@inlinable init(derEncoded root: ASN1Node) throws { | ||
switch root.identifier { | ||
case ASN1Identifier.sequenceOf: | ||
var w: [[AttributeTypeAndValue]] = [] | ||
try DER.sequence(root, identifier: .sequence) { nodes in | ||
var w1: [AttributeTypeAndValue] = [] | ||
while let node = nodes.next() { | ||
w1.append(contentsOf: | ||
try DER.set(of: AttributeTypeAndValue.self, identifier: .set, rootNode: node)) | ||
} | ||
w.append(w1) | ||
} | ||
self = Name.rdnSequence(w) | ||
default: throw ASN1Error.unexpectedFieldType(root.identifier) | ||
} | ||
|
||
} | ||
@inlinable func serialize(into coder: inout DER.Serializer) throws { | ||
switch self { | ||
case .rdnSequence(let w): | ||
try coder.appendConstructedNode(identifier: ASN1Identifier.sequence) { codec1 in | ||
for w1 in w { | ||
try codec1.appendConstructedNode(identifier: ASN1Identifier.set) { codec1_1 in | ||
for w2 in w1 { | ||
try codec1_1.serialize(w2) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.