ServiceStack.RsaUtils.CreatePublicAndPrivateKeyPair C# (CSharp) Method

CreatePublicAndPrivateKeyPair() public static method

public static CreatePublicAndPrivateKeyPair ( RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : RsaKeyPair
rsaKeyLength RsaKeyLengths
return RsaKeyPair
        public static RsaKeyPair CreatePublicAndPrivateKeyPair(RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048)
        {
            using (var rsa = CreateRsa(rsaKeyLength))
            {
                return new RsaKeyPair
                {
                    PrivateKey = rsa.ToXmlString(includePrivateParameters: true),
                    PublicKey = rsa.ToXmlString(includePrivateParameters: false),
                };
            }
        }

Usage Example

Esempio n. 1
0
 public static RsaKeyPair CreatePublicAndPrivateKeyPair(RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048)
 {
     return(RsaUtils.CreatePublicAndPrivateKeyPair(rsaKeyLength));
 }