Exemplo n.º 1
0
        public static OneKey FromPkcs8(byte[] data)
        {
            AsymmetricKeyParameter akp = PrivateKeyFactory.CreateKey(data);

            OneKey key = new OneKey();

            key.FromKey(akp);

            return(key);
        }
Exemplo n.º 2
0
        public static OneKey FromX509(byte[] x509)
        {
            X509Certificate cert = new X509CertificateParser().ReadCertificate(x509);

            SubjectPublicKeyInfo spki = cert.CertificateStructure.SubjectPublicKeyInfo;

            AsymmetricKeyParameter pub = PublicKeyFactory.CreateKey(spki);

            OneKey newKey = new OneKey();

            newKey.FromKey(pub);
            return(newKey);
        }