Beispiel #1
0
        /// <summary>Loads a public/private key pair from the given ASN.1 formatted file.</summary>
        public static Keypair Load(string file)
        {
            // Load the ASN.1 formatted data (errors if the file doesn't exist):
            byte[] asn1 = File.ReadAllBytes(file);

            // Get the private key from it:
            BigInteger priv = Keypair.ExtractPrivateKeyFromAsn1(asn1);

            // Create the keypair:
            Keypair pair = new Keypair(priv);

            // Done:
            return(pair);
        }
Beispiel #2
0
 /// <summary>
 /// Creates a new signee.
 /// Typically used by the Device and Entity objects.</summary>
 public Signee()
 {
     // Create a keypair:
     Key = new Keypair();
 }
Beispiel #3
0
 /// <summary>
 /// Use Signee.Load if you don't know what type of signee a JSON file is.
 /// Creates a signee from the given JSON object.
 /// Used by the Device or Entity objects.</summary>
 internal Signee(JSObject obj)
 {
     // Load the keypair:
     Key = new Keypair(obj["keypair"]);
 }