<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoKit",
  "identifier" : "/documentation/CryptoKit/CryptoKitASN1Error",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Apple CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit0aB9ASN1ErrorO"
  },
  "title" : "CryptoKitASN1Error"
}
-->

# CryptoKitASN1Error

Errors from decoding ASN.1 content.

```
enum CryptoKitASN1Error
```

## Topics

### Reporting errors

[`case invalidASN1IntegerEncoding`](/documentation/CryptoKit/CryptoKitASN1Error/invalidASN1IntegerEncoding)

An ASN.1 integer doesn’t use the minimum number of bytes for its
encoding.

[`case invalidASN1Object`](/documentation/CryptoKit/CryptoKitASN1Error/invalidASN1Object)

The format of the parsed ASN.1 object doesn’t match the format required
for the data type being decoded.

[`case invalidFieldIdentifier`](/documentation/CryptoKit/CryptoKitASN1Error/invalidFieldIdentifier)

The ASN.1 tag for this field is invalid or unsupported.

[`case invalidObjectIdentifier`](/documentation/CryptoKit/CryptoKitASN1Error/invalidObjectIdentifier)

An ASN.1 object identifier is invalid.

[`case invalidPEMDocument`](/documentation/CryptoKit/CryptoKitASN1Error/invalidPEMDocument)

The string doesn’t parse as a PEM document.

[`case truncatedASN1Field`](/documentation/CryptoKit/CryptoKitASN1Error/truncatedASN1Field)

An ASN.1 field is truncated.

[`case unexpectedFieldType`](/documentation/CryptoKit/CryptoKitASN1Error/unexpectedFieldType)

The ASN.1 tag for the parsed field doesn’t match the required format.

[`case unsupportedFieldLength`](/documentation/CryptoKit/CryptoKitASN1Error/unsupportedFieldLength)

The encoding used for the field length is unsupported.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

[`Error`](/documentation/Swift/Error)

[`Hashable`](/documentation/Swift/Hashable)

[`Equatable`](/documentation/Swift/Equatable)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)