# File lib/puppet/sslcertificates/certificate.rb, line 198
198:     def mkselfsigned
199:         unless defined? @key and @key
200:             self.getkey
201:         end
202: 
203:         if defined? @cert and @cert
204:             raise Puppet::Error, "Cannot replace existing certificate"
205:         end
206: 
207:         args = {
208:             :name => self.certname,
209:             :ttl => @ttl,
210:             :issuer => nil,
211:             :serial => 0x0,
212:             :publickey => @key.public_key
213:         }
214:         if @type
215:             args[:type] = @type
216:         else
217:             args[:type] = :server
218:         end
219:         @cert = SSLCertificates.mkcert(args)
220: 
221:         @cert.sign(@key, OpenSSL::Digest::SHA1.new) if @selfsign
222: 
223:         return @cert
224:     end