예제 #1
0
        public void ImportTo(Session pkcs11Session, byte[] ckaLabel, byte[] ckaId, P12ImportedParts importParams)
        {
            if (pkcs11Session == null)
            {
                throw new ArgumentNullException(nameof(pkcs11Session));
            }

            if (ckaLabel == null)
            {
                throw new ArgumentNullException(nameof(ckaLabel));
            }

            if (ckaId == null)
            {
                throw new ArgumentNullException(nameof(ckaId));
            }

            if (importParams.HasFlag(P12ImportedParts.PrivateKey))
            {
                this.ImportPrivateKey(ckaLabel, ckaId, pkcs11Session);
            }

            if (importParams.HasFlag(P12ImportedParts.PublicKey))
            {
                this.ImportPublicKey(ckaLabel, ckaId, pkcs11Session);
            }

            if (importParams.HasFlag(P12ImportedParts.Certificate))
            {
                this.ImportCertificate(ckaLabel, ckaId, pkcs11Session);
            }
        }
예제 #2
0
        public void ImportTo(Session pkcs11Session, string ckaLabel, string ckaId, P12ImportedParts importParams)
        {
            if (pkcs11Session == null)
            {
                throw new ArgumentNullException(nameof(pkcs11Session));
            }

            if (ckaLabel == null)
            {
                throw new ArgumentNullException(nameof(ckaLabel));
            }

            if (ckaId == null)
            {
                throw new ArgumentNullException(nameof(ckaId));
            }

            this.ImportTo(pkcs11Session,
                          Encoding.UTF8.GetBytes(ckaLabel),
                          Encoding.UTF8.GetBytes(ckaId),
                          importParams);
        }