summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crypto/src/asn1/Asn1OctetString.cs7
-rw-r--r--crypto/src/asn1/BerOctetString.cs8
-rw-r--r--crypto/src/asn1/DerOctetString.cs7
3 files changed, 22 insertions, 0 deletions
diff --git a/crypto/src/asn1/Asn1OctetString.cs b/crypto/src/asn1/Asn1OctetString.cs
index e52e50759..d8a7bf27a 100644
--- a/crypto/src/asn1/Asn1OctetString.cs
+++ b/crypto/src/asn1/Asn1OctetString.cs
@@ -88,6 +88,13 @@ namespace Org.BouncyCastle.Asn1
 			this.contents = contents;
         }
 
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+        internal Asn1OctetString(ReadOnlySpan<byte> contents)
+        {
+            this.contents = contents.ToArray();
+        }
+#endif
+
         public Stream GetOctetStream()
 		{
 			return new MemoryStream(contents, false);
diff --git a/crypto/src/asn1/BerOctetString.cs b/crypto/src/asn1/BerOctetString.cs
index 10d8d6db6..fd6b85be2 100644
--- a/crypto/src/asn1/BerOctetString.cs
+++ b/crypto/src/asn1/BerOctetString.cs
@@ -67,6 +67,14 @@ namespace Org.BouncyCastle.Asn1
         {
         }
 
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+        internal BerOctetString(ReadOnlySpan<byte> contents)
+            : base(contents)
+        {
+            this.elements = null;
+        }
+#endif
+
         private BerOctetString(byte[] contents, Asn1OctetString[] elements)
             : base(contents)
         {
diff --git a/crypto/src/asn1/DerOctetString.cs b/crypto/src/asn1/DerOctetString.cs
index 3680a6fd4..7ea9940b3 100644
--- a/crypto/src/asn1/DerOctetString.cs
+++ b/crypto/src/asn1/DerOctetString.cs
@@ -21,6 +21,13 @@ namespace Org.BouncyCastle.Asn1
         {
         }
 
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+        internal DerOctetString(ReadOnlySpan<byte> contents)
+            : base(contents)
+        {
+        }
+#endif
+
         internal override IAsn1Encoding GetEncoding(int encoding)
         {
             return new PrimitiveEncoding(Asn1Tags.Universal, Asn1Tags.OctetString, contents);