summary refs log tree commit diff
path: root/crypto/src/asn1
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2019-08-04 14:59:54 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2019-08-04 14:59:54 +0700
commitbbfa024697bd0ec381fc1a0507bd0dedc6696f63 (patch)
treeb8a60695d573c661642f7e3d6636331408ce2f18 /crypto/src/asn1
parentImprove caching behaviour for algorithms using endomorphisms (diff)
downloadBouncyCastle.NET-ed25519-bbfa024697bd0ec381fc1a0507bd0dedc6696f63.tar.xz
Refactoring in PublicKeyFactory
- add SubjectPublicKeyInfo.ParsePublicKey and use where applicable
- validate GOST3410 public key lengths
Diffstat (limited to 'crypto/src/asn1')
-rw-r--r--crypto/src/asn1/x509/SubjectPublicKeyInfo.cs13
1 files changed, 13 insertions, 0 deletions
diff --git a/crypto/src/asn1/x509/SubjectPublicKeyInfo.cs b/crypto/src/asn1/x509/SubjectPublicKeyInfo.cs
index 477329b7e..ae44a451f 100644
--- a/crypto/src/asn1/x509/SubjectPublicKeyInfo.cs
+++ b/crypto/src/asn1/x509/SubjectPublicKeyInfo.cs
@@ -66,6 +66,18 @@ namespace Org.BouncyCastle.Asn1.X509
 			get { return algID; }
         }
 
+        /**
+         * for when the public key is an encoded object - if the bitstring
+         * can't be decoded this routine raises an IOException.
+         *
+         * @exception IOException - if the bit string doesn't represent a Der
+         * encoded object.
+         */
+        public Asn1Object ParsePublicKey()
+        {
+            return Asn1Object.FromByteArray(keyData.GetOctets());
+        }
+
 		/**
          * for when the public key is an encoded object - if the bitstring
          * can't be decoded this routine raises an IOException.
@@ -73,6 +85,7 @@ namespace Org.BouncyCastle.Asn1.X509
          * @exception IOException - if the bit string doesn't represent a Der
          * encoded object.
          */
+        [Obsolete("Use 'ParsePublicKey' instead")]
         public Asn1Object GetPublicKey()
         {
 			return Asn1Object.FromByteArray(keyData.GetOctets());